Skip to content

"force-local-version" for local_scheme #717

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

Closed
ileixe opened this issue Jun 3, 2022 · 2 comments
Closed

"force-local-version" for local_scheme #717

ileixe opened this issue Jun 3, 2022 · 2 comments

Comments

@ileixe
Copy link

ileixe commented Jun 3, 2022

Hi,

I wonder it's possible to introduce new entry-point forcefully generates "local_scheme".

def _format_local_with_time(version, time_format):

    if version.exact or version.node is None:
        return version.format_choice(
            "", "+d{time:{time_format}}", time_format=time_format
        )
    else:
        return version.format_choice(
            "+{node}", "+{node}.d{time:{time_format}}", time_format=time_format
        )

Currently, if version is "exact", commit hash is omitted like above. However we're using the local scheme (commit hash) no matter what environment to give more information to user so want to decouple the "exactness" with local_scheme.

So basically what I'm suggesting is to add something similar below

-def _format_local_with_time(version, time_format):
+def _format_local_with_time(version, time_format, force=False):

-    if version.exact or version.node is None:
+    if not force and (version.exact or version.node is None):
         return version.format_choice(
             "", "+d{time:{time_format}}", time_format=time_format
         )
@@ -428,6 +421,10 @@ def get_no_local_node(_):
     return ""


+def get_local_node_and_date_force(version):
+    return _format_local_with_time(version, time_format="%Y%m%d", force=True)

Is it general enough case to support it?

Thanks.

@RonnyPfannschmidt
Copy link
Contributor

I would recommend to make this a extra package with the entrypoint

@ileixe
Copy link
Author

ileixe commented Jun 3, 2022

Ok, thanks for fast response.

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

No branches or pull requests

2 participants