cta-observatory / cta-lstchain

LST prototype testbench chain
https://cta-observatory.github.io/cta-lstchain/
BSD 3-Clause "New" or "Revised" License
25 stars 77 forks source link

unknown version when pip install #515

Open vuillaut opened 4 years ago

vuillaut commented 4 years ago

Starting with a fresh env and pip installing lstchain from a tagged release, I get an unknown version:

LSTCHAIN_VER=0.6.0
wget https://raw.githubusercontent.com/cta-observatory/cta-lstchain/v$LSTCHAIN_VER/environment.yml
conda env create -n lst -f environment.yml
conda activate lst
pip install https://github.com/cta-observatory/cta-lstchain/archive/v$LSTCHAIN_VER.zip
In [1]: import lstchain

In [2]: lstchain.__version__
Out[2]: 'unknown'
maxnoe commented 4 years ago

This will always be the case with a versioning tool relying on git information.

You simply have no version information in the auto-generated tarball by github.

you can do pip install git+https://github.com/cta-observatory/cta-lstchain.git@v{VERSION}, to use the git repo, where the version.py will be able to get the version from the git info.

What you could do is upload an sdist with every release, which includes the extracted version information from travis

vuillaut commented 4 years ago

Thanks for the reply.

It's quite confusing that a tagged release does not know its own version... Maybe we should update the way users are supposed to install fixed releases in the README - e.g. using the trick you mention - as I don't think this is the expected way or behavior.

maxnoe commented 4 years ago

This came up several times in the past, but this is really a limitation of the automatic tar ball creation.

You could upload the sdist on travis using github releases like described here: https://docs.travis-ci.com/user/deployment/releases/

Basically you need to call python setup.py sdist and upload the resulting file using what is described in the travis docs

maxnoe commented 4 years ago

I just saw this PR here: https://github.com/astropy/astropy/pull/10774, maybe that could be a solution?