-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optional pinning of the deployment version to the project version #17
base: main
Are you sure you want to change the base?
Optional pinning of the deployment version to the project version #17
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CiottiGiorgio make sure to also regenerate example's folder ( by running poetry run pytest) which is also used as an artifacts root for snapshot testing.
|
||
def find_app_spec_file(output_dir: Path) -> str | None: | ||
for file in output_dir.iterdir(): | ||
if file.is_file() and file.suffixes == [".arc32", ".json"]: | ||
return file.name | ||
return None | ||
|
||
|
||
def find_pyproject_version(pyproject_toml: Path) -> str | None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about something like this instead
def find_pyproject_version(pyproject_toml: Path) -> str | None:
"""Finds the project version from a 'pyproject.toml' file.
Args:
pyproject_toml: The path to the 'pyproject.toml' file.
Returns:
The project version if found, otherwise None.
"""
try:
data = tomllib.load(pyproject_toml.open('rb'))
return data.get('tool', {}).get('poetry', {}).get('version')
except (FileNotFoundError, tomllib.TOMLDecodeError):
return None
@CiottiGiorgio to patch last ci error make sure to run pre-commit to auto fix the code |
@CiottiGiorgio just checking in, whats the latest on the following ? Is this tracked against some reported issue? Can merge this as soon as the ci cd is fixed |
Hey sorry been busy with other tasks. I plan on resuming this work next week. |
@CiottiGiorgio no rush, not blocking - can re review as soon as you merge conflicts |
This PR proposes modifying the template to allow the user to pin the deployment version to the project version.
The user would enable this feature by un-commenting a single line in
deployment_config.py
for each contract that they want to pin.We resorted to reading the project version from
pyproject.toml
usingtomllib
(and not by installing an editable version in the localvenv
) because a TS deployer cannot access the version that way. Parsing the TOML makes more sense from a code parity standpoint.At the point of writing this PR, the version is a string that is not used to determine if a deploy should result in an update/replace/append action.
This is still a work in progress. Items missing are:
tomllib
makesmypy
complain