DiamondLightSource / python3-pip-skeleton

Archived in favour of https://github.com/DiamondLightSource/python-copier-template
Apache License 2.0
4 stars 4 forks source link

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

Open coretl opened 1 year ago

coretl commented 1 year ago

In #81 @garryod changed to get __version__ from importlib.metadata: https://github.com/DiamondLightSource/python3-pip-skeleton/blob/913fd74c8a15628f64a5823fc7255fcee1c695a2/src/python3_pip_skeleton/__init__.py#L1-L3

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: https://github.com/DiamondLightSource/python3-pip-skeleton/blob/913fd74c8a15628f64a5823fc7255fcee1c695a2/pyproject.toml#L50-L51 and ignoring it: https://github.com/DiamondLightSource/python3-pip-skeleton/blob/913fd74c8a15628f64a5823fc7255fcee1c695a2/.gitignore#L26

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

coretl commented 1 year ago

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 commented 1 year ago

but maybe importlib is more standard

GDYendell commented 1 year ago

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 commented 1 year ago

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

GDYendell commented 1 year ago

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