From 80600d677c7c2a5b3bad3088be6fd7296aaaae42 Mon Sep 17 00:00:00 2001 From: Daniel D'Avella Date: Wed, 15 Nov 2023 12:28:21 -0500 Subject: [PATCH] Move extra dependencies to pyproject.toml --- .github/workflows/codemod_pygoat.yml | 2 +- .github/workflows/integration_test.yml | 2 +- .github/workflows/lint.yml | 4 ++-- .github/workflows/test.yml | 2 +- CONTRIBUTING.md | 2 +- pyproject.toml | 25 +++++++++++++++++++++++++ requirements/complexity.txt | 2 -- requirements/test.txt | 14 -------------- 8 files changed, 31 insertions(+), 22 deletions(-) delete mode 100644 requirements/complexity.txt delete mode 100644 requirements/test.txt diff --git a/.github/workflows/codemod_pygoat.yml b/.github/workflows/codemod_pygoat.yml index a90a02396..b5549c2b5 100644 --- a/.github/workflows/codemod_pygoat.yml +++ b/.github/workflows/codemod_pygoat.yml @@ -30,7 +30,7 @@ jobs: - name: Install Codemodder Package run: pip install . - name: Install Test Dependencies - run: pip install -r requirements/test.txt + run: pip install ".[test]" - name: Check out Pygoat uses: actions/checkout@v4 with: diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index 79a73213d..cf4b29268 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -33,6 +33,6 @@ jobs: - name: Install Codemodder Package run: pip install . - name: Install Dependencies - run: pip install -r requirements/test.txt + run: pip install -r ".[test]" - name: Run integration tests run: make integration-test diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 813c1b5dd..cff02ef7d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -30,7 +30,7 @@ jobs: - name: Install Codemodder Package run: pip install . - name: Install Dependencies - run: pip install -r requirements/test.txt + run: pip install ".[test]" - name: Run pylint run: make lint @@ -47,7 +47,7 @@ jobs: uses: actions/checkout@v4 - name: Install Dependencies run: | - pip install -r requirements/complexity.txt + pip install ".[complexity]" - name: Run Radon run: make radon - name: Run Xenon diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7cc739901..865ee26dd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -50,7 +50,7 @@ jobs: - name: Install Codemodder Package run: pip install . - name: Install Dependencies - run: pip install -r requirements/test.txt + run: pip install ".[test]" - name: Run unit tests run: make test - name: Upload coverage reports to Codecov diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index aa4600a84..1f15e38fe 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,7 +17,7 @@ to specify a specific Python version. If using `bash` or any compatible shell, a 1. `cd codemodder-python` and `pip install -e .` to install the package in development mode -1. Run `pip install -r` on all the files under `requirements/` to install packages used for development and testing +1. Run `pip install ".[all]"` to install packages used for development and testing 1. You should now be able to run `pylint`, `pytest`, etc. diff --git a/pyproject.toml b/pyproject.toml index b60d9a196..75d79f867 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,6 +41,31 @@ Repository = "https://github.com/pixee/codemodder-python" codemodder = "codemodder.codemodder:main" generate-docs = 'codemodder.scripts.generate_docs:main' +[project.optional-dependencies] +test = [ + "coverage==7.3.*", + "Flask<4", + "GitPython<4", + "Jinja2~=3.1.2", + "lxml~=4.9.3", + "mock==5.1.*", + "pre-commit<4", + "Pyjwt~=2.8.0", + "pytest==7.4.*", + "pytest-cov~=4.1.0", + "pytest-mock~=3.12.0", + "pytest-xdist==3.*", + "security~=1.2.0", + "types-mock==5.1.*", +] +complexity = [ + "radon==6.0.*", + "xenon==0.9.*", +] +all = [ + "codemodder[test]", + "codemodder[complexity]", +] [project.entry-points.codemods] core = "core_codemods:registry" diff --git a/requirements/complexity.txt b/requirements/complexity.txt deleted file mode 100644 index b709853cc..000000000 --- a/requirements/complexity.txt +++ /dev/null @@ -1,2 +0,0 @@ -radon==6.0.* -xenon==0.9.* diff --git a/requirements/test.txt b/requirements/test.txt deleted file mode 100644 index be6900b06..000000000 --- a/requirements/test.txt +++ /dev/null @@ -1,14 +0,0 @@ -coverage==7.3.* -Flask<4 -GitPython<4 -Jinja2~=3.1.2 -lxml~=4.9.3 -mock==5.1.* -pre-commit<4 -Pyjwt~=2.8.0 -pytest==7.4.* -pytest-cov~=4.1.0 -pytest-mock~=3.12.0 -pytest-xdist==3.* -security~=1.2.0 -types-mock==5.1.*