Skip to content

Commit e481c22

Browse files
authored
feat: update to tox 4 release (#35)
1 parent a030b2f commit e481c22

File tree

7 files changed

+410
-488
lines changed

7 files changed

+410
-488
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
python-version: [3.7, 3.8, 3.9, "3.10"]
13+
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
1414
tox-version: [3, 4]
1515

1616
steps:
1717
- uses: actions/checkout@v3
1818
- name: Set up Python ${{ matrix.python-version }}
19-
uses: pdm-project/setup-pdm@main
19+
uses: pdm-project/setup-pdm@v3
2020
with:
2121
python-version: ${{ matrix.python-version }}
2222
- name: Install dependencies
@@ -27,7 +27,7 @@ jobs:
2727
tox --version
2828
pyversion="${{ matrix.python-version }}"
2929
toxversion="${{ matrix.tox-version }}"
30-
if [[ $toxversion == "4" ]]; then
31-
mv pdm.tox4.lock pdm.lock;
30+
if [[ $toxversion == "3" ]]; then
31+
mv pdm.tox3.lock pdm.lock;
3232
fi
3333
tox -e py${pyversion/./}-tox${toxversion}

.github/workflows/release.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,16 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
- uses: actions/checkout@v2
15-
- uses: actions/setup-python@v2
14+
- uses: actions/checkout@v3
15+
- uses: actions/setup-python@v4
1616
with:
17-
python-version: 3.8
17+
python-version: "3.10"
1818
architecture: "x64"
19-
- name: Install PDM
20-
run: |
21-
pip install -U pdm
19+
2220
- name: Build artifacts
2321
run: |
24-
pdm build -v
22+
python3 -m pip install build
23+
python3 -m build
2524
- name: Upload to Pypi
2625
run: |
2726
pip install twine

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ A plugin for tox that utilizes PDM as the package manager and installer.
66
[![PyPI](https://img.shields.io/pypi/v/tox-pdm?logo=python&logoColor=%23cccccc)](https://pypi.org/project/tox-pdm)
77
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
88
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
9+
![Tox Versions](https://img.shields.io/badge/tox-v3%20%7C%20v4-yellowgreen)
910

1011
With this plugin, you can migrate your project to PDM while retaining the ability to test against multiple versions.
1112

pdm.lock

Lines changed: 205 additions & 223 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pdm.tox4.lock renamed to pdm.tox3.lock

Lines changed: 175 additions & 245 deletions
Large diffs are not rendered by default.

pyproject.toml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,26 @@
22
name = "tox-pdm"
33
description = "A plugin for tox that utilizes PDM as the package manager and installer"
44
authors = [
5-
{name = "Frost Ming", email = "mianghong@gmail.com"},
5+
{name = "Frost Ming", email = "me@frostming.com"},
66
]
77
dependencies = [
88
"tox>=3.18.0",
9-
"toml>=0.10",
9+
"tomli; python_version<'3.11'",
1010
]
1111
requires-python = ">=3.7"
1212
dynamic = ["version"]
1313
license = {text = "MIT"}
1414
readme = "README.md"
15-
keywords = ["tox", "testing"]
15+
keywords = ["tox", "testing", "pdm"]
1616
classifiers = [
1717
"Development Status :: 4 - Beta",
1818
"Intended Audience :: Developers",
19+
"Programming Language :: Python :: 3",
20+
"Programming Language :: Python :: 3.7",
21+
"Programming Language :: Python :: 3.8",
22+
"Programming Language :: Python :: 3.9",
23+
"Programming Language :: Python :: 3.10",
24+
"Programming Language :: Python :: 3.11",
1925
]
2026

2127
[project.urls]
@@ -25,7 +31,6 @@ Repository = "https://github.com/pdm-project/tox-pdm"
2531
[project.entry-points.tox]
2632
pdm = "tox_pdm.plugin"
2733

28-
2934
[project.optional-dependencies]
3035
test = [
3136
"pytest>=6.2",
@@ -35,13 +40,13 @@ lint = [
3540
"flake8>=3.8",
3641
"black>=20.8b1",
3742
]
43+
3844
[build-system]
3945
requires = ["pdm-pep517"]
4046
build-backend = "pdm.pep517.api"
4147

42-
[tool]
43-
[tool.pdm]
44-
version = {use_scm = true}
48+
[tool.pdm.version]
49+
source = "scm"
4550

4651
[tool.pdm.scripts]
4752
test = "pytest -v tests/"

tox_pdm/utils.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
from __future__ import annotations
22

3+
import sys
34
from pathlib import Path
45
from typing import Any
56

6-
import toml
7+
if sys.version_info >= (3, 11):
8+
import tomllib
9+
else:
10+
import tomli as tomllib
711

812

913
def pdm_scripts(root: Path) -> dict[str, Any]:
1014
pyproject_toml = root / "pyproject.toml"
1115
if pyproject_toml.exists():
12-
pyproject = toml.load(pyproject_toml.open("r"))
16+
with open(pyproject_toml, "rb") as f:
17+
pyproject = tomllib.load(f)
1318
return pyproject.get("tool", {}).get("pdm", {}).get("scripts", {})
1419
return {}

0 commit comments

Comments
 (0)