Garden-AI / garden

https://garden-ai.readthedocs.io
MIT License
20 stars 4 forks source link

the version is still wrong #63

Closed Aadit-Ambadkar closed 1 year ago

Aadit-Ambadkar commented 1 year ago

the version in version.py still shows 0.0.1, despite 0.1.0 being released already

This should come from the package and is set during the GHA -- maybe remove it from pyoroject.toml and grab the value from import lib.

Acceptance criteria

Garden-AI cli has a --version option that works and there are no 0.0.1 values floating around in the code base

blaiszik commented 1 year ago

Ah yes, I think the issue is from this file: https://github.com/Garden-AI/garden/blob/main/garden_ai/version.py

The version that gets set to pyPi now lives in https://github.com/Garden-AI/garden/blob/main/pyproject.toml. Is it safe to remove version.py?

OwenPriceSkelly commented 1 year ago

I think it should be safe to delete. I don't think version.py is used anywhere; when poetry publishes it'd only look at pyproject.toml and the lockfile. Coincidentally though, the version in pyproject.toml has been at 0.1.0 as a default for the lifetime of the project, so next release we should do a sanity check that importlib.metadata.version("garden-ai") correctly reads the GH version and not 0.1.0

WardLT commented 1 year ago

I've seen other projects use importlib to look up the version number inside the module so that one could still check the version number easily.

I mimic that pattern here: https://github.com/exalearn/colmena/blob/master/colmena/version.py

Then you add a from .version import __version__ # noqa: 401 to the __init__.py so that users can from garden import __version__

WardLT commented 1 year ago

(In summary, don't delete because it's nice to be able to check version numbers of a module w/o importlib)

Aadit-Ambadkar commented 1 year ago

@WardLT

do you recommend import importlib.metadata, and then __version__ = importlib.metadata.version('garden_ai') once we discontinue 3.7 support?

additionally, in poetry.lock we only require 3.6 or above, that needs to be changed.

WillEngler commented 1 year ago

Suggested implementation: version number is set at publication time via an env variable.