cadet / CADET-Match

CADET Parameter estimation engine
9 stars 1 forks source link

Split dependencies into `requirements.txt` and `requirements-dev.txt` #23

Open michaelosthege opened 2 years ago

michaelosthege commented 2 years ago

I'm not familiar with this project, but @schmoelder asked me to help with setting up CI and this is something that you could prepare in advance to make a CI action easier to set up:

It will be good to have dependencies as requirements.txt files, so they can be installed in the CI action. The requirements-dev.txt should include any dependencies needed for development, but not for using the package. Typically these are things like pytest. For documentation I like the structure with a docs-specific requirements-dev.txt that is installed as part of the readthedocs workflow.

The following line helps to avoid duplicating this information in setup.py: https://github.com/JuBiotech/calibr8/blob/master/setup.py#L72

schmoelder commented 2 years ago

Currently there are no tests at all for this package. While this is something that we are aware of, right now all we want is a check whether it installs correctly. I don't think we need any additional requirements for this.

michaelosthege commented 2 years ago

An empty requirements file could still guide future contributions into the typical structure. Or you could copy the flake8 step from this commit which should give you a basic safeguard against typos and syntax errors.

At the very least you should add a test_import.py file with a pytest test that asserts successful import of your package. It may sound trivial, but empirically most of my test suites are born from a simple import test.

schmoelder commented 2 years ago

Gotcha. Alternatively, I just read it's also possible to put it in setup.cfg

Example: https://github.com/pyscaffold/pyscaffold/blob/master/setup.cfg#L62 Documentation: https://setuptools.pypa.io/en/latest/userguide/declarative_config.html

michaelosthege commented 2 years ago

Yeah, I fear there are plenty more ways how it could be done. In my experience the requirements.txt (or environment.yml if you need dependencies from conda) are most popular. I guess that's because it's handy to do something like pip install -r requirements.txt when the deps are in a separate file.

For other configs (pytest, coverage, pylint, black, flake8, mypy) there are .pyproject.toml (e.g. in PyMC) or MANIFEST.in (e.g. in Aesara) and setup.cfg probably falls into the same category.