Skip to content

gh-115: Migrate to the pyproject.toml #149

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

Merged
merged 7 commits into from
Nov 28, 2022
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --user --upgrade setuptools wheel
python -m pip install --user --upgrade build
- name: Build
run: |
python setup.py sdist bdist_wheel
python -m build

- name: Publish distribution 📦 to PyPI
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
Expand Down
9 changes: 7 additions & 2 deletions pyperf/tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,13 @@ def test_parse_run_list(self):
self.assertRaises(ValueError, parse_run_list, '1,')

def test_setup_version(self):
import setup
self.assertEqual(pyperf.__version__, setup.VERSION)
try:
from importlib.metadata import version
except ModuleNotFoundError:
# Workaround for Python 3.7
from importlib_metadata import version

self.assertEqual(pyperf.__version__, version("pyperf"))

def test_doc_version(self):
doc_path = os.path.join(os.path.dirname(__file__), '..', '..', 'doc')
Expand Down
63 changes: 63 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Prepare a release:
#
# - git pull --rebase
# - update version in pyperf/__init__.py and doc/conf.py
# - set release date in doc/changelog.rst
# - git commit -a -m "prepare release x.y"
# - Remove untracked files/dirs: git clean -fdx
# - run tests: tox --parallel auto
# - git push or send the PR to the repository
# - check Github Action CI: https://github.com/psf/pyperf/actions/workflows/build.yml
#
# Release a new version:
#
# - go to the GitHub release tab: https://github.com/psf/pyperf/releases
# - click "Draft a new release" and fill the contents
# - finally click the "Publish release" button! Done!
# - monitor the publish status: https://github.com/psf/pyperf/actions/workflows/publish.yml
#
# After the release:
#
# - set version to n+1
# - git commit -a -m "post-release"
# - git push or send the PR to the repository

[build-system]
requires = ["setuptools >= 61"]
build-backend = "setuptools.build_meta"

[project]
name = "pyperf"
dynamic = ["version"]
license = {text = "MIT"}
description = "Python module to run and analyze benchmarks"
readme = "README.rst"
urls = {Homepage = "https://github.com/psf/pyperf"}
authors= [{name="Victor Stinner", email="[email protected]"}]
maintainers = [{name = "Dong-hee Na", email="[email protected]"}]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Topic :: Software Development :: Libraries :: Python Modules"
]
requires-python = ">=3.7"
dependencies = ["psutil>=5.9.0"]

[project.optional-dependencies]
dev = [
'tox',
'importlib-metadata; python_version < "3.8"'
]

[project.scripts]
pyperf = "pyperf.__main__:main"

[tool.setuptools]
packages = ["pyperf", "pyperf.tests"]

[tool.setuptools.dynamic]
version = {attr = "pyperf.__version__"}
74 changes: 0 additions & 74 deletions setup.py

This file was deleted.

1 change: 0 additions & 1 deletion test-requirements.txt

This file was deleted.

3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[tox]
envlist = py3, pypy3, doc, pep8
isolated_build = True

[testenv]
deps=-r test-requirements.txt
extras=dev
commands=
python -bb -Wd -m unittest discover -s pyperf/tests/ -v

Expand Down