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

avoid importing detect_secrets in setup.py #408

Merged
merged 1 commit into from
Feb 25, 2021

Conversation

bo5o
Copy link
Contributor

@bo5o bo5o commented Feb 25, 2021

Fixes #407

@domanchi
Copy link
Contributor

🤦 Thanks for this, @cbows!

@domanchi domanchi merged commit e985f2d into Yelp:master Feb 25, 2021

def get_version():
"""Parse package __version__.py to get version."""
versionpy = Path('detect_secrets/__version__.py').read_text()

Choose a reason for hiding this comment

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

This should accommodate platforms that don't use / as a path separator:

Suggested change
versionpy = Path('detect_secrets/__version__.py').read_text()
versionpy = Path('detect_secrets').joinpath('__version__.py').read_text()

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair point. Will ensure this gets added to the patch version.

Copy link
Contributor Author

@bo5o bo5o Feb 25, 2021

Choose a reason for hiding this comment

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

not sure if pathlib handles this by default anyway, but a more pythonic way would be to write Path('detect_secrets') / '__version__.py'. / is actually overloaded for path objects to do the right thing.

EDIT: I just checked using '/' in Windows, and it just works. This is also documented behavior (see https://docs.python.org/3/library/pathlib.html#pathlib.PurePath)

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.

detect-secrets 1.0.0 pre-commit hook broken
3 participants