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 deptry to check for issues with the project's dependencies. #679

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/deptry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
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 deptry dependencies
run: |
pip install -e .
pip install deptry
python --version
deptry --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
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"
Loading