diff --git a/.github/dependabot.yml b/.github/dependabot.yml index b673657..960ed72 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,3 +8,7 @@ updates: directory: "/" schedule: interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fe3eade..aa881dd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,22 +5,25 @@ on: branches: [master] pull_request: branches: [master] + workflow_dispatch: + inputs: {} jobs: build: - + strategy: + fail-fast: false matrix: - python-version: [3.6, 3.7, 3.8] - + python-version: ["3.7", "3.8", "3.9", "3.10"] + runs-on: ubuntu-latest steps: - name: Checking out repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.container[1] }} - uses: actions/setup-python@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} @@ -29,11 +32,52 @@ jobs: python -m pip install -U pip setuptools wheel python3 -m pip install -U .[dev] - - name: Check code formatting - run: find singer tests -type f -name '*.py' | xargs unify --check-only - - name: Analysing the code with pylint run: pylint singer - name: Runs tests with coverage - run: nosetests --with-doctest -v --nocapture + run: coverage run --parallel -m pytest + + - name: Upload coverage data + uses: actions/upload-artifact@v3 + with: + name: coverage-data + path: ".coverage.*" + + coverage: + runs-on: ubuntu-latest + needs: build + steps: + - name: Check out the repository + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: "3.8" + + - name: Install and upgrade dependencies + run: | + python -m pip install -U pip setuptools wheel + python3 -m pip install -U .[dev] + + - name: Download coverage data + uses: actions/download-artifact@v3.0.0 + with: + name: coverage-data + + - name: Combine coverage data + run: | + coverage combine + + - name: Generate XML coverage report + run: | + coverage xml + + - name: Display human readable report + run: | + coverage report + + # Optional if you want to use codecov.io + # - name: Upload coverage report + # uses: codecov/codecov-action@v3 diff --git a/.gitignore b/.gitignore index 03e17bb..7fbbd47 100644 --- a/.gitignore +++ b/.gitignore @@ -86,7 +86,6 @@ ENV/ # Pipenv Pipfile Pipfile.lock -pyproject.toml # Spyder project settings .spyderproject diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..f083f21 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,40 @@ +# See https://pre-commit.com for more information + +# See https://pre-commit.ci/ for information about the continuous +# integration service for the pre-commit framework +ci: + autofix_prs: false + autoupdate_schedule: weekly + autoupdate_commit_msg: 'chore(deps): pre-commit autoupdate' + + +# See https://pre-commit.com/hooks.html for more hooks +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.2.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files +- repo: https://github.com/asottile/pyupgrade + rev: v2.32.0 + hooks: + - id: pyupgrade + name: pyupgrade (python) + args: [--py37-plus] +- repo: https://github.com/pycqa/isort + rev: 5.10.1 + hooks: + - id: isort + name: isort (python) +- repo: https://github.com/psf/black + rev: 22.3.0 + hooks: + - id: black + name: black (python) +- repo: https://github.com/PyCQA/pylint + rev: v2.13.8 + hooks: + - id: pylint + name: pylint (python) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 076acf3..1dc7443 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,6 +2,7 @@ ## Submitting a PR -1. Write tests to cover any new code or code changes. -2. Please make sure that all tests pass and that the code passes linting with `make`. -3. Open up the PR. +1. Install and use [pre-commit](https://pre-commit.com/) to keep your changes in the style of the project. +2. Write tests to cover any new code or code changes. +3. Please make sure that all tests pass and that the code passes linting with `make`. +4. Open up the PR. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..96df883 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,26 @@ +[tool.black] +line-length = 120 + +[tool.coverage.paths] +source = ["singer"] + +[tool.coverage.run] +branch = true +source = ["singer"] + +[tool.coverage.report] +fail_under = 76.0 + +[tool.isort] +profile = "black" +multi_line_output = 3 +src_paths = "singer" +use_parentheses = true +known_first_party = "singer" +include_trailing_comma = true +add_imports = [ + "from __future__ import annotations", +] + +[tool.pytest.ini_options] +addopts = "-v --doctest-modules" diff --git a/setup.py b/setup.py index 9de29ab..86dbee3 100644 --- a/setup.py +++ b/setup.py @@ -8,6 +8,7 @@ setup(name="pipelinewise-singer-python", version='2.0.1', description="Singer.io utility library - PipelineWise compatible", + python_requires=">=3.7.0, <3.11", long_description=long_description, long_description_content_type="text/markdown", author="TransferWise", @@ -19,7 +20,7 @@ install_requires=[ 'pytz', 'jsonschema==3.2.0', - 'orjson==3.6.1', + 'orjson==3.6.5', 'python-dateutil>=2.6.0', 'backoff==1.11.1', 'ciso8601', @@ -27,9 +28,10 @@ extras_require={ 'dev': [ 'pylint==2.11.1', + 'pytest==7.1.2', + 'coverage[toml]~=6.3', 'ipython', 'ipdb', - 'nose', 'unify==0.5' ] },