diff --git a/.github/workflows/deptry.yml b/.github/workflows/deptry.yml new file mode 100644 index 0000000000..8af0fdffa2 --- /dev/null +++ b/.github/workflows/deptry.yml @@ -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} diff --git a/.gitignore b/.gitignore index dfe862b868..9fe1b54a8b 100644 --- a/.gitignore +++ b/.gitignore @@ -51,6 +51,7 @@ core /htmlcov/ pytensor-venv/ +venv /notebooks/Sandbox* .vscode/ testing-report.html diff --git a/pyproject.toml b/pyproject.toml index 31f0e1bb24..9a785a8aa3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 + # + "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 . + "pydot", + + # pydot-ng is slated for removal in + "pydot_ng", +] + +[tool.deptry.package_module_name_map] +pydot2 = "pydot2" +pydot-ng = "pydot_ng" +jax = "jax" +jaxlib = "jaxlib" +numba = "numba" +llvmlite = "llvmlite"