Skip to content
Open
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ clean-test: ## remove test and coverage artifacts

.PHONY: dist
dist: clean-build ## builds source and wheel package
python setup.py sdist bdist_wheel
python scripts/make-wheel.py
twine check dist/*

.PHONY: release
Expand Down
91 changes: 91 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
[build-system]
requires = ["setuptools>=80", "setuptools-scm>=8"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
version_file = "cloup/_version.py"

[project]
name = "cloup"
dynamic = ["version"]

description = "Adds features to Click: option groups, constraints, subcommand sections and help themes."
readme = { file = "README.rst", content-type = "text/x-rst" }
license = { text = "BSD 3-Clause" }

requires-python = ">= 3.9"
authors = [
{ name = "Gianluca Gippetto", email = "[email protected]" },
]

classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]


dependencies = [
"click>=8.0,<9.0",
"typing_extensions; python_version <= '3.10'",
]


[dependency-groups]
docs = [
"furo",
"sphinx",
"sphinx-autoapi",
"sphinx-autobuild",
"sphinx-panels",
"sphinx-copybutton",
"sphinx-version-warning",
"sphinx-issues",
]

test = [
"pytest",
"pytest-cov",
"pytest-html",
]

dev = [
"build",
"flake8",
"flake8-pyproject",
"mypy",
"setuptools-scm",
"tox<4",
"twine",
{include-group = "docs"},
{include-group = "test"},
]


[tool.flake8]
exclude = "docs"
max-line-length = 90

ignore = [
"E241",
"E251",
"W503",
]

[tool.mypy]
ignore_missing_imports = true


[tool.coverage.report]
exclude_lines = [
"pragma: no covver",
"raise NotImplementedError",
"...",
"if TYPE_CHECKING:",
]
37 changes: 37 additions & 0 deletions scripts/make-wheel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import sys
import contextlib
import shutil
import subprocess
from pathlib import Path


@contextlib.contextmanager
def backup():
saved = []

def save(path: Path):
saved.append((path, path.parent / f"{path.name}.bck"))
shutil.copyfile(*saved[-1])
return saved[-1][0]

try:
yield save
finally:
for dst, src in saved:
shutil.copyfile(src, dst)
src.unlink()


def process():
with backup() as save:
readme = save(Path("README.rst"))
print("massaging {readme} ..")
txt = readme.read_text()
readme.write_text(txt[txt.find(".. docs-index-start") :])

print("creating wheel ..")
subprocess.check_call([sys.executable, "-m", "build", "."])


if __name__ == "__main__":
process()
20 changes: 0 additions & 20 deletions setup.cfg

This file was deleted.

52 changes: 0 additions & 52 deletions setup.py

This file was deleted.

5 changes: 4 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[tox]
isolated_build = true
envlist =
lint
mypy
Expand Down Expand Up @@ -35,7 +36,9 @@ commands =

[testenv:lint]
skip_install = true
deps = flake8
deps =
flake8
flake8-pyproject
commands = flake8 cloup tests examples

[testenv:mypy]
Expand Down
Loading