From 5c233e33355e68439700a3f6b62f1c57924c8a90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= Date: Mon, 17 Jan 2022 12:04:14 +0100 Subject: [PATCH 1/3] use flit --- justfile | 17 +++---------- pyproject.toml | 37 +++++++++++++++++++++++++-- setup.cfg | 41 ------------------------------ src/pytest_codeblocks/__about__.py | 1 + src/pytest_codeblocks/__init__.py | 2 ++ 5 files changed, 42 insertions(+), 56 deletions(-) delete mode 100644 setup.cfg create mode 100644 src/pytest_codeblocks/__about__.py diff --git a/justfile b/justfile index 38e14fa..d444cc8 100644 --- a/justfile +++ b/justfile @@ -1,21 +1,12 @@ -version := `python3 -c "from configparser import ConfigParser; p = ConfigParser(); p.read('setup.cfg'); print(p['metadata']['version'])"` -name := `python3 -c "from configparser import ConfigParser; p = ConfigParser(); p.read('setup.cfg'); print(p['metadata']['name'])"` - +version := `python3 -c "from src.pytest_codeblocks.__about__ import __version__; print(__version__)"` default: @echo "\"just publish\"?" -tag: - @if [ "$(git rev-parse --abbrev-ref HEAD)" != "main" ]; then exit 1; fi - curl -H "Authorization: token `cat ~/.github-access-token`" -d '{"tag_name": "v{{version}}"}' https://api.github.com/repos/nschloe/{{name}}/releases - -upload: clean +publish: @if [ "$(git rev-parse --abbrev-ref HEAD)" != "main" ]; then exit 1; fi - # https://stackoverflow.com/a/58756491/353337 - python3 -m build --sdist --wheel . - twine upload dist/* - -publish: tag upload + gh release create "v{{version}}" + flit publish clean: @find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf diff --git a/pyproject.toml b/pyproject.toml index 3c2aae9..69fa364 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,39 @@ [build-system] -requires = ["setuptools>=42", "wheel"] -build-backend = "setuptools.build_meta" +requires = ["flit_core >=3.2,<4"] +build-backend = "flit_core.buildapi" [tool.isort] profile = "black" + +[project] +name = "pytest-codeblocks" +authors = [{name = "Nico Schlömer", email = "nico.schloemer@gmail.com"}] +description = "Test code blocks in your READMEs" +readme = "README.md" +license = {file = "LICENSE.txt"} +classifiers = [ + "Development Status :: 4 - Beta", + "Framework :: Pytest", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", +] +dynamic = ["version"] +requires-python = ">=3.7" +dependencies = [ + "pytest >= 6" +] + +[project.urls] +Code = "https://github.com/nschloe/pytest-codeblocks" +Issues = "https://github.com/nschloe/pytest-codeblocks/issues" +Funding = "https://github.com/sponsors/nschloe" + +[project.entry-points.pytest11] +codeblocks = "pytest_codeblocks.plugin" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index c407897..0000000 --- a/setup.cfg +++ /dev/null @@ -1,41 +0,0 @@ -[metadata] -name = pytest-codeblocks -version = 0.12.2 -author = Nico Schlömer -author_email = nico.schloemer@gmail.com -description = Test code blocks in your READMEs -url = https://github.com/nschloe/pytest-codeblocks -project_urls = - Code=https://github.com/nschloe/pytest-codeblocks - Issues=https://github.com/nschloe/pytest-codeblocks/issues - Funding=https://github.com/sponsors/nschloe -long_description = file: README.md -long_description_content_type = text/markdown -license = MIT -classifiers = - Development Status :: 4 - Beta - Framework :: Pytest - Intended Audience :: Developers - License :: OSI Approved :: MIT License - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - -[options] -package_dir = - =src -packages = find: -install_requires = - pytest >=6 -python_requires = >=3.7 - -[options.packages.find] -where=src - -[options.entry_points] -pytest11 = - codeblocks = pytest_codeblocks.plugin diff --git a/src/pytest_codeblocks/__about__.py b/src/pytest_codeblocks/__about__.py new file mode 100644 index 0000000..76da4a9 --- /dev/null +++ b/src/pytest_codeblocks/__about__.py @@ -0,0 +1 @@ +__version__ = "0.12.2" diff --git a/src/pytest_codeblocks/__init__.py b/src/pytest_codeblocks/__init__.py index cfe1c24..b0813f1 100644 --- a/src/pytest_codeblocks/__init__.py +++ b/src/pytest_codeblocks/__init__.py @@ -1,4 +1,5 @@ from . import plugin +from .__about__ import __version__ from .main import CodeBlock, extract_from_buffer, extract_from_file __all__ = [ @@ -6,4 +7,5 @@ "extract_from_buffer", "extract_from_file", "plugin", + "__version__", ] From e1aea674169a84d2ca1af08f0ce960bc60f34d1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= Date: Mon, 17 Jan 2022 12:04:33 +0100 Subject: [PATCH 2/3] version bump --- src/pytest_codeblocks/__about__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pytest_codeblocks/__about__.py b/src/pytest_codeblocks/__about__.py index 76da4a9..f23a6b3 100644 --- a/src/pytest_codeblocks/__about__.py +++ b/src/pytest_codeblocks/__about__.py @@ -1 +1 @@ -__version__ = "0.12.2" +__version__ = "0.13.0" From 5a7aa613f53e5a01d428085229918b4758ea8ae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= Date: Mon, 17 Jan 2022 12:53:02 +0100 Subject: [PATCH 3/3] naming fix --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 69fa364..4f14db1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "flit_core.buildapi" profile = "black" [project] -name = "pytest-codeblocks" +name = "pytest_codeblocks" authors = [{name = "Nico Schlömer", email = "nico.schloemer@gmail.com"}] description = "Test code blocks in your READMEs" readme = "README.md"