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

Replace poetry with uv #12

Closed
wants to merge 4 commits into from
Closed
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
5 changes: 3 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry tox tox-gh-actions
pip install uv
uv venv
uv pip install tox tox-gh-actions
- name: Cache tox environments
id: cache-tox
uses: actions/cache@v3
Expand Down
34 changes: 14 additions & 20 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
name: Upload Python Package

on:
release:
types: [published]

permissions:
contents: read
pull_request:
push:
branches:
- "*"
tags:
- "v*"

jobs:
deploy:

test-pypi-publish:
runs-on: ubuntu-latest

environment:
name: pypi
url: https://pypi.org/p/pytest-ruff
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install dependencies
run: |
poetry install
- name: Build and publish to pypi
uses: JRubics/poetry-publish@v1.15
with:
plugins: poetry_dynamic_versioning[plugin]
pypi_token: ${{ secrets.PYPI_API_TOKEN }}
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__pycache__/
.tox/
*.egg-info/

.coverage
coverage*.xml
poetry.lock
36 changes: 17 additions & 19 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,39 +1,37 @@
[tool.poetry]
[project]
name = "pytest-ruff"
version = "0.0.0"
description = "pytest plugin to check ruff requirements."
authors = ["Iuri de Silvio <iurisilvio@gmail.com>"]
authors = [{"name" = "Iuri de Silvio", "email" = "iurisilvio@gmail.com"}]
readme = "README.md"
classifiers = [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Operating System :: OS Independent", "Framework :: Pytest", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", "Topic :: Software Development :: Libraries :: Python Modules"]
dynamic = ["version"]
dependencies = [
"ruff>=0.0.242"
]

[tool.poetry.urls]
[project.urls]
Homepage = "https://github.com/businho/pytest-ruff"

[build-system]
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"]
build-backend = "poetry_dynamic_versioning.backend"
requires = ["setuptools", "setuptools_scm"]
build-backend = "setuptools.build_meta"

[tool.poetry.dependencies]
python = "^3.8"
ruff = ">=0.0.242"
[project.optional-dependencies]
test = [
"pytest>=7.2.0",
"pytest-mock>=3.10.0",
"pytest-cov>=4.1.0",
]

[tool.poetry.group.dev.dependencies]
pytest = "^7.2.0"
pytest-mock = "^3.10.0"
pytest-cov = "^4.1.0"

[tool.poetry-dynamic-versioning]
enable = true
[project.entry-points.pytest11]
ruff = "pytest_ruff"

[tool.pytest.ini_options]
addopts = "--capture=no"

[tool.ruff]
line-length = 88

[tool.poetry.plugins]
pytest11 = { ruff = "pytest_ruff" }

[tool.coverage.run]
branch = true

Expand Down
23 changes: 23 additions & 0 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This file was autogenerated by uv via the following command:
# uv pip compile pyproject.toml --extra test
coverage==7.4.3
# via pytest-cov
exceptiongroup==1.2.0
# via pytest
iniconfig==2.0.0
# via pytest
packaging==23.2
# via pytest
pluggy==1.4.0
# via pytest
pytest==8.0.1
# via
# pytest-cov
# pytest-mock
pytest-cov==4.1.0
pytest-mock==3.12.0
ruff==0.2.2
tomli==2.0.1
# via
# coverage
# pytest
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This file was autogenerated by uv via the following command:
# uv pip compile pyproject.toml
ruff==0.2.2
2 changes: 2 additions & 0 deletions tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def test_pytest_ruff():
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
).communicate()
assert err == b""
out_utf8 = out.decode("utf-8")
assert "`os` imported but unused" in out_utf8

Expand Down Expand Up @@ -76,4 +77,5 @@ def test_pytest_ruff_noformat():
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
).communicate()
assert err == b""
assert "File would be reformatted" not in out.decode("utf-8")
10 changes: 7 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ isolated_build = true
envlist = py{38,39,310,311,312},lint

[testenv]
allowlist_externals = poetry
allowlist_externals =
pip
pytest
uv
commands =
poetry install --no-root --with dev
uv pip install -r requirements-test.txt
uv pip install -e .
# Disable ruff plugin to generate better coverage results
poetry run pytest -p no:ruff -vvv --cov --cov-append --cov-report term --cov-report xml {posargs}
pytest -vvv -p no:ruff -vvv --cov --cov-append --cov-report term --cov-report xml {posargs}

[testenv:lint]
description = lint source code
Expand Down
Loading