TileDB-Inc / cellxgene-census-feedstock

BSD 3-Clause "New" or "Revised" License
2 stars 1 forks source link

Version number prints incorrectly #12

Open johnkerl opened 3 months ago

johnkerl commented 3 months ago

After conda-install in TileDB Cloud we see

import cellxgene_census
print(cellxgene_census.__version__)
 'cellxgene_census': '0.1.dev1+g54893c9.d20240617'}```

The code itself is OK -- it seems the version-printer is not.

johnkerl commented 3 months ago

I need to assign this to @jdblischak but he's not in this repo -- I'll add him

jdblischak commented 3 months ago

I confirmed the problem locally:

# PyPI
python -m venv ./cellxgene
./cellxgene/bin/python -m pip install cellxgene-census
## Collecting cellxgene-census
##   Downloading cellxgene_census-1.14.1-py3-none-any.whl (47 kB)
./cellxgene/bin/python -c "import cellxgene_census; print(cellxgene_census.__version__)"
## 1.14.1

# conda
mamba create --yes -n cellxgene -c conda-forge -c tiledb python=3.9 cellxgene-census
## + cellxgene-census                        1.14.1  pyh4471522_0            tiledb            43kB
mamba activate cellxgene
python -c "import cellxgene_census; print(cellxgene_census.__version__)"
## 0.1.dev1+g54893c9.d20240617
jdblischak commented 3 months ago

I suspect this is a setuptools-scm issue like we've seen previously for TileDB-VCF.

The Python package uses a dynamic version via setuptools-scm:

[build-system]
requires = ["setuptools>=64", "setuptools_scm[toml]>=8"]
build-backend = "setuptools.build_meta"

[project]
name = "cellxgene-census"
dynamic = ["version"]

And the conda recipe downloads the PyPI source tarball, which has no Git repo associated with it:

https://github.com/TileDB-Inc/cellxgene-census-feedstock/blob/54893c94d30edd73738e2ed1de874391db58bfc8/recipe/meta.yaml#L13-L14

But the PyPI source tarball does include a PKG-INFO that has the correct version specified. And when I install the source tarball locally (ie with no Git repository), it gets the version correct, so why doesn't the same thing happen during the conda build?

wget https://pypi.io/packages/source/c/cellxgene-census/cellxgene_census-1.14.1.tar.gz
python -m venv ./cellxgene-source
./cellxgene-source/bin/python -m pip install cellxgene_census-1.14.1.tar.gz
## Building wheels for collected packages: cellxgene-census
##   Building wheel for cellxgene-census (pyproject.toml) ... done
##   Created wheel for cellxgene-census: filename=cellxgene_census-1.14.1-py3-none-any.whl size=47383 sha256=eb2265dcb98ef741f823193785d09a0fc76295bc705c6c4c286475600ea12b54
./cellxgene-source/bin/python -c "import cellxgene_census; print(cellxgene_census.__version__)"
## 1.14.1
johnkerl commented 3 months ago

@jdblischak weerd

I don't know much about this -- at all! -- happy to dig in from scratch if it helps ...

I would note that tiledbsoma (IIRC) we solved the same problem ...

jdblischak commented 3 months ago

SOMA doesn't use setuptools-scm. It uses a bespoke version.py. I'll continue investigating tomorrow. Worst case we can update this recipe to pull directly from the GitHub repo. It's not on conda-forge, so we can be more flexible.

johnkerl commented 3 months ago

Oh nuts, sorry @jdblischak ! @nguyenv and/or @thetorpedodog may know more off top head than I do.