Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Is there any benefit in generating _version.py? #123

Open
coretl opened this issue Feb 23, 2023 · 5 comments
Open

Is there any benefit in generating _version.py? #123

coretl opened this issue Feb 23, 2023 · 5 comments

Comments

@coretl
Copy link
Contributor

coretl commented Feb 23, 2023

In #81 @garryod changed to get __version__ from importlib.metadata:

from importlib.metadata import version
__version__ = version("python3-pip-skeleton")

This means that we require the module to be installed so we know the version. This means that _version.py is not used, ever. We can clean up here, and stop generating it:

[tool.setuptools_scm]
write_to = "src/python3_pip_skeleton/_version.py"

and ignoring it:
**/_version.py

@garryod @GDYendell @gilesknap @AlexanderWells-diamond: any reason we should not do this?

@coretl
Copy link
Contributor Author

coretl commented Feb 23, 2023

The other option would be to change __init__.py to always import from _version.py:

try:
    from ._version import __version__
except ImportError:
   __version__ = "not-installed"

@coretl
Copy link
Contributor Author

coretl commented Feb 23, 2023

but maybe importlib is more standard

@GDYendell
Copy link
Collaborator

GDYendell commented Feb 23, 2023

I think #81 removed the ability to check versions with a git archive and that is what checking in the _version.py is for, right?

@coretl
Copy link
Contributor Author

coretl commented Feb 23, 2023

But _version.py is not present in the archive, so I don't think it's that either...

@GDYendell
Copy link
Collaborator

I think it isn't giving us anything now then.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants