Skip to content

Commit

Permalink
Add deptry to check for issues with the project's dependencies
Browse files Browse the repository at this point in the history
Co-authored-by: Ben Mares <[email protected]>
  • Loading branch information
fpgmaas and maresb committed Jun 13, 2024
1 parent 0e29d76 commit 2f060b7
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/deptry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: deptry

on:
pull_request:
push:
branches: [main]

jobs:
deptry:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -leo pipefail {0}
steps:
- uses: actions/checkout@v4
- uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: "latest" # any version from https://github.com/mamba-org/micromamba-releases
environment-file: environment.yml
init-shell: bash
cache-environment: true
post-cleanup: "all"
- name: Install pytensor and mypy dependencies
run: |
pip install -e .
python --version
shell: micromamba-shell {0}
- name: Run deptry
run: |
deptry .
shell: micromamba-shell {0}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ core
/htmlcov/

pytensor-venv/
venv
/notebooks/Sandbox*
.vscode/
testing-report.html
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ dependencies:
- pytest-xdist
- pytest-benchmark
- pytest-mock
- deptry
# For building docs
- sphinx>=5.1.0,<6
- sphinx_rtd_theme
Expand Down
64 changes: 64 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,67 @@ test-skip = ["cp37*", "*musllinux*", "*win32*", "*i686*"]
# Testing seems to be running into issues locating libs where expected
# test-requires = ["pytest", "numba", "jax", "jaxlib"]
# test-command = "pytest {package}/tests"

[tool.deptry]
pep621_dev_dependency_groups = ["development", "tests", "rtd"]
extend_exclude = ["doc", "conftest.py", "versioneer.py", "scripts"]

[tool.deptry.per_rule_ignores]
# DEP001: Python modules that are imported within a project, for which no
# corresponding packages are found in the dependencies.
DEP001=[
# Available debuggers are automatically detected, and the first available
# is used in the following order: `pudb`, `ipdb`, or `pdb` (stdlib).
"pudb",
"ipdb",

# The `mkl` library is used for BLAS when available.
"mkl",

# 'cutils_ext' and 'lazylinker_ext' are dynamically generated code by the C backend.
"cutils_ext",
"lazylinker_ext",

# 'numpyro' is an optional backend.
"numpyro",

# 'llvmlite' is only required for the 'numba' backend.
"llvmlite",

# 'tensorflow_probability' provides JAX implementations for some ops.
"tensorflow_probability",

# The 'distutils' import is slated for removal in
# <https://github.com/pymc-devs/pytensor/pull/812>
"distutils",
]

# DEP002: Dependencies that are required in a project, but are not used within the
# codebase.
DEP002=[
# 'jaxlib' is required in the 'jax' group.
# jaxlib is the support library for JAX. While JAX itself is a pure Python package,
# jaxlib contains the binary (C/C++) parts of the library, including Python
# bindings, the XLA compiler, the PJRT runtime, and a handful of handwritten
# kernels.
"jaxlib",
]

# DEP004: Dependencies specified as development ones that should be included as
# regular dependencies.
DEP004=[
# 'pydot' is a Python interface to Graphviz's Dot language, used by d3viz.
# See <https://github.com/pymc-devs/pytensor/issues/333>.
"pydot",

# pydot-ng is slated for removal in <https://github.com/pymc-devs/pytensor/pull/341>
"pydot_ng",
]

[tool.deptry.package_module_name_map]
pydot2 = "pydot2"
pydot-ng = "pydot_ng"
jax = "jax"
jaxlib = "jaxlib"
numba = "numba"
llvmlite = "llvmlite"

0 comments on commit 2f060b7

Please sign in to comment.