templateflow / python-client

A python client to query TemplateFlow via pyBIDS
https://templateflow.org/python-client/
Apache License 2.0
8 stars 12 forks source link

Installation from PyPi is missing the version #67

Closed Flamefire closed 2 years ago

Flamefire commented 3 years ago

When downloading the source package from PyPi and installing it with pip install . the version of templateflow is set to 0.0

This is due to the setup() call in setup.py missing the use_scm_version=True argument. See https://pypi.org/project/setuptools-scm/

From the "setup.cfg usage" section

However, use_scm_version must still be placed in setup.py

Alternatively the setup.py file could also be removed so the PEP158 installation is used and no data duplication is required (check this carefully, not fully sure about setup.cfg vs pyproject.toml)

oesteban commented 3 years ago

would you care to send a patch? it would be very much appreciated and we can keep track of your contribution reporting the problem thereafter.

oesteban commented 2 years ago

I have just tried to replicate and failed - pulled the source package from pypi and run pip install ., the reported version was 0.7.1 as expected. It is my impression that use_scm_version is no longer required.

Please reopen if this is not the case.

Flamefire commented 2 years ago

, the reported version was 0.7.1 as expected.

How did you check that? I just tried that and got:

Building wheels for collected packages: templateflow
  Building wheel for templateflow (PEP 517) ... done
  Created wheel for templateflow: filename=templateflow-0.0.0-py3-none-any.whl size=209102 sha256=29b6ca931ef9c6cf4cc2a1586d66c559de0f341f0227d3c60b8ec617fc46317d
  Stored in directory: /home/h3/s3248973/.cache/pip/wheels/6c/84/bb/e3c873ed8b76aaddce9e5189aae2e0e652352da6b396199a8b
Successfully built templateflow
Installing collected packages: bids-validator, sqlalchemy, num2words, pybids, templateflow
Successfully installed bids-validator-1.8.2 num2words-0.5.10 pybids-0.13.2 sqlalchemy-1.3.24 templateflow-0.0.0

And pip list shows: templateflow 0.0.0

Also the documentation of setuptools is pretty clear that this option IS required, see the quoted sentence in my initial post.

I opened https://github.com/templateflow/python-client/pull/81 for that.

oesteban commented 2 years ago

What is your setuptools_scm version?

Flamefire commented 2 years ago
setuptools                    46.1.3    
setuptools-scm                3.5.0
oesteban commented 2 years ago

I just checked, and the Pypi tarball does have the file templateflow/_version.py with the appropriate version 0.7.1 set there.

Flamefire commented 2 years ago

Sure, but the meta-data of the installed python package doesn't get that without the line I added which is required as per the official documentation

oesteban commented 2 years ago
(base) oesteban@hos65851:~$ python -m venv templateflow-env
(base) oesteban@hos65851:~$ source templateflow-env/bin/activate
(templateflow-env) (base) oesteban@hos65851:~$ cd Downloads
(templateflow-env) (base) oesteban@hos65851:~/Downloads$ wget https://files.pythonhosted.org/packages/5a/36/f0ff44c4e11b91dd8398001c675753cea7ce47db0f67b6f1ed98a4ed806d/templateflow-0.7.1.tar.gz
--2021-09-15 10:26:57--  https://files.pythonhosted.org/packages/5a/36/f0ff44c4e11b91dd8398001c675753cea7ce47db0f67b6f1ed98a4ed806d/templateflow-0.7.1.tar.gz
Resolving files.pythonhosted.org (files.pythonhosted.org)... 151.101.113.63, 2a04:4e42:1b::319
Connecting to files.pythonhosted.org (files.pythonhosted.org)|151.101.113.63|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 211938 (207K) [application/x-tar]
Saving to: ‘templateflow-0.7.1.tar.gz.1’

templateflow-0.7.1.tar.gz.1                          100%[=====================================================================================================================>] 206.97K  --.-KB/s    in 0.02s   

2021-09-15 10:26:58 (8.93 MB/s) - ‘templateflow-0.7.1.tar.gz.1’ saved [211938/211938]

(templateflow-env) (base) oesteban@hos65851:~/Downloads$ tar xzf templateflow-0.7.1.tar.gz.1 
(templateflow-env) (base) oesteban@hos65851:~/Downloads$ cd templateflow-0.7.1/
(templateflow-env) (base) oesteban@hos65851:~/Downloads/templateflow-0.7.1$ pip install .
Processing /data/home/oesteban/Downloads/templateflow-0.7.1
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting pybids>=0.12.1
  Downloading pybids-0.13.2-py3-none-any.whl (3.2 MB)
     |████████████████████████████████| 3.2 MB 6.0 MB/s 
Collecting tqdm
  Downloading tqdm-4.62.2-py2.py3-none-any.whl (76 kB)
     |████████████████████████████████| 76 kB 2.3 MB/s 
Collecting requests
  Using cached requests-2.26.0-py2.py3-none-any.whl (62 kB)
Collecting patsy
  Using cached patsy-0.5.1-py2.py3-none-any.whl (231 kB)
Collecting sqlalchemy<1.4.0.dev0
  Using cached SQLAlchemy-1.3.24-cp38-cp38-manylinux2010_x86_64.whl (1.3 MB)
Collecting nibabel>=2.1
  Using cached nibabel-3.2.1-py3-none-any.whl (3.3 MB)
Collecting click
  Using cached click-8.0.1-py3-none-any.whl (97 kB)
Collecting pandas>=0.23
  Downloading pandas-1.3.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.5 MB)
     |████████████████████████████████| 11.5 MB 84.8 MB/s 
Collecting bids-validator
  Downloading bids_validator-1.8.2-py2.py3-none-any.whl (19 kB)
Collecting scipy
  Downloading scipy-1.7.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl (28.4 MB)
     |████████████████████████████████| 28.4 MB 64.4 MB/s 
Collecting num2words
  Using cached num2words-0.5.10-py3-none-any.whl (101 kB)
Collecting numpy
  Downloading numpy-1.21.2-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (15.8 MB)
     |████████████████████████████████| 15.8 MB 9.6 MB/s 
Collecting idna<4,>=2.5; python_version >= "3"
  Using cached idna-3.2-py3-none-any.whl (59 kB)
Collecting urllib3<1.27,>=1.21.1
  Using cached urllib3-1.26.6-py2.py3-none-any.whl (138 kB)
Collecting charset-normalizer~=2.0.0; python_version >= "3"
  Downloading charset_normalizer-2.0.5-py3-none-any.whl (37 kB)
Collecting certifi>=2017.4.17
  Downloading certifi-2021.5.30-py2.py3-none-any.whl (145 kB)
     |████████████████████████████████| 145 kB 10.7 MB/s 
Collecting six
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting packaging>=14.3
  Using cached packaging-21.0-py3-none-any.whl (40 kB)
Collecting python-dateutil>=2.7.3
  Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting pytz>=2017.3
  Using cached pytz-2021.1-py2.py3-none-any.whl (510 kB)
Processing /home/oesteban/.cache/pip/wheels/56/ea/58/ead137b087d9e326852a851351d1debf4ada529b6ac0ec4e8c/docopt-0.6.2-py2.py3-none-any.whl
Collecting pyparsing>=2.0.2
  Using cached pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
Building wheels for collected packages: templateflow
  Building wheel for templateflow (PEP 517) ... done
  Created wheel for templateflow: filename=templateflow-0.7.1-py3-none-any.whl size=209119 sha256=9c92fb3f18309270bb112aa41c6bda0e9f2efc74b77faf6009fb7d5043637d2e
  Stored in directory: /home/oesteban/.cache/pip/wheels/dd/a2/57/c21f424f03d7303589a136906dd62c5fd655834a8350ec8123
Successfully built templateflow
Installing collected packages: numpy, six, patsy, sqlalchemy, pyparsing, packaging, nibabel, click, python-dateutil, pytz, pandas, bids-validator, scipy, docopt, num2words, pybids, tqdm, idna, urllib3, charset-normalizer, certifi, requests, templateflow
Successfully installed bids-validator-1.8.2 certifi-2021.5.30 charset-normalizer-2.0.5 click-8.0.1 docopt-0.6.2 idna-3.2 nibabel-3.2.1 num2words-0.5.10 numpy-1.21.2 packaging-21.0 pandas-1.3.3 patsy-0.5.1 pybids-0.13.2 pyparsing-2.4.7 python-dateutil-2.8.2 pytz-2021.1 requests-2.26.0 scipy-1.7.1 six-1.16.0 sqlalchemy-1.3.24 templateflow-0.7.1 tqdm-4.62.2 urllib3-1.26.6
WARNING: You are using pip version 20.1.1; however, version 21.2.4 is available.
You should consider upgrading via the '/home/oesteban/templateflow-env/bin/python -m pip install --upgrade pip' command.
(templateflow-env) (base) oesteban@hos65851:~/Downloads/templateflow-0.7.1$ pip list
Package            Version
------------------ ---------
bids-validator     1.8.2
certifi            2021.5.30
charset-normalizer 2.0.5
click              8.0.1
docopt             0.6.2
idna               3.2
nibabel            3.2.1
num2words          0.5.10
numpy              1.21.2
packaging          21.0
pandas             1.3.3
patsy              0.5.1
pip                20.1.1
pybids             0.13.2
pyparsing          2.4.7
python-dateutil    2.8.2
pytz               2021.1
requests           2.26.0
scipy              1.7.1
setuptools         47.1.0
six                1.16.0
SQLAlchemy         1.3.24
templateflow       0.7.1
tqdm               4.62.2
urllib3            1.26.6
WARNING: You are using pip version 20.1.1; however, version 21.2.4 is available.
You should consider upgrading via the '/home/oesteban/templateflow-env/bin/python -m pip install --upgrade pip' command.
Flamefire commented 2 years ago

Interesting... Maybe something in setuptools 47.x changed so that option is automatically used or really no longer required?

Is there a downside to adding this to make it work in more environments, e.g. setuptools 46.x?

Edit: No, it isn't setuptools 47.x. Installed that first and still the same. No idea then besides that the proposed patch fixes this.