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 exclusion of dependencies #1316

Closed
mxab opened this issue Aug 10, 2022 · 2 comments · Fixed by #2551
Closed

Allow exclusion of dependencies #1316

mxab opened this issue Aug 10, 2022 · 2 comments · Fixed by #2551
Assignees
Labels
⭐ enhancement Improvements for existing features

Comments

@mxab
Copy link

mxab commented Aug 10, 2022

Is your feature request related to a problem? Please describe.

We have the problem that some python libraries have a lot of dependencies that are actually optional but not marked as such and come with the regular installation.

For example RASA which is a cool library for intent detection but they simply added all dependencies as main dependencies
https://github.com/RasaHQ/rasa/blob/main/pyproject.toml#L65

This means when I install this I get besides the actual core libraries dependencies to e.g. a telegram client lib or a mongodb library
This does not only increase the size of your final application but also introduces potential security or licenses alerts

Describe the solution you'd like

It would be great if there would be similar to the [tool.pdm.overrides] feature a [tool.pdm.excludes] section where I can exclude certain dependencies
Would be great if this would not only allowing blacklisting that dependency but also then prevents the resolution of the dependency of this depenency if they are not required by other dependencies

e.g.:

[tool.pdm.excludes]
pyTelegramBotAPI=<not sure if a version makes sense here>
@mxab mxab added the ⭐ enhancement Improvements for existing features label Aug 10, 2022
@pawamoy
Copy link
Sponsor Contributor

pawamoy commented Aug 10, 2022

That would be nice indeed. I think Python devs have been wanting a "dependency opt-out" mecanism for a long time.
Ideally libraries like RASA would make use of extras to provide optional libraries. I understand the burden it is to support optional libraries but I also can't stand having to, for example, install click in production because uvicorn requires it. I'd personally make heavy use of such a dependency exclusion feature 👍 Shortening the resolution by ignoring excluded deps would be a plus, though I'd take the feature even without it.

One thing though is that you have to make sure the package you're using does not import all its submodules, otherwise you'll get an import error anyway, so excluding deps would probably not work for many packages.

@T145
Copy link

T145 commented Jan 10, 2024

Bump

Though I'd make the field tool.poetry.dependencies.exclude since include is implicit in the base field.

@frostming frostming self-assigned this Jan 11, 2024
frostming added a commit that referenced this issue Jan 11, 2024
Fixes #1316

Signed-off-by: Frost Ming <me@frostming.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⭐ enhancement Improvements for existing features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants