Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support integration testing of packages with no requirements.txt but with extras_require #186

Open
pinkwah opened this issue Jan 28, 2021 · 0 comments

Comments

@pinkwah
Copy link
Contributor

pinkwah commented Jan 28, 2021

Currently, when testing a single package, we clone the package's code, then do pip install . --no-deps so as to not update its dependencies and to have a proper integration test. For additional packages, we have a requirements.txt file, that we pip install -r requirements.txt. This is an unavoidable evil as whatever packages we install for testing may depend on others and so we can't use --no-deps there.

The Python community prefers to use the extras_require field in setup.py to specify test/dev/doc dependencies that won't be installed during normal use. I'd love for us to drop requirements.txt and instead use extras_require. However, doing pip install .[test] --no-deps will only install . since the [test] part specifies the dependencies and we've explciitly said not to.

I propose to add the following functionailty to komodoenv':
Add a new executable module komodoenv.install_extras that will install only the dependencies specified in extras_require:

# 1. Install ERT but with no dependencies
pip install ./ert --no-deps  
# 2. Install ert's "test" extras_require, without touching its other dependencies
python -m komodoenv.install_extras ert test  

While pip doesn't have a way to figure out which packages are extras and which are not, nor can we install only the extra dependencies, we can make do ourselves by parsing the METADATA file required by Python package manager standard: https://packaging.python.org/specifications/core-metadata/#provides-extra-multiple-use

We can find the METADATA file in the current install, much the same way komodoenv does currently in order to figure out which version of komodoenv is installed in a komodo release. Then we parse it. Should be quite feasable as the file format is quite simple.

Usage: komodoenv.install_extras [Installed package] [Extras groups...]

@eivindjahren eivindjahren added the christmas-review Issues and PRs for Christmas review label Dec 13, 2024
@jonathan-eq jonathan-eq removed the christmas-review Issues and PRs for Christmas review label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants