Skip to content

Commit

Permalink
feat: update to tox 4 release (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
frostming authored Dec 13, 2022
1 parent a030b2f commit e481c22
Show file tree
Hide file tree
Showing 7 changed files with 410 additions and 488 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, "3.10"]
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
tox-version: [3, 4]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: pdm-project/setup-pdm@main
uses: pdm-project/setup-pdm@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -27,7 +27,7 @@ jobs:
tox --version
pyversion="${{ matrix.python-version }}"
toxversion="${{ matrix.tox-version }}"
if [[ $toxversion == "4" ]]; then
mv pdm.tox4.lock pdm.lock;
if [[ $toxversion == "3" ]]; then
mv pdm.tox3.lock pdm.lock;
fi
tox -e py${pyversion/./}-tox${toxversion}
13 changes: 6 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: "3.10"
architecture: "x64"
- name: Install PDM
run: |
pip install -U pdm

- name: Build artifacts
run: |
pdm build -v
python3 -m pip install build
python3 -m build
- name: Upload to Pypi
run: |
pip install twine
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ A plugin for tox that utilizes PDM as the package manager and installer.
[![PyPI](https://img.shields.io/pypi/v/tox-pdm?logo=python&logoColor=%23cccccc)](https://pypi.org/project/tox-pdm)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
![Tox Versions](https://img.shields.io/badge/tox-v3%20%7C%20v4-yellowgreen)

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

Expand Down
428 changes: 205 additions & 223 deletions pdm.lock

Large diffs are not rendered by default.

420 changes: 175 additions & 245 deletions pdm.tox4.lock → pdm.tox3.lock

Large diffs are not rendered by default.

19 changes: 12 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,26 @@
name = "tox-pdm"
description = "A plugin for tox that utilizes PDM as the package manager and installer"
authors = [
{name = "Frost Ming", email = "mianghong@gmail.com"},
{name = "Frost Ming", email = "me@frostming.com"},
]
dependencies = [
"tox>=3.18.0",
"toml>=0.10",
"tomli; python_version<'3.11'",
]
requires-python = ">=3.7"
dynamic = ["version"]
license = {text = "MIT"}
readme = "README.md"
keywords = ["tox", "testing"]
keywords = ["tox", "testing", "pdm"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]

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


[project.optional-dependencies]
test = [
"pytest>=6.2",
Expand All @@ -35,13 +40,13 @@ lint = [
"flake8>=3.8",
"black>=20.8b1",
]

[build-system]
requires = ["pdm-pep517"]
build-backend = "pdm.pep517.api"

[tool]
[tool.pdm]
version = {use_scm = true}
[tool.pdm.version]
source = "scm"

[tool.pdm.scripts]
test = "pytest -v tests/"
Expand Down
9 changes: 7 additions & 2 deletions tox_pdm/utils.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
from __future__ import annotations

import sys
from pathlib import Path
from typing import Any

import toml
if sys.version_info >= (3, 11):
import tomllib
else:
import tomli as tomllib


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

0 comments on commit e481c22

Please sign in to comment.