From 502ce7256fba473c8f8bb6a3f8e6980afd1e8094 Mon Sep 17 00:00:00 2001 From: Oleh Prypin Date: Sun, 2 Oct 2022 15:13:33 +0200 Subject: [PATCH] Switch to Hatch build, add pyproject.toml --- .github/workflows/deploy-release.yml | 16 ++--- pyproject.toml | 93 ++++++++++++++++++++++++++++ setup.cfg | 13 ---- tox.ini | 2 +- 4 files changed, 102 insertions(+), 22 deletions(-) create mode 100644 pyproject.toml diff --git a/.github/workflows/deploy-release.yml b/.github/workflows/deploy-release.yml index 3cc3f4f8d1..5de20df578 100644 --- a/.github/workflows/deploy-release.yml +++ b/.github/workflows/deploy-release.yml @@ -14,20 +14,20 @@ jobs: - name: Setup Python uses: actions/setup-python@v2 with: - python-version: 3.7 + python-version: 3.9 - name: Install dependencies run: | - python -m pip install --upgrade pip setuptools wheel babel + python -m pip install -U wheel hatch babel - name: Compile localization message files run: | python setup.py compile_catalog -t mkdocs python setup.py compile_catalog -t readthedocs - name: Build run: | - python setup.py bdist_wheel sdist --formats gztar + hatch build - name: Publish - if: success() - uses: pypa/gh-action-pypi-publish@v1.4.1 - with: - user: __token__ - password: ${{ secrets.PYPI_PASSWORD }} + run: | + hatch publish + env: + HATCH_INDEX_USER: __token__ + HATCH_INDEX_AUTH: ${{ secrets.PYPI_PASSWORD }} diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000000..75e18287d7 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,93 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "mkdocs" +description = "Project documentation with Markdown." +readme = "README.md" +# license = "BSD-2-Clause" +authors = [ + {name = "Tom Christie", email = "tom@tomchristie.com"}, +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Environment :: Web Environment", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Documentation", + "Topic :: Text Processing", +] +dynamic = ["version", "license"] +requires-python = ">=3.7" +dependencies = [ + "click >=7.0", + "Jinja2 >=2.11.1", + "Markdown >=3.2.1, <3.4", + "PyYAML >=5.1", + "watchdog >=2.0", + "ghp-import >=1.0", + "pyyaml_env_tag >=0.1", + "importlib_metadata >=4.3; python_version < '3.10'", + "typing_extensions >=3.10; python_version < '3.8'", + "packaging >=20.5", + "mergedeep >=1.3.4", + "colorama >=0.4; platform_system == 'Windows'", +] +[project.optional-dependencies] +i18n = [ + "babel >=2.9.0", +] + +[project.urls] +Documentation = "https://www.mkdocs.org/" +Source = "https://github.com/mkdocs/mkdocs" +Issues = "https://github.com/mkdocs/mkdocs/issues" +History = "https://www.mkdocs.org/about/release-notes/" + +[project.scripts] +mkdocs = "mkdocs.__main__:cli" + +[project.entry-points."mkdocs.themes"] +mkdocs = "mkdocs.themes.mkdocs" +readthedocs = "mkdocs.themes.readthedocs" + +[project.entry-points."mkdocs.plugins"] +search = "mkdocs.contrib.search:SearchPlugin" + +[tool.hatch.build] +include = ["/mkdocs"] +artifacts = ["/mkdocs/**/*.mo"] + +[tool.hatch.build.targets.wheel] +exclude = ["/mkdocs/tests/integration", "*.po", "*.pot", "babel.cfg"] + +[tool.hatch.version] +path = "mkdocs/__init__.py" + +[tool.black] +line-length = 100 +target-version = ["py37"] +skip-string-normalization = true + +[tool.isort] +profile = "black" +line_length = 100 + +[tool.mypy] +ignore_missing_imports = true +warn_unreachable = true +no_implicit_optional = true +show_error_codes = true diff --git a/setup.cfg b/setup.cfg index 60109b65cb..b70893f396 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,20 +1,7 @@ -[metadata] -license_files = LICENSE - [flake8] max-line-length = 119 extend-ignore = E203 -[isort] -profile = black -line_length = 100 - -[mypy] -ignore_missing_imports = true -warn_unreachable = true -no_implicit_optional = true -show_error_codes = true - [compile_catalog] statistics = True domain = messages diff --git a/tox.ini b/tox.ini index bac7c3fbc8..adb98e51ed 100644 --- a/tox.ini +++ b/tox.ini @@ -19,7 +19,7 @@ commands= [testenv:black] deps=black skip_install=true -commands={envbindir}/black -l100 -tpy37 --skip-string-normalization mkdocs +commands={envbindir}/black mkdocs [testenv:isort] deps=isort