From 6e3b0bc91e36a757a853ec529972180ef2608d76 Mon Sep 17 00:00:00 2001 From: "Edgar R. M" Date: Thu, 30 Jun 2022 23:24:12 -0500 Subject: [PATCH] ci: Replace tox with nox (#780) * ci: Replace tox with nox * Use color in all jobs * environments -> sessions * Move tool config out of tox.ini --- .flake8 | 16 ++++ .github/workflows/constraints.txt | 2 + .github/workflows/test.yml | 69 ++++++++++------ docs/CONTRIBUTING.md | 27 +++---- noxfile.py | 128 ++++++++++++++++++++++++++++++ poetry.lock | 111 +++++--------------------- pyproject.toml | 21 ++++- tox.ini | 34 -------- 8 files changed, 242 insertions(+), 166 deletions(-) create mode 100644 .flake8 create mode 100644 noxfile.py diff --git a/.flake8 b/.flake8 new file mode 100644 index 000000000..ed8440b87 --- /dev/null +++ b/.flake8 @@ -0,0 +1,16 @@ +[flake8] +ignore = W503, C901, ANN101 +max-line-length = 88 +exclude = cookiecutter +per-file-ignores = + # Don't require docstrings or type annotations in tests + # tests/*:D100,D102,D103,DAR,ANN + # Don't require docstrings conventions or type annotations in SDK samples + # samples/*:ANN,DAR + # Don't require docstrings conventions or type annotations in private modules + singer_sdk/helpers/_*.py:ANN,DAR,D105 + # Don't require docstrings conventions in "meta" code + # singer_sdk/helpers/_classproperty.py:D105 +max-complexity = 10 +docstring-convention = google +allow-star-arg-any = true diff --git a/.github/workflows/constraints.txt b/.github/workflows/constraints.txt index 16d1c013e..407d9fafc 100644 --- a/.github/workflows/constraints.txt +++ b/.github/workflows/constraints.txt @@ -2,3 +2,5 @@ pip==22.1.2 poetry==1.1.13 virtualenv==20.15.1 changelog-cli==0.7.1 +nox==2022.1.7 +nox-poetry==1.0.1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b2ab35cb9..cbf78a875 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,20 +8,25 @@ on: workflow_dispatch: inputs: {} +env: + FORCE_COLOR: "1" + jobs: tests: - name: Test on ${{ matrix.python-version }} (${{ matrix.tox-env }}) / ${{ matrix.os }} + name: Test on ${{ matrix.python-version }} (${{ matrix.session }}) / ${{ matrix.os }} runs-on: ${{ matrix.os }} + env: + NOXSESSION: ${{ matrix.session }} strategy: fail-fast: false matrix: include: - - { tox-env: py, python-version: "3.7", os: "ubuntu-latest" } - - { tox-env: py, python-version: "3.8", os: "ubuntu-latest" } - - { tox-env: py, python-version: "3.9", os: "ubuntu-latest" } - - { tox-env: py, python-version: "3.10", os: "ubuntu-latest" } - - { tox-env: doctest, python-version: "3.10", os: "ubuntu-latest" } - - { tox-env: mypy, python-version: "3.8", os: "ubuntu-latest" } + - { session: tests, python-version: "3.7", os: "ubuntu-latest" } + - { session: tests, python-version: "3.8", os: "ubuntu-latest" } + - { session: tests, python-version: "3.9", os: "ubuntu-latest" } + - { session: tests, python-version: "3.10", os: "ubuntu-latest" } + - { session: doctest, python-version: "3.10", os: "ubuntu-latest" } + - { session: mypy, python-version: "3.8", os: "ubuntu-latest" } steps: - name: Check out the repository @@ -39,7 +44,8 @@ jobs: with: python-version: ${{ matrix.python-version }} architecture: x64 - cache: 'poetry' + cache: 'pip' + cache-dependency-path: 'poetry.lock' - name: Upgrade pip env: @@ -48,17 +54,20 @@ jobs: pip install pip pip --version - - name: Install Dependencies + - name: Install Nox + env: + PIP_CONSTRAINT: .github/workflows/constraints.txt run: | - poetry env use "${{ matrix.python-version }}" - poetry install + pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox + pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry + nox --version - - name: Run tox + - name: Run Nox run: | - poetry run tox -e ${{ matrix.tox-env }} --${{ matrix.doctest && ' --doctest-modules singer_sdk' }} + nox --python=${{ matrix.python-version }} - name: Upload coverage data - if: always() && (matrix.tox-env == 'py') + if: always() && (matrix.session == 'tests') uses: actions/upload-artifact@v3.1.0 with: name: coverage-data @@ -93,7 +102,8 @@ jobs: with: python-version: '3.10' architecture: x64 - cache: 'poetry' + cache: 'pip' + cache-dependency-path: 'poetry.lock' - name: Upgrade pip env: @@ -102,14 +112,17 @@ jobs: pip install pip pip --version - - name: Install Dependencies + - name: Install Nox + env: + PIP_CONSTRAINT: .github/workflows/constraints.txt run: | - poetry env use "3.10" - poetry install + pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox + pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry + nox --version - - name: Run tox + - name: Run Nox run: | - poetry run tox -e py -- -m "external" + nox -s tests -p 3.10 -- -m "external" coverage: name: Coverage @@ -128,7 +141,8 @@ jobs: uses: actions/setup-python@v4.0.0 with: python-version: '3.10' - cache: 'poetry' + cache: 'pip' + cache-dependency-path: 'poetry.lock' - name: Upgrade pip run: | @@ -140,18 +154,21 @@ jobs: with: name: coverage-data - - name: Install Dependencies + - name: Install Nox + env: + PIP_CONSTRAINT: .github/workflows/constraints.txt run: | - poetry env use "3.10" - poetry install + pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox + pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry + nox --version - name: Combine coverage data and display human readable report run: | - poetry run tox -e combine_coverage + nox --session=coverage - name: Create coverage report run: | - poetry run tox -e coverage_artifact -- xml + nox --session=coverage -- xml - name: Upload coverage report uses: codecov/codecov-action@v3.1.0 diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index b0bc5589e..b310e3005 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -15,7 +15,7 @@ Contributors are expected to follow our [Code of Conduct](https://docs.meltano.c ## Setting up Prereqs Make sure [`poetry`](https://python-poetry.org/docs/), -[`pre-commit`](https://pre-commit.com/) and [`tox`](https://tox.wiki/en/latest/) +[`pre-commit`](https://pre-commit.com/) and [`nox`](https://nox.thea.codes/en/stable/) are installed. You can use [`pipx`](https://pypa.github.io/pipx/) to install all of them. To install `pipx`: @@ -29,7 +29,8 @@ With `pipx` installed, you globally add the required tools: ```bash pipx install poetry pipx install pre-commit -pipx install tox +pipx install nox +pipx install nox-poetry ``` Now you can use Poetry to install package dependencies: @@ -55,18 +56,18 @@ First clone, then... - `poetry install -E docs` 1. The project has `pre-commit` hooks. Install them with: - `pre-commit install` -1. Most development tasks you might need should be covered by `tox` environments. You can use `tox -l` to list all available tasks. +1. Most development tasks you might need should be covered by `nox` sessions. You can use `nox -l` to list all available tasks. For example: - - Run unit tests: `tox -e py`. + - Run unit tests: `nox -r`. We use `coverage` for code coverage metrics. - - Run pre-commit hooks: `tox -e pre-commit`. + - Run pre-commit hooks: `pre-commit run --all`. We use `black`, `flake8`, `isort`, `mypy` and `pyupgrade`. The project-wide max line length is `88`. - - Build documentation: `tox -e docs` + - Build documentation: `nox -rs docs` We use `sphinx` to build documentation. @@ -84,22 +85,16 @@ To run tests: ```bash # Run just the core and cookiecutter tests (no external creds required): -tox -e py +nox -rs tests # Run all tests (external creds required): -tox -e py -- -m "external" -``` - -To gather and display coverage metrics: - -```bash -tox -e combine_coverage +nox -rs tests -- -m "external" ``` To view the code coverage report in HTML format: ```bash -tox -e coverage_artifact -- html && open ./htmlcov/index.html +nox -rs coverage -- html && open ./htmlcov/index.html ``` ## Testing Updates to Docs @@ -113,7 +108,7 @@ To build the docs: ```bash # Build docs -tox -e docs +nox -rs docs # Open in the local browser: open build/index.html diff --git a/noxfile.py b/noxfile.py new file mode 100644 index 000000000..07f6e2b52 --- /dev/null +++ b/noxfile.py @@ -0,0 +1,128 @@ +"""Nox configuration.""" + +from __future__ import annotations + +import os +import shutil +import sys +from pathlib import Path +from textwrap import dedent + +import nox + +try: + from nox_poetry import Session, session +except ImportError: + message = f"""\ + Nox failed to import the 'nox-poetry' package. + Please install it using the following command: + {sys.executable} -m pip install nox-poetry""" + raise SystemExit(dedent(message)) from None + +package = "singer_sdk" +python_versions = ["3.10", "3.9", "3.8", "3.7"] +main_python_version = "3.10" +locations = "singer_sdk", "tests", "noxfile.py", "docs/conf.py" +nox.options.sessions = ( + "mypy", + "tests", + "doctest", +) + + +@session(python=python_versions) +def mypy(session: Session) -> None: + """Check types with mypy.""" + args = session.posargs or ["singer_sdk"] + session.install(".") + session.install( + "mypy", + "sqlalchemy2-stubs", + "types-python-dateutil", + "types-requests", + ) + session.run("mypy", *args) + if not session.posargs: + session.run("mypy", f"--python-executable={sys.executable}", "noxfile.py") + + +@session(python=python_versions) +def tests(session: Session) -> None: + """Execute pytest tests and compute coverage.""" + session.install(".") + session.install( + "coverage[toml]", + "pytest", + "freezegun", + "pandas", + "pyarrow", + "requests-mock", + # Cookiecutter tests + "black", + "cookiecutter", + "PyYAML", + "darglint", + "flake8", + "flake8-annotations", + "flake8-docstrings", + "mypy", + ) + + try: + session.run( + "coverage", + "run", + "--parallel", + "-m", + "pytest", + "-x", + "-v", + *session.posargs, + ) + finally: + if session.interactive: + session.notify("coverage", posargs=[]) + + +@session(python=python_versions) +def doctest(session: Session) -> None: + """Run examples with xdoctest.""" + if session.posargs: + args = [package, *session.posargs] + else: + args = [package] + if "FORCE_COLOR" in os.environ: + args.append("--xdoctest-colored=1") + + session.install(".") + session.install("pytest", "xdoctest[colors]") + session.run("pytest", "--xdoctest", *args) + + +@session(python=main_python_version) +def coverage(session: Session) -> None: + """Generate coverage report.""" + args = session.posargs or ["report"] + + session.install("coverage[toml]") + + if not session.posargs and any(Path().glob(".coverage.*")): + session.run("coverage", "combine") + + session.run("coverage", *args) + + +@session(name="docs", python=main_python_version) +def docs(session: Session) -> None: + """Build the documentation.""" + args = session.posargs or ["docs", "build", "-W"] + if not session.posargs and "FORCE_COLOR" in os.environ: + args.insert(0, "--color") + + session.install(".[docs]") + + build_dir = Path("build") + if build_dir.exists(): + shutil.rmtree(build_dir) + + session.run("sphinx-build", *args) diff --git a/poetry.lock b/poetry.lock index 056da3790..8a6a42ccd 100644 --- a/poetry.lock +++ b/poetry.lock @@ -225,14 +225,6 @@ category = "main" optional = false python-versions = ">=3.5" -[[package]] -name = "distlib" -version = "0.3.4" -description = "Distribution utilities" -category = "dev" -optional = false -python-versions = "*" - [[package]] name = "docutils" version = "0.16" @@ -241,18 +233,6 @@ category = "main" optional = true python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" -[[package]] -name = "filelock" -version = "3.4.1" -description = "A platform independent file lock." -category = "dev" -optional = false -python-versions = ">=3.6" - -[package.extras] -docs = ["furo (>=2021.8.17b43)", "sphinx (>=4.1)", "sphinx-autodoc-typehints (>=1.12)"] -testing = ["covdefaults (>=1.2.0)", "coverage (>=4)", "pytest (>=4)", "pytest-cov", "pytest-timeout (>=1.4.2)"] - [[package]] name = "flake8" version = "3.9.2" @@ -1083,14 +1063,6 @@ category = "dev" optional = false python-versions = "*" -[[package]] -name = "toml" -version = "0.10.2" -description = "Python Library for Tom's Obvious, Minimal Language" -category = "dev" -optional = false -python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" - [[package]] name = "tomli" version = "1.2.3" @@ -1099,29 +1071,6 @@ category = "dev" optional = false python-versions = ">=3.6" -[[package]] -name = "tox" -version = "3.25.1" -description = "tox is a generic virtualenv management and test command line tool" -category = "dev" -optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" - -[package.dependencies] -colorama = {version = ">=0.4.1", markers = "platform_system == \"Windows\""} -filelock = ">=3.0.0" -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} -packaging = ">=14" -pluggy = ">=0.12.0" -py = ">=1.4.17" -six = ">=1.14.0" -toml = ">=0.9.4" -virtualenv = ">=16.0.0,<20.0.0 || >20.0.0,<20.0.1 || >20.0.1,<20.0.2 || >20.0.2,<20.0.3 || >20.0.3,<20.0.4 || >20.0.4,<20.0.5 || >20.0.5,<20.0.6 || >20.0.6,<20.0.7 || >20.0.7" - -[package.extras] -docs = ["pygments-github-lexers (>=0.0.5)", "sphinx (>=2.0.0)", "sphinxcontrib-autoprogram (>=0.1.5)", "towncrier (>=18.5.0)"] -testing = ["flaky (>=3.4.0)", "freezegun (>=0.3.11)", "pytest (>=4.0.0)", "pytest-cov (>=2.5.1)", "pytest-mock (>=1.10.0)", "pytest-randomly (>=1.0.0)", "psutil (>=5.6.1)", "pathlib2 (>=2.3.3)"] - [[package]] name = "typed-ast" version = "1.4.3" @@ -1179,37 +1128,36 @@ secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "cer socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] [[package]] -name = "virtualenv" -version = "20.13.0" -description = "Virtual Python Environment builder" +name = "viztracer" +version = "0.15.3" +description = "A debugging and profiling tool that can trace and visualize python code execution" category = "dev" optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" +python-versions = ">=3.6" [package.dependencies] -distlib = ">=0.3.1,<1" -filelock = ">=3.2,<4" -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} -platformdirs = ">=2,<3" -six = ">=1.9.0,<2" +objprint = ">=0.1.3" [package.extras] -docs = ["proselint (>=0.10.2)", "sphinx (>=3)", "sphinx-argparse (>=0.2.5)", "sphinx-rtd-theme (>=0.4.3)", "towncrier (>=21.3)"] -testing = ["coverage (>=4)", "coverage-enable-subprocess (>=1)", "flaky (>=3)", "pytest (>=4)", "pytest-env (>=0.6.2)", "pytest-freezegun (>=0.4.1)", "pytest-mock (>=2)", "pytest-randomly (>=1)", "pytest-timeout (>=1)", "packaging (>=20.0)"] +full = ["rich", "orjson"] [[package]] -name = "viztracer" -version = "0.15.3" -description = "A debugging and profiling tool that can trace and visualize python code execution" +name = "xdoctest" +version = "1.0.0" +description = "A rewrite of the builtin doctest module" category = "dev" optional = false -python-versions = ">=3.6" +python-versions = "*" [package.dependencies] -objprint = ">=0.1.3" +six = "*" [package.extras] -full = ["rich", "orjson"] +all = ["ipython", "ipython", "pygments", "pygments", "attrs", "cmake", "codecov", "colorama", "debugpy", "ipykernel", "ipykernel", "jedi", "jinja2", "jupyter-client", "jupyter-client", "jupyter-core", "nbconvert", "ninja", "pybind11", "pytest-cov", "pytest-cov", "pytest-cov", "pytest-cov", "pytest", "pytest", "pytest", "pytest", "pytest", "pytest", "scikit-build", "six", "typing"] +jupyter = ["ipython", "ipython", "attrs", "debugpy", "ipykernel", "ipykernel", "jedi", "jinja2", "jupyter-client", "jupyter-client", "jupyter-core", "nbconvert"] +optional = ["ipython", "ipython", "pygments", "pygments", "attrs", "colorama", "debugpy", "ipykernel", "ipykernel", "jedi", "jinja2", "jupyter-client", "jupyter-client", "jupyter-core", "nbconvert"] +colors = ["pygments", "pygments", "colorama"] +tests = ["cmake", "codecov", "ninja", "pybind11", "pytest-cov", "pytest-cov", "pytest-cov", "pytest-cov", "pytest", "pytest", "pytest", "pytest", "pytest", "pytest", "scikit-build", "typing"] [[package]] name = "zipp" @@ -1229,7 +1177,7 @@ docs = ["sphinx", "sphinx-rtd-theme", "sphinx-copybutton", "myst-parser"] [metadata] lock-version = "1.1" python-versions = "<3.11,>=3.7.1" -content-hash = "147d7faee6e61be7bd0bbcd905d44bad509b7ed2f3b7917d965141d1f87fd559" +content-hash = "324f962f66d674b1fa00bf8ab64be671585e3ac6741352649228826b0ec1e2e9" [metadata.files] alabaster = [ @@ -1439,18 +1387,10 @@ decorator = [ {file = "decorator-5.1.1-py3-none-any.whl", hash = "sha256:b8c3f85900b9dc423225913c5aace94729fe1fa9763b38939a95226f02d37186"}, {file = "decorator-5.1.1.tar.gz", hash = "sha256:637996211036b6385ef91435e4fae22989472f9d571faba8927ba8253acbc330"}, ] -distlib = [ - {file = "distlib-0.3.4-py2.py3-none-any.whl", hash = "sha256:6564fe0a8f51e734df6333d08b8b94d4ea8ee6b99b5ed50613f731fd4089f34b"}, - {file = "distlib-0.3.4.zip", hash = "sha256:e4b58818180336dc9c529bfb9a0b58728ffc09ad92027a3f30b7cd91e3458579"}, -] docutils = [ {file = "docutils-0.16-py2.py3-none-any.whl", hash = "sha256:0c5b78adfbf7762415433f5515cd5c9e762339e23369dbe8000d84a4bf4ab3af"}, {file = "docutils-0.16.tar.gz", hash = "sha256:c2de3a60e9e7d07be26b7f2b00ca0309c207e06c100f9cc2a94931fc75a478fc"}, ] -filelock = [ - {file = "filelock-3.4.1-py3-none-any.whl", hash = "sha256:a4bc51381e01502a30e9f06dd4fa19a1712eab852b6fb0f84fd7cce0793d8ca3"}, - {file = "filelock-3.4.1.tar.gz", hash = "sha256:0f12f552b42b5bf60dba233710bf71337d35494fc8bdd4fd6d9f6d082ad45e06"}, -] flake8 = [ {file = "flake8-3.9.2-py2.py3-none-any.whl", hash = "sha256:bf8fd333346d844f616e8d47905ef3a3384edae6b4e9beb0c5101e25e3110907"}, {file = "flake8-3.9.2.tar.gz", hash = "sha256:07528381786f2a6237b061f6e96610a4167b226cb926e2aa2b6b1d78057c576b"}, @@ -2038,18 +1978,10 @@ text-unidecode = [ {file = "text-unidecode-1.3.tar.gz", hash = "sha256:bad6603bb14d279193107714b288be206cac565dfa49aa5b105294dd5c4aab93"}, {file = "text_unidecode-1.3-py2.py3-none-any.whl", hash = "sha256:1311f10e8b895935241623731c2ba64f4c455287888b18189350b67134a822e8"}, ] -toml = [ - {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, - {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, -] tomli = [ {file = "tomli-1.2.3-py3-none-any.whl", hash = "sha256:e3069e4be3ead9668e21cb9b074cd948f7b3113fd9c8bba083f48247aab8b11c"}, {file = "tomli-1.2.3.tar.gz", hash = "sha256:05b6166bff487dc068d322585c7ea4ef78deed501cc124060e0f238e89a9231f"}, ] -tox = [ - {file = "tox-3.25.1-py2.py3-none-any.whl", hash = "sha256:c38e15f4733683a9cc0129fba078633e07eb0961f550a010ada879e95fb32632"}, - {file = "tox-3.25.1.tar.gz", hash = "sha256:c138327815f53bc6da4fe56baec5f25f00622ae69ef3fe4e1e385720e22486f9"}, -] typed-ast = [ {file = "typed_ast-1.4.3-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:2068531575a125b87a41802130fa7e29f26c09a2833fea68d9a40cf33902eba6"}, {file = "typed_ast-1.4.3-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:c907f561b1e83e93fad565bac5ba9c22d96a54e7ea0267c708bffe863cbe4075"}, @@ -2102,10 +2034,6 @@ urllib3 = [ {file = "urllib3-1.26.8-py2.py3-none-any.whl", hash = "sha256:000ca7f471a233c2251c6c7023ee85305721bfdf18621ebff4fd17a8653427ed"}, {file = "urllib3-1.26.8.tar.gz", hash = "sha256:0e7c33d9a63e7ddfcb86780aac87befc2fbddf46c58dbb487e0855f7ceec283c"}, ] -virtualenv = [ - {file = "virtualenv-20.13.0-py2.py3-none-any.whl", hash = "sha256:339f16c4a86b44240ba7223d0f93a7887c3ca04b5f9c8129da7958447d079b09"}, - {file = "virtualenv-20.13.0.tar.gz", hash = "sha256:d8458cf8d59d0ea495ad9b34c2599487f8a7772d796f9910858376d1600dd2dd"}, -] viztracer = [ {file = "viztracer-0.15.3-cp310-cp310-macosx_10_15_x86_64.whl", hash = "sha256:1ae9c70ea45f6d56faab89f46e387e31c5e20484b024cbf8cb4542140f131060"}, {file = "viztracer-0.15.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5799fc9c284047030f6de1448ef9681782ffb49f4e54ce3f9d890dd214436991"}, @@ -2144,6 +2072,11 @@ viztracer = [ {file = "viztracer-0.15.3-cp39-cp39-win_amd64.whl", hash = "sha256:4280b59d699ed5aec175eb3c825e494779b6501d59cc6281195efe4ab4bfa812"}, {file = "viztracer-0.15.3.tar.gz", hash = "sha256:f28de150304c300b27b3335993e0bdc47f5a7ba7b6f8c43dc54c4e74efa32cd6"}, ] +xdoctest = [ + {file = "xdoctest-1.0.0-py2-none-any.whl", hash = "sha256:0b0b5958e0ac0a28c5496f96b7f0adbeb0ea7e0c0a227de1ce3bc79ddb1a4f00"}, + {file = "xdoctest-1.0.0-py3-none-any.whl", hash = "sha256:76f44dc74515ff4bdf3cc3e91a2e408cf5699cfa03367634efaadf138c7b132d"}, + {file = "xdoctest-1.0.0.tar.gz", hash = "sha256:7ebba7e71457e6e7cf86c463699575e52b1c9cc32ee2ee5e72256d6cd3aaeb2d"}, +] zipp = [ {file = "zipp-3.6.0-py3-none-any.whl", hash = "sha256:9fe5ea21568a0a70e50f273397638d39b03353731e6cbbb3fd8502a33fec40bc"}, {file = "zipp-3.6.0.tar.gz", hash = "sha256:71c644c5369f4a6e07636f0aa966270449561fcea2e3d6747b8d23efaa9d7832"}, diff --git a/pyproject.toml b/pyproject.toml index 8c8b2eb32..ad3afab95 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,13 +56,13 @@ docs = ["sphinx", "sphinx-rtd-theme", "sphinx-copybutton", "myst-parser"] [tool.poetry.dev-dependencies] # snowflake-connector-python = "2.0.4" # Removed: Too many version conflicts! pytest = "^7.1.2" +xdoctest = "^1.0.0" mypy = "^0.961" cookiecutter = "^2.1.1" PyYAML = "^6.0" pyarrow = "^8.0.0" pandas = ">=1.2.0" numpy = ">=1.20.0" -tox = "^3.25.1" freezegun = "^1.2.1" viztracer = "^0.15.3" requests-mock = "^1.9.3" @@ -104,6 +104,25 @@ version_files = [ "cookiecutter/target-template/{{cookiecutter.target_id}}/pyproject.toml:singer-sdk", ] +[tool.coverage.run] +source = ["singer_sdk"] +omit = [ + "tests/*", + "samples/*", + "singer_sdk/helpers/_compat.py", +] + +[tool.coverage.report] +exclude_lines = [ + "pragma: no cover", + "def __repr__", + "raise AssertionError", + "raise NotImplementedError", + "if __name__ == .__main__.:", + '''class .*\bProtocol\):''', +] +fail_under = 85 + [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" diff --git a/tox.ini b/tox.ini index cf749cfa2..68c5c5bf3 100644 --- a/tox.ini +++ b/tox.ini @@ -66,37 +66,3 @@ commands = [testenv:coverage_artifact] commands = poetry run coverage {posargs:xml} - -[flake8] -ignore = W503, C901, ANN101 -max-line-length = 88 -exclude = cookiecutter -per-file-ignores = - # Don't require docstrings or type annotations in tests - tests/*:D100,D102,D103,DAR,ANN - # Don't require docstrings conventions or type annotations in SDK samples - samples/*:ANN,DAR - # Don't require docstrings conventions or type annotations in private modules - singer_sdk/helpers/_*.py:ANN,DAR,D105 - # Don't require docstrings conventions in "meta" code - singer_sdk/helpers/_classproperty.py:D105 -max-complexity = 10 -docstring-convention = google -allow-star-arg-any = true - -[coverage:run] -source = singer_sdk -omit = - tests/* - samples/* - singer_sdk/helpers/_compat.py - -[coverage:report] -exclude_lines = - pragma: no cover - def __repr__ - raise AssertionError - raise NotImplementedError - if __name__ == .__main__.: - class .*\bProtocol\): -fail_under = 85