From 87efdd5e141389c91bd2532066f87065a45b6b67 Mon Sep 17 00:00:00 2001 From: Carl Westman <54413402+Wesztman@users.noreply.github.com> Date: Fri, 8 Mar 2024 00:48:59 -0800 Subject: [PATCH] Remove tox, using pdm scripts instead (#2) --- .devcontainer/devcontainer.json | 5 +- ...x-and-publish.yml => test-and-publish.yml} | 16 +-- .pre-commit-config.yaml | 11 -- .vscode/tasks.json | 25 ++++ README.md | 18 ++- pdm.lock | 123 +++--------------- pyproject.toml | 66 +++++++--- src/get_py_deps/main.py | 2 +- tox.ini | 37 ------ 9 files changed, 110 insertions(+), 193 deletions(-) rename .github/workflows/{tox-and-publish.yml => test-and-publish.yml} (84%) create mode 100644 .vscode/tasks.json delete mode 100644 tox.ini diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8223e88..215f0c1 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -8,10 +8,7 @@ "version": "20.11.1" } }, - "postCreateCommand": "pdm sync -G dev && pdm run pre-commit install", - "containerEnv": { - "PDM_PYTHON": "${workspaceFolder}/.venv/bin/python" - }, + "postCreateCommand": "pdm run pre-commit install --install-hooks && echo '\nšŸ“¢šŸ“¢ Call `pdm run all` to run all checks and tests, or use the provided test task from the VSCode command palette šŸ“¢šŸ“¢'", "customizations": { "vscode": { "extensions": [ diff --git a/.github/workflows/tox-and-publish.yml b/.github/workflows/test-and-publish.yml similarity index 84% rename from .github/workflows/tox-and-publish.yml rename to .github/workflows/test-and-publish.yml index ab2739f..bd7c56c 100644 --- a/.github/workflows/tox-and-publish.yml +++ b/.github/workflows/test-and-publish.yml @@ -1,4 +1,4 @@ -name: Tox and publish release +name: Test and publish release on: push: @@ -21,7 +21,6 @@ jobs: - "3.12" - "3.11" - "3.10" - - "3.9" os: - ubuntu-latest - macos-latest @@ -30,17 +29,14 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Setup python for test ${{ matrix.py }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.py }} - name: Setup PDM uses: pdm-project/setup-pdm@v4 - - name: Install tox + with: + python-version: ${{ matrix.py }} + cache: true + - name: Run pdm script run: | - pip install tox tox-pdm - - name: Run tox - run: tox + pdm run all deploy: runs-on: ubuntu-latest diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3b44896..92c1792 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,12 +16,6 @@ repos: args: [--fix] # Run the formatter. - id: ruff-format - - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.5.1 - hooks: - - id: mypy - exclude: ^tests/ - additional_dependencies: [types-setuptools>=69.1.0.20240229] - repo: https://github.com/Yelp/detect-secrets rev: "v1.4.0" hooks: @@ -30,8 +24,3 @@ repos: rev: 2.12.4 hooks: - id: pdm-lock-check - - repo: https://github.com/RobertCraigie/pyright-python - rev: v1.1.352 - hooks: - - id: pyright - additional_dependencies: [prettytable>=3.10.0] diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..0abcaee --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,25 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Run tests", + "type": "shell", + "command": "pdm run all", + "problemMatcher": [], + "group": { + "kind": "test", + "isDefault": true + } + }, + { + "label": "Build package", + "type": "shell", + "command": "pdm build", + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} diff --git a/README.md b/README.md index 538bbde..85a2e23 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # get-py-deps -[![Tox and publish release](https://github.com/Wesztman/get-py-deps/actions/workflows/tox-and-publish.yml/badge.svg)](https://github.com/Wesztman/get-py-deps/actions/workflows/tox-and-publish.yml) +[![Test and publish release](https://github.com/Wesztman/get-py-deps/actions/workflows/test-and-publish.yml/badge.svg)](https://github.com/Wesztman/get-py-deps/actions/workflows/test-and-publish.yml) [![PyPI Version](https://img.shields.io/pypi/v/get-py-deps.svg)](https://pypi.python.org/pypi/get-py-deps) -![Python Versions](https://img.shields.io/badge/Python-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue +![Python Versions](https://img.shields.io/badge/Python-3.10%20%7C%203.11%20%7C%203.12-blue ) ![Tested on OS](https://img.shields.io/badge/OS-win%20%7C%20linux%20%7C%20mac-orange) [![License](https://img.shields.io/static/v1?label=license&message=MIT&color=success)](./LICENSE) @@ -56,12 +56,18 @@ Development is easiest done using the provided dev container. This will ensure t The dev container will install all development dependencies and set up the pre-commit hooks used in this project. -To ensure dependency consistency and easy testing, this project uses [PDM](https://pdm-project.org/latest/) and [tox](https://tox.readthedocs.io/en/latest/). +To ensure dependency consistency and easy testing, this project uses [PDM](https://pdm-project.org/latest/). -To run all tests and checks, simply run tox from the command line. +To run all tests and checks, simply run the supplied pdm script from the command line. ```bash -$ tox +$ pdm run all +``` + +For a full list of available commands, run: + +```bash +$ pdm run -l ``` ### Pre-requisites @@ -74,7 +80,7 @@ $ tox The GitHub Action workflow is set up to run the tests and checks on every push, pr and release. -It runs the tox workflow for all supported Python versions on windows, mac and linux. +It runs the `pdm run all` scrips for all supported Python versions on windows, mac and linux. When creating a release from a tag (x.y.z), the workflow will also build and push the Python package to PyPi. diff --git a/pdm.lock b/pdm.lock index 2d040ee..b447a7f 100644 --- a/pdm.lock +++ b/pdm.lock @@ -5,18 +5,7 @@ groups = ["default", "dev", "lint", "test"] strategy = ["cross_platform", "inherit_metadata"] lock_version = "4.4.1" -content_hash = "sha256:7087008940d57f4ed3e0b806646fa9852015ed9759e2f3dbfcf5dd5c42521427" - -[[package]] -name = "cachetools" -version = "5.3.3" -requires_python = ">=3.7" -summary = "Extensible memoizing collections and decorators" -groups = ["dev"] -files = [ - {file = "cachetools-5.3.3-py3-none-any.whl", hash = "sha256:0abad1021d3f8325b2fc1d2e9c8b9c9d57b04c3932657a72465447332c24d945"}, - {file = "cachetools-5.3.3.tar.gz", hash = "sha256:ba29e2dfa0b8b556606f097407ed1aa62080ee108ab0dc5ec9d6a723a007d105"}, -] +content_hash = "sha256:96bf52fd8c40e1cfcccb552bdc9a2b7d47fc9e529a58f0a54a401dfabbc1015f" [[package]] name = "cfgv" @@ -29,23 +18,13 @@ files = [ {file = "cfgv-3.4.0.tar.gz", hash = "sha256:e52591d4c5f5dead8e0f673fb16db7949d2cfb3f7da4582893288f0ded8fe560"}, ] -[[package]] -name = "chardet" -version = "5.2.0" -requires_python = ">=3.7" -summary = "Universal encoding detector for Python 3" -groups = ["dev"] -files = [ - {file = "chardet-5.2.0-py3-none-any.whl", hash = "sha256:e1cf59446890a00105fe7b7912492ea04b6e6f06d4b742b2c788469e34c82970"}, - {file = "chardet-5.2.0.tar.gz", hash = "sha256:1b3b6ff479a8c414bc3fa2c0852995695c4a026dcd6d0633b2dd092ca39c1cf7"}, -] - [[package]] name = "colorama" version = "0.4.6" requires_python = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" summary = "Cross-platform colored terminal text." groups = ["dev", "test"] +marker = "sys_platform == \"win32\"" files = [ {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, @@ -88,16 +67,6 @@ files = [ {file = "coverage-7.4.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:c0a120238dd71c68484f02562f6d446d736adcc6ca0993712289b102705a9a3a"}, {file = "coverage-7.4.3-cp312-cp312-win32.whl", hash = "sha256:37389611ba54fd6d278fde86eb2c013c8e50232e38f5c68235d09d0a3f8aa352"}, {file = "coverage-7.4.3-cp312-cp312-win_amd64.whl", hash = "sha256:d25b937a5d9ffa857d41be042b4238dd61db888533b53bc76dc082cb5a15e914"}, - {file = "coverage-7.4.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3b253094dbe1b431d3a4ac2f053b6d7ede2664ac559705a704f621742e034f1f"}, - {file = "coverage-7.4.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:77fbfc5720cceac9c200054b9fab50cb2a7d79660609200ab83f5db96162d20c"}, - {file = "coverage-7.4.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6679060424faa9c11808598504c3ab472de4531c571ab2befa32f4971835788e"}, - {file = "coverage-7.4.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4af154d617c875b52651dd8dd17a31270c495082f3d55f6128e7629658d63765"}, - {file = "coverage-7.4.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8640f1fde5e1b8e3439fe482cdc2b0bb6c329f4bb161927c28d2e8879c6029ee"}, - {file = "coverage-7.4.3-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:69b9f6f66c0af29642e73a520b6fed25ff9fd69a25975ebe6acb297234eda501"}, - {file = "coverage-7.4.3-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:0842571634f39016a6c03e9d4aba502be652a6e4455fadb73cd3a3a49173e38f"}, - {file = "coverage-7.4.3-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:a78ed23b08e8ab524551f52953a8a05d61c3a760781762aac49f8de6eede8c45"}, - {file = "coverage-7.4.3-cp39-cp39-win32.whl", hash = "sha256:c0524de3ff096e15fcbfe8f056fdb4ea0bf497d584454f344d59fce069d3e6e9"}, - {file = "coverage-7.4.3-cp39-cp39-win_amd64.whl", hash = "sha256:0209a6369ccce576b43bb227dc8322d8ef9e323d089c6f3f26a597b09cb4d2aa"}, {file = "coverage-7.4.3-pp38.pp39.pp310-none-any.whl", hash = "sha256:7cbde573904625509a3f37b6fecea974e363460b556a627c60dc2f47e2fffa51"}, {file = "coverage-7.4.3.tar.gz", hash = "sha256:276f6077a5c61447a48d133ed13e759c09e62aff0dc84274a68dc18660104d52"}, ] @@ -144,16 +113,6 @@ files = [ {file = "coverage-7.4.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:c0a120238dd71c68484f02562f6d446d736adcc6ca0993712289b102705a9a3a"}, {file = "coverage-7.4.3-cp312-cp312-win32.whl", hash = "sha256:37389611ba54fd6d278fde86eb2c013c8e50232e38f5c68235d09d0a3f8aa352"}, {file = "coverage-7.4.3-cp312-cp312-win_amd64.whl", hash = "sha256:d25b937a5d9ffa857d41be042b4238dd61db888533b53bc76dc082cb5a15e914"}, - {file = "coverage-7.4.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3b253094dbe1b431d3a4ac2f053b6d7ede2664ac559705a704f621742e034f1f"}, - {file = "coverage-7.4.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:77fbfc5720cceac9c200054b9fab50cb2a7d79660609200ab83f5db96162d20c"}, - {file = "coverage-7.4.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6679060424faa9c11808598504c3ab472de4531c571ab2befa32f4971835788e"}, - {file = "coverage-7.4.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4af154d617c875b52651dd8dd17a31270c495082f3d55f6128e7629658d63765"}, - {file = "coverage-7.4.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8640f1fde5e1b8e3439fe482cdc2b0bb6c329f4bb161927c28d2e8879c6029ee"}, - {file = "coverage-7.4.3-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:69b9f6f66c0af29642e73a520b6fed25ff9fd69a25975ebe6acb297234eda501"}, - {file = "coverage-7.4.3-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:0842571634f39016a6c03e9d4aba502be652a6e4455fadb73cd3a3a49173e38f"}, - {file = "coverage-7.4.3-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:a78ed23b08e8ab524551f52953a8a05d61c3a760781762aac49f8de6eede8c45"}, - {file = "coverage-7.4.3-cp39-cp39-win32.whl", hash = "sha256:c0524de3ff096e15fcbfe8f056fdb4ea0bf497d584454f344d59fce069d3e6e9"}, - {file = "coverage-7.4.3-cp39-cp39-win_amd64.whl", hash = "sha256:0209a6369ccce576b43bb227dc8322d8ef9e323d089c6f3f26a597b09cb4d2aa"}, {file = "coverage-7.4.3-pp38.pp39.pp310-none-any.whl", hash = "sha256:7cbde573904625509a3f37b6fecea974e363460b556a627c60dc2f47e2fffa51"}, {file = "coverage-7.4.3.tar.gz", hash = "sha256:276f6077a5c61447a48d133ed13e759c09e62aff0dc84274a68dc18660104d52"}, ] @@ -240,11 +199,6 @@ files = [ {file = "mypy-1.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:afe3fe972c645b4632c563d3f3eff1cdca2fa058f730df2b93a35e3b0c538218"}, {file = "mypy-1.8.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:42c6680d256ab35637ef88891c6bd02514ccb7e1122133ac96055ff458f93fc3"}, {file = "mypy-1.8.0-cp312-cp312-win_amd64.whl", hash = "sha256:720a5ca70e136b675af3af63db533c1c8c9181314d207568bbe79051f122669e"}, - {file = "mypy-1.8.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:5c1538c38584029352878a0466f03a8ee7547d7bd9f641f57a0f3017a7c905b8"}, - {file = "mypy-1.8.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4ef4be7baf08a203170f29e89d79064463b7fc7a0908b9d0d5114e8009c3a259"}, - {file = "mypy-1.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7178def594014aa6c35a8ff411cf37d682f428b3b5617ca79029d8ae72f5402b"}, - {file = "mypy-1.8.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:ab3c84fa13c04aeeeabb2a7f67a25ef5d77ac9d6486ff33ded762ef353aa5592"}, - {file = "mypy-1.8.0-cp39-cp39-win_amd64.whl", hash = "sha256:99b00bc72855812a60d253420d8a2eae839b0afa4938f09f4d2aa9bb4654263a"}, {file = "mypy-1.8.0-py3-none-any.whl", hash = "sha256:538fd81bb5e430cc1381a443971c0475582ff9f434c16cd46d2c66763ce85d9d"}, {file = "mypy-1.8.0.tar.gz", hash = "sha256:6ff8b244d7085a0b425b56d327b480c3b29cafbd2eff27316a004f9a7391ae07"}, ] @@ -265,7 +219,7 @@ name = "nodeenv" version = "1.8.0" requires_python = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*" summary = "Node.js virtual environment builder" -groups = ["dev"] +groups = ["dev", "lint"] dependencies = [ "setuptools", ] @@ -340,18 +294,17 @@ files = [ ] [[package]] -name = "pyproject-api" -version = "1.6.1" -requires_python = ">=3.8" -summary = "API to interact with the python pyproject.toml based projects" -groups = ["dev"] +name = "pyright" +version = "1.1.352" +requires_python = ">=3.7" +summary = "Command line wrapper for pyright" +groups = ["dev", "lint"] dependencies = [ - "packaging>=23.1", - "tomli>=2.0.1; python_version < \"3.11\"", + "nodeenv>=1.6.0", ] files = [ - {file = "pyproject_api-1.6.1-py3-none-any.whl", hash = "sha256:4c0116d60476b0786c88692cf4e325a9814965e2469c5998b830bba16b183675"}, - {file = "pyproject_api-1.6.1.tar.gz", hash = "sha256:1817dc018adc0d1ff9ca1ed8c60e1623d5aaca40814b953af14a9cf9a5cae538"}, + {file = "pyright-1.1.352-py3-none-any.whl", hash = "sha256:0040cf173c6a60704e553bfd129dfe54de59cc76d0b2b80f77cfab4f50701d64"}, + {file = "pyright-1.1.352.tar.gz", hash = "sha256:a621c0dfbcf1291b3610641a07380fefaa1d0e182890a1b2a7f13b446e8109a9"}, ] [[package]] @@ -418,14 +371,6 @@ files = [ {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, {file = "PyYAML-6.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:0d3304d8c0adc42be59c5f8a4d9e3d7379e6955ad754aa9d6ab7a398b59dd1df"}, - {file = "PyYAML-6.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9eb6caa9a297fc2c2fb8862bc5370d0303ddba53ba97e71f08023b6cd73d16a8"}, - {file = "PyYAML-6.0.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:c8098ddcc2a85b61647b2590f825f3db38891662cfc2fc776415143f599bb859"}, - {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5773183b6446b2c99bb77e77595dd486303b4faab2b086e7b17bc6bef28865f6"}, - {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b786eecbdf8499b9ca1d697215862083bd6d2a99965554781d0d8d1ad31e13a0"}, - {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc1bf2925a1ecd43da378f4db9e4f799775d6367bdb94671027b73b393a7c42c"}, - {file = "PyYAML-6.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:04ac92ad1925b2cff1db0cfebffb6ffc43457495c9b3c39d3fcae417d7125dc5"}, - {file = "PyYAML-6.0.1-cp39-cp39-win32.whl", hash = "sha256:faca3bdcf85b2fc05d06ff3fbc1f83e1391b3e724afa3feba7d13eeab355484c"}, - {file = "PyYAML-6.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:510c9deebc5c0225e8c96813043e62b680ba2f9c50a08d3724c7f28a747d1486"}, {file = "PyYAML-6.0.1.tar.gz", hash = "sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43"}, ] @@ -460,7 +405,7 @@ name = "setuptools" version = "69.1.1" requires_python = ">=3.8" summary = "Easily download, build, install, upgrade, and uninstall Python packages" -groups = ["default", "dev"] +groups = ["default", "dev", "lint"] files = [ {file = "setuptools-69.1.1-py3-none-any.whl", hash = "sha256:02fa291a0471b3a18b2b2481ed902af520c69e8ae0919c13da936542754b4c56"}, {file = "setuptools-69.1.1.tar.gz", hash = "sha256:5c0806c7d9af348e6dd3777b4f4dbb42c7ad85b190104837488eab9a7c945cf8"}, @@ -478,53 +423,15 @@ files = [ {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] -[[package]] -name = "tox" -version = "4.12.1" -requires_python = ">=3.8" -summary = "tox is a generic virtualenv management and test command line tool" -groups = ["dev"] -dependencies = [ - "cachetools>=5.3.2", - "chardet>=5.2", - "colorama>=0.4.6", - "filelock>=3.13.1", - "packaging>=23.2", - "platformdirs>=4.1", - "pluggy>=1.3", - "pyproject-api>=1.6.1", - "tomli>=2.0.1; python_version < \"3.11\"", - "virtualenv>=20.25", -] -files = [ - {file = "tox-4.12.1-py3-none-any.whl", hash = "sha256:c07ea797880a44f3c4f200ad88ad92b446b83079d4ccef89585df64cc574375c"}, - {file = "tox-4.12.1.tar.gz", hash = "sha256:61aafbeff1bd8a5af84e54ef6e8402f53c6a6066d0782336171ddfbf5362122e"}, -] - -[[package]] -name = "tox-pdm" -version = "0.7.2" -requires_python = ">=3.7" -summary = "A plugin for tox that utilizes PDM as the package manager and installer" -groups = ["dev"] -dependencies = [ - "tomli; python_version < \"3.11\"", - "tox>=4.0", -] -files = [ - {file = "tox_pdm-0.7.2-py3-none-any.whl", hash = "sha256:12f6215416b7acd00a80a9e7128f3dc3e3c89308d60707f5d0a24abdf83ac104"}, - {file = "tox_pdm-0.7.2.tar.gz", hash = "sha256:a841a7e1e942a71805624703b9a6d286663bd6af79bba6130ba756975c315308"}, -] - [[package]] name = "types-setuptools" -version = "69.1.0.20240301" +version = "69.1.0.20240308" requires_python = ">=3.8" summary = "Typing stubs for setuptools" groups = ["dev", "lint"] files = [ - {file = "types-setuptools-69.1.0.20240301.tar.gz", hash = "sha256:f99cf5a7f5c281c55f16ba860da68cb2cd8f3b3a472f78ec8e744240fc3aa09e"}, - {file = "types_setuptools-69.1.0.20240301-py3-none-any.whl", hash = "sha256:2033afa8efe3f566ec18997c4b614664b2ed9653160d941745389ad61a50d1f6"}, + {file = "types-setuptools-69.1.0.20240308.tar.gz", hash = "sha256:ad4f5e51251eedcbe4aa8db0844af6654054aafc9c0f6d3f1fa00f7073c17767"}, + {file = "types_setuptools-69.1.0.20240308-py3-none-any.whl", hash = "sha256:4a1f741df17cd97880320472108236ee76c9fbabf96a768929ee0a4adb8a73c7"}, ] [[package]] diff --git a/pyproject.toml b/pyproject.toml index 75062a5..319eb99 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,20 +9,19 @@ source = "scm" name = "get-py-deps" description = "" readme = "README.md" -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = ["prettytable~=3.10.0", "setuptools~=69.1.1"] dynamic = ["version"] [project.optional-dependencies] -lint = ["ruff~=0.2.1", "mypy~=1.8.0", "types-setuptools>=69.1.0.20240229"] -test = ["pytest~=8.0.0", "pytest-cov~=4.1.0", "coverage[toml]~=7.4.1"] -dev = [ - "tox~=4.12.1", - "tox-pdm~=0.7.2", - "pre-commit~=3.6.1", - "get-py-deps[lint]", - "get-py-deps[test]", +lint = [ + "ruff~=0.2.1", + "mypy~=1.8.0", + "types-setuptools~=69.1.0.20240229", + "pyright~=1.1.352", ] +test = ["pytest~=8.0.0", "pytest-cov~=4.1.0", "coverage[toml]~=7.4.1"] +dev = ["pre-commit~=3.6.1", "get-py-deps[lint]", "get-py-deps[test]"] [tool.pytest.ini_options] log_cli = true @@ -37,13 +36,48 @@ get-py-deps = "get_py_deps.main:_cli" Repository = "https://github.com/Wesztman/get-py-deps" [tool.pdm.scripts] -format = "pdm run ruff format . --check" -lint = "pdm run ruff check . --fix" -typecheck = "mypy ." # Uncomment after fixing type errors -test = "pdm run pytest tests/ -v --cov src/get_py_deps --cov-report term --cov-report html" -pipeline-test = "pdm run pytest tests/ --cov get_py_deps --cov-report xml --cov-report html --junitxml junit/test-results.xml --no-coverage-upload" -all = { composite = ["format", "lint", "test", "typecheck"] } - +# Misc +_add-title.shell = "echo '\\e[35m##################################### {args} #####################################\\e[0m'" +_print-python-version.shell = "python --version" +_print-success.shell = "echo '\n\\e[32m{args}\\e[0m'" +# Runs before each pdm run command +pre_run = { composite = [ + "_add-title 'Checking dependencies'", + "pdm sync -G dev", + "_print-python-version", +], help = "Check and install dependencies, run automatically before each `pdm run`" } +# Test +test = { composite = [ + "_add-title 'Running Pytest'", + "pytest {args:tests/ --cov src/get_py_deps --cov-report term --cov-report html}", +], help = "Run pytest with coverage report" } +# Linting +_precommit = { shell = "pre-commit run --all-files" } # incl. ruff lint, ruff format, and lock file check +_mypy-typecheck = { shell = "mypy ." } +_pyright-typecheck = { shell = "pyright ." } +lint = { composite = [ + "_add-title 'Running linting'", + "_precommit", + "_mypy-typecheck", + "_pyright-typecheck", +], help = "Run linting incl. pre-commit, typechecks, ruff format, lint and lock file check" } +# Build +build = { composite = [ + "_add-title 'Building package'", + "pdm build", +], help = "Build the package in the dist/ directory" } +# Run all checks +all = { composite = [ + "lint", + "test", + "build", + "_print-success 'šŸŽ‰šŸŽ‰ All checks passed šŸŽ‰šŸŽ‰'", +], help = "Run all tests and checks, as well as building the package" } +_pipeline-checks = { composite = [ + "lint", + "test --cov src/get_py_deps --cov-report xml --cov-report html --junitxml junit/test-results.xml --no-coverage-upload", + "build", +] } [tool.ruff] src = ["src"] diff --git a/src/get_py_deps/main.py b/src/get_py_deps/main.py index d20af3f..9456ead 100644 --- a/src/get_py_deps/main.py +++ b/src/get_py_deps/main.py @@ -67,7 +67,7 @@ def _parse_args(args: list[str] | None = None) -> argparse.Namespace: parser.add_argument( "-v", "--verbose", action="store_true", help="Enable verbose output." ) - return parser.parse_args(args) + return parser.parse_args(args=args) # Cli function, use argparse to parse the argument package_name and call get_py_deps diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 486f00f..0000000 --- a/tox.ini +++ /dev/null @@ -1,37 +0,0 @@ -[tox] -min_version = 4.0 -envlist = - pre-commit - test - build - -[testenv] -setenv = - PDM_IGNORE_ACTIVE_VENV = true -package = wheel -wheel_build_env = .pkg -parallel_show_output = true - -[testenv:pre-commit] -description = Run pre-commit checks. -skip_install = true -groups = dev -commands = pre-commit run --all-files - -[testenv:test] -description = Run tests with coverage. -commands = test -groups = test -usedevelop = true - -[testenv:build] -description = Build the package. -skip_install = true -commands = pdm build - -[gh] -python = - 3.12 = py312 - 3.11 = py311, type - 3.10 = py310 - 3.9 = py39