Skip to content

Commit

Permalink
update tooling (#60)
Browse files Browse the repository at this point in the history
* poetry to uv
* add PR to action updater
  • Loading branch information
grizz authored Sep 29, 2024
1 parent b2af280 commit 156f5d6
Show file tree
Hide file tree
Showing 8 changed files with 1,318 additions and 1,520 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/actions-updater.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
schedule:
# Automatically run on every Sunday
- cron: '0 0 * * 0'
pull_request:
branches: [main]

jobs:
build:
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Install virtualenv from poetry
uses: 20c/workflows/poetry@v1
# need to setup mkdocs config
uses: actions/checkout@v4
- name: Install
uses: astral-sh/setup-uv@v2
#- name: deploy mkdocs gh-pages site
# run: |
# poetry run mkdocs gh-deploy --force
27 changes: 17 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,37 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install virtualenv from poetry
uses: 20c/workflows/poetry@v1
- name: Install uv
uses: astral-sh/setup-uv@v2
- name: install project
run: uv sync --all-extras --dev
- name: Run linters
run: |
poetry run pre-commit run --all-files
uv run pre-commit run --all-files
test:
needs: linting
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest", "macos-latest" ]
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install virtualenv from poetry
uses: 20c/workflows/poetry@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v2
- name: Install python
run: uv python install ${{ matrix.python-version }}
- name: install tox
# run: uv tool install tox --with tox-uv
run: uv sync --all-extras --dev
- name: Run tests
run: poetry run tox -e py
run: uv run tox
- name: Upload coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

6 changes: 3 additions & 3 deletions docs/develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Run black last, it has the final say in formatting (and does not always agree with others).

```sh
poetry run isort .
poetry run black .
poetry run flake8 .
pre-commit run --all-files
# or, if it's not installed
# uv run pre-commit run --all-files
```
1,439 changes: 0 additions & 1,439 deletions poetry.lock

This file was deleted.

72 changes: 35 additions & 37 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[tool.poetry]
[project]
name = "rdap"
version = "1.5.2"
description = "Registration Data Access Protocol tools"
authors = ["20C <code@20c.com>"]
authors = [{ name = "20C", email = "code@20c.com" }]
readme = "README.md"
license = "Apache-2.0"
requires-python = ">= 3.8"

repository = "https://github.com/20c/rdap"

Expand All @@ -21,47 +22,48 @@ classifiers = [
"Topic :: Software Development",
"Topic :: Software Development :: Libraries",
]
dependencies = [
"googlemaps >= 4",
"munge[yaml] >= 1",
"phonenumbers >= 8",
"pydantic >= 2",
"requests >= 2",
"setuptools>=75.1.0",
]


[tool.poetry.scripts]
[project.scripts]
rdap = "rdap.cli:main"


[tool.poetry.dependencies]
python = "^3.8"
requests = ">=2.25.1"
munge = { version = ">=1.3", extras = ["yaml"] }
pydantic = ">=2.8.2"
googlemaps = ">=4.10"
phonenumbers = ">=8.13.0"

[tool.poetry.group.dev.dependencies]
# testing
coverage = ">=5"
pytest = ">=6"
pytest-django = ">=3.8"
pytest-filedata = ">=0.4.0"
pytest-cov = "*"
tox = ">=3.20"
tox-gh-actions = ">2.9.1"

# linting
bandit = ">=1.6.2"
mypy = ">=0.950"
pre-commit = ">=2.13"
ruff = ">=0.1"
[project.plugins."markdown.extensions"]
pymdgen = "pymdgen.md:Extension"

# docs
markdown = "*"
markdown-include = ">=0.5,<1"
mkdocs = ">=1.2.3"

[tool.poetry.plugins."markdown.extensions"]
pymdgen = "pymdgen.md:Extension"
[project.optional-dependencies]
dev = [
"coverage >= 7",
"pytest >= 8",
"pytest-filedata >= 1",
"pytest-cov >= 5",
"tox >= 4",
"tox-gh-actions >= 3",
"tox-uv>=1.13.0",
"bandit >= 1",
"mypy >= 1",
"pre-commit >= 3",
"ruff >= 0",
# docs
"markdown >= 3",
"markdown-include >= 0",
"mkdocs >= 1",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.ruff]

select = [
"I", # isort
"UP",
Expand All @@ -77,7 +79,3 @@ select = [
"PLR2004", # Magic value used in comparison, ...
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
31 changes: 4 additions & 27 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,43 +1,20 @@
[flake8]
extend-ignore = E203, E266, E501
exclude =
.git,
.venv,
__pycache__,
build,
dist
# line length is intentionally set to 80 here because black uses Bugbear
# See https://github.com/psf/black/blob/master/docs/the_black_code_style.md#line-length for more details
max-line-length = 80
max-complexity = 18
select = B,C,E,F,W,T4,B9
# ignore unused import in __init__, used to pull into namespace
per-file-ignores =
rdap/__init__.py:F401

[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311

[isort]
profile = black
multi_line_output = 3
3.12: py312

[pytest]
norecursedirs = data gen .tox

[tox]
isolated_build = true
envlist = py{38,39,310,311}
envlist = py{38,39,310,311,312}

[testenv]
allowlist_externals = poetry
runner = uv-venv-lock-runner
extras = dev
deps =
poetry
commands =
poetry install -v
poetry run pytest -vv --cov="{toxinidir}/rdap" --cov-report=term-missing --cov-report=xml tests/
pytest -vv --cov="{toxinidir}/rdap" --cov-report=term-missing --cov-report=xml tests/
Loading

0 comments on commit 156f5d6

Please sign in to comment.