diff --git a/.github/workflows/lint_and_test.yml b/.github/workflows/lint_and_test.yml new file mode 100644 index 00000000..7568f52d --- /dev/null +++ b/.github/workflows/lint_and_test.yml @@ -0,0 +1,84 @@ +name: Run tests + +on: + push: + branches: + - "3.x/*" + pull_request: + branches: + - "3.x/*" + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + linting: + name: Run linters + runs-on: ubuntu-latest + timeout-minutes: 3 + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: "3.11" + + - name: Install Just + uses: extractions/setup-just@v1 + with: + just-version: 1.14.0 + + - name: Setup environment to run tox + run: + just setup-runner + + - name: Run linters + run: + just lint + + testing: + name: Run tests + runs-on: ${{ matrix.os }} + needs: linting + + strategy: + fail-fast: true + matrix: + python_version: + - { setup: '3.8', tox: 'py38' } + - { setup: '3.9', tox: 'py39' } + - { setup: '3.10', tox: 'py310' } + - { setup: '3.11', tox: 'py311' } + - { setup: 'pypy3.8', tox: 'pypy38' } + - { setup: 'pypy3.9', tox: 'pypy39' } + - { setup: 'pypy3.10', tox: 'pypy310' } + + os: [ ubuntu-latest ] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python_version.setup }} + + - name: Install Just + uses: extractions/setup-just@v1 + with: + just-version: 1.14.0 + + - name: Setup environment to run tox + run: + just setup-runner + + - name: Run tests + run: + just test-on-python-version ${{ matrix.python_version.tox }} diff --git a/.github/workflows/setup.yml b/.github/workflows/setup.yml deleted file mode 100644 index 5db81659..00000000 --- a/.github/workflows/setup.yml +++ /dev/null @@ -1,79 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a single version of Python -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: CI - -on: - push: - branches: [develop] - pull_request: - branches: [develop] - -jobs: - cpython: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: - - ubuntu-latest - - macos-latest - - windows-latest - python-version: - - "3.7" - - "3.8" - - "3.9" - - "3.10" - - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - - - name: Run tests - run: | - python -m nose2 -B -C tests - - - name: Run flake8 - run: | - python -m flake8 --exit-zero - - - name: Run vulture - run: | - python -m vulture dataclass_factory --min-confidence 70 - - - name: Run Mypy - run: | - python -m mypy --pretty dataclass_factory tests - - pypy: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: - - ubuntu-latest - - macos-latest - - windows-latest - pypy-version: ['pypy3'] - - steps: - - uses: actions/checkout@v2 - - name: Install Pypy - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.pypy-version }} - - - name: Install dependencies - run: | - pip install -r requirements_pypy.txt - - - name: Run tests - run: | - nose2 -B -C tests - diff --git a/Makefile b/Makefile deleted file mode 100644 index d1ec8271..00000000 --- a/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -.PHONY: lint -lint: - @tox -e lint - - -.PHONY: test-all -test-all: - @tox -e $$(tox list --no-desc | grep '^py' | tr '\n' ',') - - -.PHONY: test-all-p -test-all-p: - @tox -e $$(tox list --no-desc | grep '^py' | sort -r | tr '\n' ',') -p auto - - -.PHONY: test -test: - @tox -e $$(tox list --no-desc | grep '^py' | grep 'new$$' | tr '\n' ',') - - -.PHONY: cov -cov: - @inv cov - - -.PHONY: setup -setup: - pip install -r requirements/pre.txt - pip install -e . - pip install -r requirements/dev.txt - pre-commit - pre-commit install - - -.PHONY: deps-compile -deps-compile: - @inv deps-compile - - -.PHONY: venv-sync -venv-sync: - @pip-sync requirements/pre.txt requirements/dev.txt - @pip install -e . - - -SPHINXOPTS ?= -SPHINXBUILD ?= sphinx-build -SOURCEDIR = docs -BUILDDIR = docs-build - -.PHONY: doc -doc: - @$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) - @echo "Open file://`pwd`/$(BUILDDIR)/html/index.html" - -.PHONY: doc-clean -doc-clean: - @$(SPHINXBUILD) -M clean "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) - -.PHONY: doc-open -doc-open: - @nohup python -m webbrowser -t "file://$(CURDIR)/docs-build/html/index.html" > /dev/null diff --git a/justfile b/justfile new file mode 100644 index 00000000..56f18f73 --- /dev/null +++ b/justfile @@ -0,0 +1,52 @@ +[private] +@default: + just --list + +@bootstrap: + pip install -r requirements/pre.txt + pip install -e . + pip install -r requirements/dev.txt + pre-commit + pre-commit install + +@venv-sync: + pip-sync requirements/pre.txt requirements/dev.txt + pip install -e . + +@setup-runner: + pip install -r requirements/pre.txt + pip install -r requirements/runner.txt + +@lint: + tox -e lint + +@test: + tox -e $(tox list --no-desc | grep '^py' | grep 'new$' | tr '\n' ',') + +@test-all: + tox -e $(tox list --no-desc | grep '^py' | sort -r | tr '\n' ',') + +@test-all-p: + tox -e $(tox list --no-desc | grep '^py' | sort -r | tr '\n' ',') -p auto + +@test-on-python-version target: + tox -e $(tox list --no-desc | grep '^{{ target }}' | sort -r | tr '\n' ',') + +@cov: + inv cov + +@deps-compile: + inv deps-compile + +doc_source := "docs" +doc_target := "docs-build" + +@doc: + sphinx-build -M html {{ doc_source }} {{ doc_target }} + echo "Open file://`pwd`/{{ doc_target }}/html/index.html" + +@doc-clean: + sphinx-build -M clean {{ doc_source }} {{ doc_target }} + +@doc-open: + nohup python -m webbrowser -t "file://`pwd`/docs-build/html/index.html" > /dev/null diff --git a/requirements/bench.txt b/requirements/bench.txt index 859d4551..e03bd600 100644 --- a/requirements/bench.txt +++ b/requirements/bench.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # pip-compile --allow-unsafe --output-file=requirements/bench.txt --strip-extras requirements/raw/bench.txt diff --git a/requirements/dev.txt b/requirements/dev.txt index 2f45edd7..df321da3 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # pip-compile --allow-unsafe --output-file=requirements/dev.txt --strip-extras requirements/raw/dev.txt @@ -13,7 +13,9 @@ alabaster==0.7.13 annotated-types==0.6.0 # via pydantic astpath==0.9.0 - # via -r requirements/raw/lint.txt + # via + # -r requirements/raw/lint.txt + # astpath astroid==3.0.1 # via pylint attrs==23.1.0 @@ -33,7 +35,9 @@ cachetools==5.3.2 # via tox cattrs==23.1.2 # via -r requirements/raw/bench.txt -certifi==2023.7.22 +cerberus==1.3.5 + # via plette +certifi==2023.11.17 # via requests cfgv==3.4.0 # via pre-commit @@ -62,9 +66,13 @@ dill==0.3.7 dirty-equals==0.6.0 # via -r requirements/raw/test_extra_none.txt distlib==0.3.7 - # via virtualenv + # via + # requirementslib + # virtualenv dlint==0.14.1 # via -r requirements/raw/lint.txt +docopt==0.6.2 + # via pipreqs docutils==0.19 # via # docutils-stubs @@ -103,7 +111,7 @@ flake8-noqa==1.3.2 # via -r requirements/raw/lint.txt flake8-polyfill==1.0.2 # via -r requirements/raw/lint.txt -fonttools==4.44.0 +fonttools==4.46.0 # via matplotlib furo==2023.5.20 # via -r requirements/raw/doc.txt @@ -117,17 +125,17 @@ greenlet==3.0.0rc3 # via # -r requirements/raw/test_extra_none.txt # sqlalchemy -identify==2.5.31 +identify==2.5.33 # via pre-commit -idna==3.4 +idna==3.6 # via requests imagesize==1.4.1 # via sphinx iniconfig==2.0.0 # via pytest invoke==2.2.0 - # via -r requirements/raw/dev.txt -isort==5.12.0 + # via -r requirements/raw/runner.txt +isort==5.13.0 # via pylint jinja2==3.1.2 # via @@ -172,7 +180,7 @@ myst-parser==1.0.0 # via -r requirements/raw/doc.txt nodeenv==1.8.0 # via pre-commit -numpy==1.26.1 +numpy==1.26.2 # via # contourpy # matplotlib @@ -190,17 +198,26 @@ pbr==6.0.0 # via # sphinxcontrib-apidoc # stevedore +pep517==0.13.1 + # via requirementslib phonenumberslite==8.13.24 # via -r requirements/raw/test_extra_none.txt pillow==10.1.0 # via matplotlib +pip-api==0.0.30 + # via isort pip-tools==7.3.0 # via -r requirements/raw/dev.txt -platformdirs==3.11.0 +pipreqs==0.4.13 + # via isort +platformdirs==4.1.0 # via # pylint + # requirementslib # tox # virtualenv +plette==0.4.4 + # via requirementslib plotly==5.15.0 # via # -r requirements/raw/_bench-orchestrate.txt @@ -220,12 +237,14 @@ pycodestyle==2.11.1 # flake8 # flake8-debugger pydantic==2.4.2 - # via -r requirements/raw/bench.txt + # via + # -r requirements/raw/bench.txt + # requirementslib pydantic-core==2.10.1 # via pydantic pyflakes==3.1.0 # via flake8 -pygments==2.16.1 +pygments==2.17.2 # via # furo # rich @@ -256,8 +275,13 @@ pyyaml==6.0.1 radon==6.0.1 # via -r requirements/raw/lint.txt requests==2.31.0 - # via sphinx -rich==13.6.0 + # via + # requirementslib + # sphinx + # yarg +requirementslib==3.0.0 + # via isort +rich==13.7.0 # via bandit schematics==2.1.1 # via -r requirements/raw/bench.txt @@ -318,10 +342,13 @@ tenacity==8.2.3 # via plotly toml==0.10.2 # via vulture -tomlkit==0.12.2 - # via pylint +tomlkit==0.12.3 + # via + # plette + # pylint + # requirementslib tox==4.11.3 - # via -r requirements/raw/dev.txt + # via -r requirements/raw/runner.txt typing-extensions==4.8.0 # via # -r requirements/raw/test_extra_none.txt @@ -331,9 +358,9 @@ typing-extensions==4.8.0 # pydantic # pydantic-core # sqlalchemy -urllib3==2.0.7 +urllib3==2.1.0 # via requests -virtualenv==20.24.6 +virtualenv==20.25.0 # via # pre-commit # tox @@ -343,16 +370,22 @@ wheel==0.41.3 # via # -r requirements/raw/pre.txt # pip-tools +yarg==0.1.9 + # via pipreqs # The following packages are considered to be unsafe in a requirements file: pip==23.3.1 # via # -r requirements/raw/pre.txt + # pip-api # pip-tools + # requirementslib setuptools==68.2.2 # via # -r requirements/raw/dev.txt + # babel # cognitive-complexity # flake8-cognitive-complexity # nodeenv # pip-tools + # requirementslib diff --git a/requirements/doc.txt b/requirements/doc.txt index 7c60b59b..5fc1560a 100644 --- a/requirements/doc.txt +++ b/requirements/doc.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # pip-compile --allow-unsafe --output-file=requirements/doc.txt --strip-extras requirements/raw/doc.txt @@ -18,7 +18,7 @@ beautifulsoup4==4.12.2 # via furo cattrs==23.1.2 # via -r requirements/raw/bench.txt -certifi==2023.7.22 +certifi==2023.11.17 # via requests charset-normalizer==3.3.2 # via requests @@ -35,7 +35,7 @@ docutils==0.19 # sphinx docutils-stubs==0.0.22 # via -r requirements/raw/doc.txt -fonttools==4.44.0 +fonttools==4.46.0 # via matplotlib furo==2023.5.20 # via -r requirements/raw/doc.txt @@ -43,7 +43,7 @@ gitdb==4.0.11 # via gitpython gitpython==3.1.32 # via -r requirements/raw/doc.txt -idna==3.4 +idna==3.6 # via requests imagesize==1.4.1 # via sphinx @@ -65,7 +65,7 @@ marshmallow==3.20.1 # via -r requirements/raw/bench.txt mashumaro==3.10 # via -r requirements/raw/bench.txt -matplotlib==3.8.1 +matplotlib==3.8.2 # via sphinxext-opengraph mdit-py-plugins==0.3.5 # via myst-parser @@ -75,7 +75,7 @@ msgspec==0.18.4 ; implementation_name != "pypy" # via -r requirements/raw/bench.txt myst-parser==1.0.0 # via -r requirements/raw/doc.txt -numpy==1.26.1 +numpy==1.26.2 # via # contourpy # matplotlib @@ -102,7 +102,7 @@ pydantic==2.4.2 # via -r requirements/raw/bench.txt pydantic-core==2.10.1 # via pydantic -pygments==2.16.1 +pygments==2.17.2 # via # furo # sphinx @@ -174,5 +174,9 @@ typing-extensions==4.8.0 # mashumaro # pydantic # pydantic-core -urllib3==2.0.7 +urllib3==2.1.0 # via requests + +# The following packages are considered to be unsafe in a requirements file: +setuptools==69.0.2 + # via babel diff --git a/requirements/lint.txt b/requirements/lint.txt index faeedf02..e7cad8eb 100644 --- a/requirements/lint.txt +++ b/requirements/lint.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # pip-compile --allow-unsafe --output-file=requirements/lint.txt --strip-extras requirements/raw/lint.txt @@ -13,7 +13,9 @@ alabaster==0.7.13 annotated-types==0.6.0 # via pydantic astpath==0.9.0 - # via -r requirements/raw/lint.txt + # via + # -r requirements/raw/lint.txt + # astpath astroid==3.0.1 # via pylint attrs==23.1.0 @@ -29,7 +31,9 @@ beautifulsoup4==4.12.2 # via furo cattrs==23.1.2 # via -r requirements/raw/bench.txt -certifi==2023.7.22 +cerberus==1.3.5 + # via plette +certifi==2023.11.17 # via requests cfgv==3.4.0 # via pre-commit @@ -50,9 +54,13 @@ dill==0.3.7 dirty-equals==0.6.0 # via -r requirements/raw/test_extra_none.txt distlib==0.3.7 - # via virtualenv + # via + # requirementslib + # virtualenv dlint==0.14.1 # via -r requirements/raw/lint.txt +docopt==0.6.2 + # via pipreqs docutils==0.19 # via # docutils-stubs @@ -89,7 +97,7 @@ flake8-noqa==1.3.2 # via -r requirements/raw/lint.txt flake8-polyfill==1.0.2 # via -r requirements/raw/lint.txt -fonttools==4.44.0 +fonttools==4.46.0 # via matplotlib furo==2023.5.20 # via -r requirements/raw/doc.txt @@ -103,15 +111,15 @@ greenlet==3.0.0rc3 # via # -r requirements/raw/test_extra_none.txt # sqlalchemy -identify==2.5.31 +identify==2.5.33 # via pre-commit -idna==3.4 +idna==3.6 # via requests imagesize==1.4.1 # via sphinx iniconfig==2.0.0 # via pytest -isort==5.12.0 +isort==5.13.0 # via pylint jinja2==3.1.2 # via @@ -156,7 +164,7 @@ myst-parser==1.0.0 # via -r requirements/raw/doc.txt nodeenv==1.8.0 # via pre-commit -numpy==1.26.1 +numpy==1.26.2 # via # contourpy # matplotlib @@ -171,14 +179,23 @@ pbr==6.0.0 # via # sphinxcontrib-apidoc # stevedore +pep517==0.13.1 + # via requirementslib phonenumberslite==8.13.24 # via -r requirements/raw/test_extra_none.txt pillow==10.1.0 # via matplotlib -platformdirs==3.11.0 +pip-api==0.0.30 + # via isort +pipreqs==0.4.13 + # via isort +platformdirs==4.1.0 # via # pylint + # requirementslib # virtualenv +plette==0.4.4 + # via requirementslib plotly==5.15.0 # via # -r requirements/raw/_bench-orchestrate.txt @@ -196,12 +213,14 @@ pycodestyle==2.11.1 # flake8 # flake8-debugger pydantic==2.4.2 - # via -r requirements/raw/bench.txt + # via + # -r requirements/raw/bench.txt + # requirementslib pydantic-core==2.10.1 # via pydantic pyflakes==3.1.0 # via flake8 -pygments==2.16.1 +pygments==2.17.2 # via # furo # rich @@ -228,8 +247,13 @@ pyyaml==6.0.1 radon==6.0.1 # via -r requirements/raw/lint.txt requests==2.31.0 - # via sphinx -rich==13.6.0 + # via + # requirementslib + # sphinx + # yarg +requirementslib==3.0.0 + # via isort +rich==13.7.0 # via bandit schematics==2.1.1 # via -r requirements/raw/bench.txt @@ -290,8 +314,11 @@ tenacity==8.2.3 # via plotly toml==0.10.2 # via vulture -tomlkit==0.12.2 - # via pylint +tomlkit==0.12.3 + # via + # plette + # pylint + # requirementslib typing-extensions==4.8.0 # via # -r requirements/raw/test_extra_none.txt @@ -301,16 +328,24 @@ typing-extensions==4.8.0 # pydantic # pydantic-core # sqlalchemy -urllib3==2.0.7 +urllib3==2.1.0 # via requests -virtualenv==20.24.6 +virtualenv==20.25.0 # via pre-commit vulture==2.10 # via -r requirements/raw/lint.txt +yarg==0.1.9 + # via pipreqs # The following packages are considered to be unsafe in a requirements file: -setuptools==68.2.2 +pip==23.3.1 + # via + # pip-api + # requirementslib +setuptools==69.0.2 # via + # babel # cognitive-complexity # flake8-cognitive-complexity # nodeenv + # requirementslib diff --git a/requirements/pre.txt b/requirements/pre.txt index b8656d1a..96037e0e 100644 --- a/requirements/pre.txt +++ b/requirements/pre.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # pip-compile --allow-unsafe --output-file=requirements/pre.txt --strip-extras requirements/raw/pre.txt diff --git a/requirements/raw/dev.txt b/requirements/raw/dev.txt index 4105e758..9b56c6a0 100644 --- a/requirements/raw/dev.txt +++ b/requirements/raw/dev.txt @@ -1,9 +1,8 @@ -tox==4.11.3 coverage==7.3.2 pip-tools==7.3.0 setuptools==68.2.2 -invoke==2.2.0 +-r runner.txt -r lint.txt -r _bench-orchestrate.txt -r pre.txt diff --git a/requirements/raw/runner.txt b/requirements/raw/runner.txt new file mode 100644 index 00000000..65aa9f91 --- /dev/null +++ b/requirements/raw/runner.txt @@ -0,0 +1,2 @@ +tox==4.11.3 +invoke==2.2.0 diff --git a/requirements/runner.txt b/requirements/runner.txt new file mode 100644 index 00000000..56b07024 --- /dev/null +++ b/requirements/runner.txt @@ -0,0 +1,36 @@ +# +# This file is autogenerated by pip-compile with Python 3.12 +# by the following command: +# +# pip-compile --allow-unsafe --output-file=requirements/runner.txt --strip-extras requirements/raw/runner.txt +# +cachetools==5.3.2 + # via tox +chardet==5.2.0 + # via tox +colorama==0.4.6 + # via tox +distlib==0.3.7 + # via virtualenv +filelock==3.13.1 + # via + # tox + # virtualenv +invoke==2.2.0 + # via -r requirements/raw/runner.txt +packaging==23.2 + # via + # pyproject-api + # tox +platformdirs==4.1.0 + # via + # tox + # virtualenv +pluggy==1.3.0 + # via tox +pyproject-api==1.6.1 + # via tox +tox==4.11.3 + # via -r requirements/raw/runner.txt +virtualenv==20.25.0 + # via tox diff --git a/requirements/test_extra_new.txt b/requirements/test_extra_new.txt index 288f49e8..12bec9cc 100644 --- a/requirements/test_extra_new.txt +++ b/requirements/test_extra_new.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # pip-compile --allow-unsafe --output-file=requirements/test_extra_new.txt --strip-extras requirements/raw/test_extra_new.txt diff --git a/requirements/test_extra_none.txt b/requirements/test_extra_none.txt index 75414a60..1d1bdceb 100644 --- a/requirements/test_extra_none.txt +++ b/requirements/test_extra_none.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # pip-compile --allow-unsafe --output-file=requirements/test_extra_none.txt --strip-extras requirements/raw/test_extra_none.txt diff --git a/requirements/test_extra_old.txt b/requirements/test_extra_old.txt index d13e3018..85a9a374 100644 --- a/requirements/test_extra_old.txt +++ b/requirements/test_extra_old.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # pip-compile --allow-unsafe --output-file=requirements/test_extra_old.txt --strip-extras requirements/raw/test_extra_old.txt