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

Make version dynamic #25

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jdblischak
Copy link

Motivation

The version is currently hard-coded as 0.1.0-dev:

__version__ = "0.1.0-dev"

Thus even though there are tags available, they are ignored:

git clone https://github.com/single-cell-data/TileDB-SOMA-ML.git
cd TileDB-SOMA-ML/
git log -n 1 --oneline
## e985fcb (HEAD -> main, origin/main, origin/HEAD) compat GHA: use tdbs 1.15.2 (#24)
git tag -l
## 0.1.0alpha
## 0.1.0alpha2
git describe --dirty --tags --long --match *[0-9]*
## 0.1.0alpha2-1-ge985fcb

python -m venv ./venv-ml
source ./venv-ml/bin/activate
pip install build setuptools-scm

python -m setuptools_scm
## Warning: could not use pyproject.toml, using default configuration.
##  Reason: /tmp/TileDB-SOMA-ML/pyproject.toml does not contain a tool.setuptools_scm section.
## 0.1.0a3.dev1+ge985fcb
python -m build .
## Successfully built tiledbsoma_ml-0.1.0.dev0.tar.gz and tiledbsoma_ml-0.1.0.dev0-py3-none-any.whl
pip install --prefer-binary dist/tiledbsoma_ml-*.tar.gz

pip list | grep tiledbsoma-ml
## tiledbsoma-ml            0.1.0.dev0
# Switch directory to not import source package
cd .. && python -c "import tiledbsoma_ml as soma_ml; print(soma_ml.__version__)"
## 0.1.0-dev

And because of this hard-coding, I can't override the version string in the conda recipe using SETUPTOOLS_SCM_PRETEND_VERSION (TileDB-Inc/tiledb-soma-ml-feedstock#5 (comment)).

Solution

I decided to use the latest setuptools-scm 8+ solution, so I deleted the section tool.setuptools.dynamic, which uses the dynamic metadata feature of setuptools.

I managed to get it working. I also confirmed that SETUPTOOLS_SCM_PRETEND_VERSION mostly works now.

There is still some strangeness. First, our alpha gets truncated to a. I think this is because of PEP 440. Also, it reports 0.1.0a3 (as above in the output from python -m setuptools_scm), which I don't understand. Hopefully once we drop the alpha from our version strings the dynamic versions will be more predictable.

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.

1 participant