Skip to content
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

Allow for version number to be set #69

Closed

Conversation

jonringer
Copy link

@jonringer jonringer commented Jan 14, 2022

closes: #62

@jonringer jonringer marked this pull request as draft January 14, 2022 23:59
@jonringer
Copy link
Author

This doesn't work, but I tried.

Copy link
Owner

@mtkennerly mtkennerly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for getting this started. I'm open to adding it, but we just need to fix it up.

)
# allow for version to be overwritten, or fetch from vcs
if "POETRY_DYNAMIC_VERSIONING_PRETEND_VERSION" in os.environ.keys:
version = Version(os.environ.get("POETRY_DYNAMIC_VERSIONING_PRETEND_VERSION"))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make this work, we should do a little bit of refactoring:

_get_version() currently returns both a Dunamai Version and an opaque string, but the Version isn't really needed (it's stored, but not being used currently) and is causing a complication for this new option. I think _get_version() should just immediately return the opaque string from the environment variable if it's set and ditch the Version from the return.

Since the environment variable is a backdoor, we should make sure we skip the formatting/bumping logic and use it as-is. In other words, rather than setting 1.2.3 in the env var and letting the plugin bump it to 1.2.4, I would expect to set the env var to 1.2.4 directly.

)
# allow for version to be overwritten, or fetch from vcs
if "POETRY_DYNAMIC_VERSIONING_PRETEND_VERSION" in os.environ.keys:
version = Version(os.environ.get("POETRY_DYNAMIC_VERSIONING_PRETEND_VERSION"))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to call the variable POETRY_DYNAMIC_VERSIONING_BYPASS to convey that it's bypassing the regular function of the plugin.

@mtkennerly
Copy link
Owner

Closing in favor of 1fc9aac.

@mtkennerly mtkennerly closed this Mar 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Able to set version using environment variable
2 participants