Skip to content

Use shortest path to _version.py #27

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

Merged
merged 2 commits into from
Dec 9, 2022
Merged

Conversation

martellato
Copy link
Collaborator

Minimize the path to look for _version.py

@@ -9,7 +9,7 @@
if __name__ == "__main__":
# Parse version file (Cannot import relative boo)
pkg_base = Path(os.getcwd())
ver_file, *_ = [*pkg_base.glob('**/_version.py')]
ver_file = min([*pkg_base.glob('**/_version.py')], key=lambda path: len(path.resolve().parents))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe resolve is unnecessary but doesn't hurt

@martellato martellato merged commit bd645f2 into main Dec 9, 2022
@martellato martellato deleted the shortest-path-to-version-file branch December 9, 2022 19:26
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.

2 participants