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

Allow providing some python modules as system packages #321

Open
eudoxos opened this issue Jan 14, 2021 · 1 comment
Open

Allow providing some python modules as system packages #321

eudoxos opened this issue Jan 14, 2021 · 1 comment

Comments

@eudoxos
Copy link

eudoxos commented Jan 14, 2021

I am packaging a small project which creates several MB worth of .deb because twisted and others are pulled in as dependencies.

I added "big" packages to debian/control as Depends (python3-numpy, python3-pandas, python3-twisted) and removed them from requirements.txt but still, one required module pulls in twisted anyway.

If added --use-system-packages to DH_VENV_ARGS (so that system-installed modules are found on the target machine) and --extra-pip-args --ignore-installed so that modules installed on the builder are included. The --ignore-installed, however, ignores not only pip-installed packaged but also system-installed Debian packages — so they get installed by pip anyway.

As I gathered from numerous discussions, there is no pip option to ignore a dependency (such as --extra-pip-args "--exclude=twisted") but perhaps dh-virtualenv could take an option to pip uninstall a list of modules after they were installed in the virtual environment?

I tried to work it around by adding this to override_dh_virtualenv, after the venv has been installed:

    export VIRTUAL_ENV=debian/ahmt-webdtj/opt/venvs/ahmt-webdtj; \
    export PATH=$$VIRTUAL_ENV/bin:$$PATH; \
    pip install pip-autoremove; \
    pip-autoremove -y twisted

but it does not run in the venv (even though the correct pip executable is invoked) for some reason.

@jhermann
Copy link
Contributor

Start by calling the venv interpreter with a full path and -m pip -- direct pip calls in automation are always prone to lookup errors.

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

2 participants