Amber-MD / pytraj

Python interface of cpptraj
https://amber-md.github.io/pytraj
170 stars 38 forks source link

Record install requirements #1522

Closed ecederstrand closed 4 years ago

ecederstrand commented 4 years ago

What are the 3rd party package requirements of this package? in setup.py, there is no install_requires entry, but I see 3rd party packages referenced in code.

If all 3rd-party packages are optional, and it's undesirable to require then all in the default install, then it's possible to add an extras_require entry listing one or more install profiles and their requirements allowing to e.g. pip install pytraj[mpi] or pip install pytraj[all]. Here's an example:

https://github.com/ecederstrand/exchangelib/blob/310c93c43e171e70dae8d332eb346bb0ad33ecc4/setup.py#L44

hainm commented 4 years ago

Hi, the only thing pytraj needs is numpy and I assume user has it (who is using python without numpy?). So I don’t list it there. :d

hainm commented 4 years ago

Hi, the only thing pytraj needs is numpy and I assume user has it (who is using python without numpy?). So I don’t list it there. :d

hainm commented 4 years ago

Thanks for your suggestions.

ecederstrand commented 4 years ago

I think of documenting requirements as a service to my end users and contributors. Your end users may be students or scientists trying out Python for the first time, contributors like me trying to fix infrastructure issues, it could be a script written by a sysadmin to automate creation of Python development environments, or it could be automated CI pipelines installing this package indirectly.

It's really nice with any Python package to be able to create a new virtualenv, install the package and have it just work immediately:

python3 -m venv my_env
source my_env/bin/activate
python3 -m pip install pytraj
python3
>>> import pytraj
>>>

Also, as a very peripheral contributor like me, it's really nice to be able to run the test suite without knowing beforehand what else to install. The tests_require entry can contain the test dependencies so they are also installed automatically when running tests:

git clone https://github.com/Amber-MD/pytraj
cd pytraj
python3 -m venv my_env
source my_env/bin/activate
# Run the test suite
python3 setup.py test 
# or some other standard or easy, documented way of running the test suite

Dependencies external to Python, like gfortran, cpptraj, amber, etc. would still need to be installed separately, of course.

ecederstrand commented 4 years ago

As for test requirements, I see at least tqdm, traitlets, IPython, mpi4py, pytest, cclib, pysander, ipywidgets, nglview, and ipykernel needed to run the full test suite.

There's a weird check here which I think is redundant: https://github.com/Amber-MD/pytraj/blob/b59963af9b12ba8aca472b7a482342e587097bfb/tests/test_io/test_io.py#L18

In addition to numpy, libmagic seems to be needed for https://github.com/Amber-MD/pytraj/blob/master/pytraj/externals/magic.py

Finally, Cython should be mentioned in setup_requires as it's needed when building the package.

hainm commented 4 years ago

Also, as a very peripheral contributor like me, it's really nice to be able to run the test suite without knowing beforehand what else to install. The tests_require entry can contain the test dependencies so they are also installed automatically when running tests:

thanks. Points taken. By the way, there was the time (few years ago) that there were still packages that could not installed via pip (but conda).