Skip to content

Commit

Permalink
Modernize tox-poetry integration
Browse files Browse the repository at this point in the history
I have never been a fan of poetry, but since this project is already
using it, let's keep it this way. What we have to do though is to make
sure we use the up-to-date poetry configuration and best practices.

This patch moves dependency definitions out from tox.ini to
pyproject.toml (poetry groups). This should help us to maintain
dependencies in one place only.
  • Loading branch information
ikalnytskyi committed May 7, 2024
1 parent cf0a583 commit 4cfaa67
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ jobs:
if: matrix.os == 'macos-latest'

- name: Run pytest
run: pipx run tox -e py3
run: pipx run tox -e test
19 changes: 14 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "httpie-credential-store"
version = "3.1.0"
Expand All @@ -14,18 +18,23 @@ python = "^3.8"
httpie = "^3.1"
keyring = ">= 23.5"

[tool.poetry.dev-dependencies]
[tool.poetry.group.lint]
optional = true

[tool.poetry.group.lint.dependencies]
ruff = "^0.4.2"

[tool.poetry.group.test]
optional = true

[tool.poetry.group.test.dependencies]
pytest = "^7.1"
responses = "^0.20"

[tool.poetry.plugins."httpie.plugins.auth.v1"]
credential-store = "httpie_credential_store:CredentialStoreAuthPlugin"
creds = "httpie_credential_store:CredsAuthPlugin"

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

[tool.ruff]
line-length = 100
target-version = "py38"
Expand Down
19 changes: 9 additions & 10 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
[tox]
envlist = py3, lint
envlist = lint, test

[testenv]
deps = poetry
allowlist_externals = poetry
skip_install = true
commands =
poetry install -v
poetry run pytest -vv

[testenv:test]
commands_pre = poetry install --with test
commands = poetry run pytest -vv {posargs:.}

[testenv:lint]
skip_install = true
deps =
ruff >= 0.4.2, < 0.5.0
commands_pre = poetry install --only lint
commands =
ruff check {args:.}
ruff format --check --diff {args:.}
ruff check {posargs:.}
ruff format --check --diff {posargs:.}

0 comments on commit 4cfaa67

Please sign in to comment.