Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Modernize tox setup #340

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 10 additions & 28 deletions .github/workflows/ci_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,36 +31,23 @@ jobs:
linting:

runs-on: ubuntu-latest
env:
PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/constraints.txt
steps:
- uses: actions/checkout@v4
- name: Install Poetry
run: |
pipx install poetry
poetry --version
- name: Set up Python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v5
- uses: actions/setup-python@v5
with:
python-version: 3.x
cache: poetry
- name: Install dependencies
run: |
poetry env use ${{ steps.setup-python.outputs.python-path }}
poetry install
- uses: astral-sh/setup-uv@v3
with:
version: ">=0.4.20"
- name: Run lint command from tox.ini
run: |
pipx run tox -e lint
uvx tox -e lint
pytest:

runs-on: ubuntu-latest
env:
CLIENT_SECRETS: ${{ secrets.GA_CLIENT_SECRETS }}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/constraints.txt
strategy:
fail-fast: false
matrix:
python-version:
- "3.8"
Expand All @@ -72,19 +59,14 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Install Poetry
run: |
pipx install poetry
poetry --version
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
cache: poetry
- name: Install dependencies
run: |
poetry install
- uses: astral-sh/setup-uv@v3
with:
version: ">=0.4.20"
- name: Test with pytest
run: |
poetry run pytest --capture=no
uvx tox -e py
2 changes: 0 additions & 2 deletions .github/workflows/constraints.txt

This file was deleted.

3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ Create tests within the `tap_csv/tests` subfolder and
then run:

```bash
poetry run tox
poetry run tox -e pytest
poetry run tox -e py313
poetry run tox -e format
poetry run tox -e lint
```
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ruff = ">=0.1.15"
types-requests = ">=2.31.0"

[build-system]
requires = ["poetry-core==1.9.0"]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
Expand Down
34 changes: 16 additions & 18 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
# This file can be used to customize tox tests as well as other test frameworks like flake8 and mypy

[tox]
envlist = py38
; envlist = py37, py38, py39
envlist = py3{8,9,10,11,12,13}, format, lint
isolated_build = true

[testenv]
allowlist_externals = poetry

[testenv:pytest]
# Run the python tests.
# To execute, run `tox -e pytest`
envlist = py38, py39, py310, py311, py312
deps =
coverage
pytest
commands =
poetry install -v
poetry run coverage run -m pytest
poetry run coverage html -d tap_csv/tests/codecoverage
coverage run -m pytest
coverage html -d tap_csv/tests/codecoverage

[testenv:format]
# Attempt to auto-resolve lint errors before they are raised.
# To execute, run `tox -e format`
deps =
ruff
commands =
poetry install -v
poetry run ruff check --fix tap_csv/
poetry run ruff format tap_csv
ruff check --fix tap_csv/
ruff format tap_csv

[testenv:lint]
# Raise an error if lint and style standards are not met.
# To execute, run `tox -e lint`
deps =
ruff
mypy
commands =
poetry install -v
poetry run ruff check --diff tap_csv/
poetry run ruff format --check tap_csv
poetry run mypy tap_csv --exclude='tap_csv/tests' --ignore-missing-imports
ruff check --diff tap_csv/
ruff format --check tap_csv
mypy tap_csv --exclude='tap_csv/tests' --ignore-missing-imports