diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 87b85830..410d0075 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,11 +16,11 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine + pip install setuptools wheel twine build - name: Build and publish env: TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | - python setup.py sdist bdist_wheel + python -m build sdist bdist_wheel twine upload dist/* diff --git a/dodo.py b/dodo.py index eb5d7498..37331b9c 100644 --- a/dodo.py +++ b/dodo.py @@ -1,12 +1,23 @@ -import distutils.core import glob import os +import build from domdiv.tools import bgg_release, update_language DOIT_CONFIG = {"default_tasks": ["build"]} +def buildit(): + try: + builder = build.ProjectBuilder(".") + builder.prepare("wheel", "dist") + builder.build("sdist", "dist") + except Exception as e: + print(e) + return False + return True + + def glob_no_dirs(spec): return [fname for fname in glob.glob(spec) if os.path.isfile(fname)] @@ -48,15 +59,13 @@ def task_build(): files = [ fname for fname in glob_no_dirs("src/domdiv/**/*") - + glob.glob("card_db_src/**/*.json" + "setup.py") + + glob.glob("card_db_src/**/*.json" + "pyproject.toml") if os.path.isfile(fname) ] return { "file_dep": files, "task_dep": ["update_languages"], - "actions": [ - lambda: True if distutils.core.run_setup("setup.py", "sdist") else False - ], + "actions": [buildit], } @@ -66,4 +75,4 @@ def task_make_bgg_release(): def task_test(): files = glob_no_dirs("src/domdiv/**") - return {"file_dep": files, "actions": ["python setup.py test"]} + return {"file_dep": files, "actions": ["pip install -e .[tests]", "pytest"]} diff --git a/pyproject.toml b/pyproject.toml index d9122206..babbc8d5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,4 +1,31 @@ + [build-system] -requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.3", "pytest-runner"] +requires = ["setuptools>=61", "setuptools_scm[toml]>=6"] +build-backend = "setuptools.build_meta" + +[project] +name = "domdiv" +dynamic = ["version"] +dependencies = ["reportlab", "Pillow", "configargparse"] +description = "Divider Generation for the Dominion Card Game" +keywords = ["boardgame", "cardgame", "dividers"] +authors = [{ name = "Peter Gorniak", email = "sumpfork@mailmight.net" }] +readme = "README.md" + +[project.urls] +"Say Thanks" = "https://boardgamegeek.com/thread/926575/web-page-generate-tabbed-dividers" +"Source" = "https://github.com/sumpfork/dominiontabs" +"Issue Tracker" = "https://github.com/sumpfork/dominiontabs/issues" +"Homepage" = "http://domtabs.sandflea.org" + +[project.optional-dependencies] +dev = ["build", "twine", "pre-commit", "doit", "pytest"] + +[project.scripts] +dominion_dividers = "domdiv.main:main" +domdiv_update_language = "domdiv.tools.update_language:run" +domdiv_bgg_release = "domdiv.tools.bgg_release:make_bgg_release" +domdiv_dedupe_cards = "domdiv.tools.cleanup_language_dupes:main" -[tools.setuptools_scm] +[tool.setuptools_scm] +version_file = "src/domdiv/_version.py" diff --git a/setup.py b/setup.py deleted file mode 100644 index 135ca2b2..00000000 --- a/setup.py +++ /dev/null @@ -1,32 +0,0 @@ -from setuptools import setup - -setup( - name="domdiv", - entry_points={ - "console_scripts": [ - "dominion_dividers = domdiv.main:main", - "domdiv_update_language = domdiv.tools.update_language:run", - "domdiv_bgg_release = domdiv.tools.bgg_release:make_bgg_release", - "domdiv_dedupe_cards = domdiv.tools.cleanup_language_dupes:main", - ] - }, - package_dir={"": "src"}, - packages=["domdiv"], - use_scm_version=True, - setup_requires=["setuptools_scm", "pytest-runner"], - install_requires=["reportlab", "Pillow", "configargparse"], - tests_require=["pytest", "six", "pre-commit", "doit"], - url="http://domtabs.sandflea.org", - project_urls={ - "Say Thanks!": "https://boardgamegeek.com/thread/926575/web-page-generate-tabbed-dividers", - "Source": "https://github.com/sumpfork/dominiontabs", - "Tracker": "https://github.com/sumpfork/dominiontabs/issues", - }, - include_package_data=True, - author="Peter Gorniak", - author_email="sumpfork@mailmight.net", - description="Divider Generation for the Dominion Card Game", - keywords=["boardgame", "cardgame", "dividers"], - long_description="This script and library generate dividers for the Dominion Card Game by Rio Grande Games.\ - See it in action at http://domdiv.bgtools.net.", -) diff --git a/src/domdiv/_version.py b/src/domdiv/_version.py new file mode 100644 index 00000000..2031aac0 --- /dev/null +++ b/src/domdiv/_version.py @@ -0,0 +1,17 @@ +# file generated by setuptools_scm +# don't change, don't track in version control +TYPE_CHECKING = False +if TYPE_CHECKING: + from typing import Tuple, Union + + VERSION_TUPLE = Tuple[Union[int, str], ...] +else: + VERSION_TUPLE = object + +version: str +__version__: str +__version_tuple__: VERSION_TUPLE +version_tuple: VERSION_TUPLE + +__version__ = version = "4.4.2.dev0+g98a7589.d20240318" +__version_tuple__ = version_tuple = (4, 4, 2, "dev0", "g98a7589.d20240318") diff --git a/tox.ini b/tox.ini index dd24d24a..5f277a5c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,6 @@ [tox] envlist = py39 +isolated_build = True [testenv] deps = pytest