You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from typing import Any
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
from hatchling.plugin import hookimpl
import logging
logging.basicConfig(level=logging.INFO)
class CustomBuildHook(BuildHookInterface):
def dependencies(self, version: str, build_data: dict[str, Any]) -> None:
# List of dependencies to remove (stub out or ignore)
ignored_dependencies = [
'sub-spam-dont-use',
]
# Get the current list of dependencies from the build data
print(build_data)
print(build_data)
print(build_data)
print(build_data)
current_dependencies = build_data.get("dependencies", [])
logging.info(f"Current dependencies: {current_dependencies}")
# Filter out dependencies that should be ignored
modified_dependencies = [
dep for dep in current_dependencies if dep.name not in ignored_dependencies
]
# Update the build data with the modified dependencies
build_data["dependencies"] = modified_dependencies
return build_data
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Is there a way to explicitly exclude transitive sub dependencies?
Say for example I have in my
dependencies
:super-spam
And
super-spam
has a dependency:sub-spam-dont-use
main-spam
If I do
pip install -e .
via thepyproject.toml
in my own project, is there a way to exclude installingsub-spam-dont-use
?I've tried:
sub-spam-dont-use != *
The hack that I have been using is:
pip install . && pip uninstall sub-spam-dont-use
But it seems off since its not part of pyproject.toml.
Reference attempt:
Beta Was this translation helpful? Give feedback.
All reactions