Skip to content

Commit 7a66a1c

Browse files
docs: add Deptry ignore for google-cloud-secret-manager and update contributing guide
Co-Authored-By: Aaron <AJ> Steers <aj@airbyte.io>
1 parent 12f674a commit 7a66a1c

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

docs/CONTRIBUTING.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,30 @@ To see all available `ruff` options, run `poetry run ruff`.
4949

5050
The Ruff configuration is stored in `ruff.toml` at the root of the repository. This file contains settings for line length, target Python version, and linting rules.
5151

52+
## Handling Dependency Analysis with Deptry
53+
54+
The CDK uses [Deptry](https://deptry.com/) for dependency analysis to ensure all dependencies are properly declared and used. Sometimes Deptry may not correctly detect certain package usage patterns, especially for packages with complex import structures.
55+
56+
To ignore specific Deptry errors:
57+
58+
1. Identify the rule you need to ignore (DEP001, DEP002, DEP003, or DEP004)
59+
2. Add the package name to the appropriate rule list in the `[tool.deptry.per_rule_ignores]` section of `pyproject.toml`
60+
3. Include an inline comment explaining why the ignore is needed
61+
62+
Example:
63+
```toml
64+
[tool.deptry.per_rule_ignores]
65+
# DEP002: Project should not contain unused dependencies.
66+
DEP002 = [
67+
"google-cloud-secret-manager", # Deptry can't detect that `google.cloud.secretmanager_v1` uses this package
68+
]
69+
```
70+
71+
Common scenarios requiring ignores:
72+
- Packages imported using a different name than their PyPI package name
73+
- Packages that are imported dynamically or through submodules
74+
- Transitive dependencies that are used directly in the code
75+
5276
## Auto-Generating the Declarative Schema File
5377

5478
Low-code CDK models are generated from `sources/declarative/declarative_component_schema.yaml`. If the iteration you are working on includes changes to the models or the connector generator, you may need to regenerate them. In order to do that, you can run:

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ DEP001 = [
229229
# https://deptry.com/rules-violations/#missing-dependencies-dep002
230230
DEP002 = [
231231
"cryptography", # Constrained as transitive dependency due to a bug in newer versions
232+
"google-cloud-secret-manager", # Deptry can't detect that `google.cloud.secretmanager_v1` uses this package
232233

233234
# TODO: Remove these dependencies if not needed:
234235
"avro", # Only imported in `unit_tests` code

0 commit comments

Comments
 (0)