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

Need to fix dynamic version from setuptools-scm for conda binary #5

Open
jdblischak opened this issue Dec 11, 2024 · 1 comment
Open
Assignees

Comments

@jdblischak
Copy link
Collaborator

Our first release was 0.1.0alpha. However, the Python package installed from the conda binary reports version 0.1.0-dev because setuptools-scm can't find any Git tags (since we are installing from the GitHub release tarball).

mamba create --yes -n test-soma-ml -c conda-forge -c tiledb tiledbsoma-ml
mamba activate test-soma-ml
conda list soma
## # Name                    Version                   Build  Channel
## libtiledbsoma             1.15.0rc3            hc73c20e_1    tiledb
## somacore                  1.0.22             pyh4471522_0    tiledb
## tiledbsoma-ml             0.1.0alpha         pyh4471522_0    tiledb
## tiledbsoma-py             1.15.0rc3       py312hc84bcbe_1    tiledb
python -c "import tiledbsoma_ml as soma_ml; print(soma_ml.__version__)"
## 0.1.0-dev

There are two potential workarounds to fix this:

  1. (my preference) Use the PyPI tarball as the recipe source and extract the version from PKG-INFO. This is the strategy I used for cellxgene-census in Set package version via SETUPTOOLS_SCM_PRETEND_VERSION cellxgene-census-feedstock#16. The main drawback of this approach is that it isn't feasible until we submit tiledbsoma-ml to PyPI
  2. Change the recipe source to the Git repo, checkout the tag, and do a non-shallow clone. This is the strategy I used in tiledb-vcf-feedstock since we have decided to not submit it to PyPI (https://github.com/TileDB-Inc/tiledb-vcf-feedstock/blob/d3eadffd41422a403427a48b392f2a3ab495874e/recipe/meta.yaml#L8-L13)
@jdblischak jdblischak self-assigned this Dec 11, 2024
@jdblischak
Copy link
Collaborator Author

I had an idea but unfortunately it didn't work.

I tried setting SETUPTOOLS_SCM_PRETEND_VERSION to the jinja2 variable {{ version }} that contains the version of the conda recipe:

  script: >-
    SETUPTOOLS_SCM_PRETEND_VERSION="{{ version }}"
    {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation

The rendering was done correctly:

  script: SETUPTOOLS_SCM_PRETEND_VERSION="0.1.0alpha" /home/conda/feedstock_root/build_artifacts/tiledbsoma-ml_1734021860689/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/bin/python
    -m pip install . -vv --no-deps --no-build-isolation

But the installation still used 0.1.0.dev0:

Successfully built tiledbsoma-ml
Installing collected packages: tiledbsoma-ml

Successfully installed tiledbsoma-ml-0.1.0.dev0

And __version__ reported 0.1.0-dev:

python -c 'import tiledbsoma_ml as soma_ml; print(soma_ml.__version__)'
## 0.1.0-dev

So apparently setuptools-scm uses SETUPTOOLS_SCM_PRETEND_VERSION when building from a PyPI source tarball but not when directly building from the GitHub source tarball.

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

No branches or pull requests

1 participant