From 78b2e0582ada45815279faeb410d2ff5a7b54e2d 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 -------------- tests/README.md | 7 ------- 9 files changed, 31 insertions(+), 29 deletions(-) delete mode 100644 requirements/complexity.txt delete mode 100644 requirements/test.txt delete mode 100644 tests/README.md diff --git a/.github/workflows/codemod_pygoat.yml b/.github/workflows/codemod_pygoat.yml index a90a0239..b5549c2b 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 79a73213..924d965d 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 ".[test]" - name: Run integration tests run: make integration-test diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 813c1b5d..cff02ef7 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 7cc73990..865ee26d 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 aa4600a8..1f15e38f 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 b60d9a19..75d79f86 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 b709853c..00000000 --- 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 be6900b0..00000000 --- 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.* diff --git a/tests/README.md b/tests/README.md deleted file mode 100644 index 7a8c33e4..00000000 --- a/tests/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Running tests - -```bash -pip install -r requirements.txt -pytest -pytest -v # -s, --pdb, etc -```