-
Notifications
You must be signed in to change notification settings - Fork 15
Support excluding packages from the build #95
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
Comments
That makes sense. Longer term, we could even do something similar to what For manual exclusions, Due to the import-package-vs-dist-package ambiguity in Python, as well as the import-module-vs-import-package situation, I'm leaning towards making this two separate settings on the layer:
|
|
|
Excluding individual packages is potentially feasible with the current locking design, since that doesn't affect the lock resolution process, it's just intentionally making the shipped archives not quite match the contents claimed in their lock files. There's potential fragility in actually doing that, but I can see the value since some projects are really liberal with what they classify as a "requirement" (if someone is pulling in the full Jupyter notebook runtime as dependency because some of their examples are Jupyter notebooks, that doesn't make sense when people are just trying to use their Python library in an application). Excluding "X and its dependencies, unless something else depends on them", on the other hand, would need to be a resolver level operation, since you need a resolver to answer both "What does X depend on?" and "Does anything other than X depend on those packages?" Even with a resolver, it's still not an easy problem, since the presence or absence of X may make more changes to the dependency graph than just adding or removing packages outright - it may change the exact version pinned, it may make the dependency platform or Python version dependent, and more. There's an open proposal (https://peps.python.org/pep-0771/) that will allow projects to specify default extras, which may help clean up some of these messy dependency trees at their source. |
Python packages can transitively pull in many packages that are not strictly required to run an application. Including these packages in the published layer means that our users have to download large packages they don't necessarily need. Layers should be able to specify in their
venvstacks.toml
configuration what packages should be not installed as part of the build or publish. A package that is marked as excluded would ideally not pull in packages that are only required by the excluded layer.A package that is marked as excluded should not affect the environment solving, but simply affect the output directory. This is so that an application layer doesn't install a package that was excluded by the framework layer; the package belongs to the framework layer, but is not emitted into the build directory anywhere.
The overall goal of this is to reduce the size of layers deployed to our users' machines.
The text was updated successfully, but these errors were encountered: