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

Add depends_on_external, cannot_depend_on_external to control external dependencies #683

Merged
merged 5 commits into from
Mar 12, 2025

Conversation

emdoyle
Copy link
Member

@emdoyle emdoyle commented Mar 12, 2025

Fixes: #535
Relevant to use case mentioned in: #679

This PR introduces depends_on_external and cannot_depend_on_external to module configuration. These function identically to depends_on and cannot_depend_on, but for external dependencies.

By default, no module-level checks are performed for external dependencies - instead the package-level dependencies are checked (e.g. in pyproject.toml, requirements.txt)

By adding one of these new dependency fields to a module, this will opt-in to additional controls on the external dependencies that can be used within that module.

Example:

[[modules]]
path = "tach.console"
depends_on_external = ["rich"]

The configuration above means that check-external will validate that tach.console ONLY depends on rich, and no other external packages.

Alternately:

[[modules]]
path = "tach.filesystem.**"
cannot_depend_on = ["rich"]

This configuration means that any module matching tach.filesystem.** cannot depend on rich. Other external dependencies are allowed.

NOTE: This PR does not add automatic detection of these dependencies to tach sync -- this will be done in a future PR.

@emdoyle emdoyle merged commit f8ca878 into main Mar 12, 2025
8 of 11 checks passed
@emdoyle emdoyle deleted the control-external-dependencies branch March 12, 2025 04:52
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

Successfully merging this pull request may close these issues.

Enable to explicitly disallow import of certain external dependencies
1 participant