mirror of
https://github.com/mkdocs/mkdocs.git
synced 2026-03-27 09:58:31 +07:00
Switch to pyproject.toml and Hatch build (#2988)
This commit is contained in:
16
.github/workflows/deploy-release.yml
vendored
16
.github/workflows/deploy-release.yml
vendored
@@ -14,20 +14,20 @@ jobs:
|
|||||||
- name: Setup Python
|
- name: Setup Python
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: 3.7
|
python-version: 3.9
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip setuptools wheel babel
|
python -m pip install -U hatch babel
|
||||||
- name: Compile localization message files
|
- name: Compile localization message files
|
||||||
run: |
|
run: |
|
||||||
pybabel compile --statistics --directory mkdocs/themes/mkdocs/locales
|
pybabel compile --statistics --directory mkdocs/themes/mkdocs/locales
|
||||||
pybabel compile --statistics --directory mkdocs/themes/readthedocs/locales
|
pybabel compile --statistics --directory mkdocs/themes/readthedocs/locales
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
python setup.py bdist_wheel sdist --formats gztar
|
hatch build
|
||||||
- name: Publish
|
- name: Publish
|
||||||
if: success()
|
run: |
|
||||||
uses: pypa/gh-action-pypi-publish@v1.4.1
|
hatch publish
|
||||||
with:
|
env:
|
||||||
user: __token__
|
HATCH_INDEX_USER: __token__
|
||||||
password: ${{ secrets.PYPI_PASSWORD }}
|
HATCH_INDEX_AUTH: ${{ secrets.PYPI_PASSWORD }}
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
include README.md
|
|
||||||
include LICENSE
|
|
||||||
recursive-include mkdocs *.ico *.js *.css *.png *.html *.eot *.svg *.ttf *.woff *.woff2 *.xml *.mustache *mkdocs_theme.yml *.mo
|
|
||||||
recursive-exclude * __pycache__
|
|
||||||
recursive-exclude * *.py[co]
|
|
||||||
@@ -90,7 +90,7 @@ updated by running the `extract_messages` command. For example, to update the
|
|||||||
`pot` file of the `mkdocs` theme, run the following command:
|
`pot` file of the `mkdocs` theme, run the following command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pybabel extract --project=MkDocs --copyright-holder=MkDocs --msgid-bugs-address='https://github.com/mkdocs/mkdocs/issues' --no-wrap --version="$(grep -Eo "\\b[123][^']+" mkdocs/__init__.py)" --mapping-file mkdocs/themes/babel.cfg --output-file mkdocs/themes/mkdocs/messages.pot mkdocs/themes/mkdocs
|
pybabel extract --project=MkDocs --copyright-holder=MkDocs --msgid-bugs-address='https://github.com/mkdocs/mkdocs/issues' --no-wrap --version="$(hatch version)" --mapping-file mkdocs/themes/babel.cfg --output-file mkdocs/themes/mkdocs/messages.pot mkdocs/themes/mkdocs
|
||||||
```
|
```
|
||||||
|
|
||||||
The updated `pot` file should be included in a PR with the updated template.
|
The updated `pot` file should be included in a PR with the updated template.
|
||||||
|
|||||||
92
pyproject.toml
Normal file
92
pyproject.toml
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
[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.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"]
|
||||||
|
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.version]
|
||||||
|
path = "mkdocs/__init__.py"
|
||||||
|
|
||||||
|
[tool.hatch.build]
|
||||||
|
artifacts = ["/mkdocs/**/*.mo"]
|
||||||
|
[tool.hatch.build.targets.sdist]
|
||||||
|
include = ["/mkdocs"]
|
||||||
|
[tool.hatch.build.targets.wheel]
|
||||||
|
exclude = ["/mkdocs/tests/integration", "*.po", "*.pot", "babel.cfg"]
|
||||||
|
|
||||||
|
[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
|
||||||
16
setup.cfg
16
setup.cfg
@@ -1,16 +0,0 @@
|
|||||||
[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
|
|
||||||
92
setup.py
Executable file → Normal file
92
setup.py
Executable file → Normal file
@@ -1,95 +1,13 @@
|
|||||||
#!/usr/bin/env python
|
"""Installation using setup.py is no longer supported.
|
||||||
|
Use `python -m pip install .` instead."""
|
||||||
|
|
||||||
from setuptools import setup
|
|
||||||
import re
|
|
||||||
import os
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from setuptools import setup
|
||||||
|
|
||||||
with open('README.md') as f:
|
sys.exit(__doc__)
|
||||||
long_description = f.read()
|
|
||||||
|
|
||||||
|
|
||||||
def get_version(package):
|
|
||||||
"""Return package version as listed in `__version__` in `init.py`."""
|
|
||||||
with open(os.path.join(package, '__init__.py')) as f:
|
|
||||||
init_py = f.read()
|
|
||||||
return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)
|
|
||||||
|
|
||||||
|
|
||||||
def get_packages(package):
|
|
||||||
"""Return root package and all sub-packages."""
|
|
||||||
return [dirpath
|
|
||||||
for dirpath, dirnames, filenames in os.walk(package)
|
|
||||||
if os.path.exists(os.path.join(dirpath, '__init__.py'))]
|
|
||||||
|
|
||||||
|
|
||||||
|
# Fake reference so GitHub still considers it a real package for statistics purposes.
|
||||||
setup(
|
setup(
|
||||||
name="mkdocs",
|
name="mkdocs",
|
||||||
version=get_version("mkdocs"),
|
|
||||||
url='https://www.mkdocs.org',
|
|
||||||
project_urls={
|
|
||||||
'Source': 'https://github.com/mkdocs/mkdocs',
|
|
||||||
},
|
|
||||||
license='BSD',
|
|
||||||
description='Project documentation with Markdown.',
|
|
||||||
long_description=long_description,
|
|
||||||
long_description_content_type='text/markdown',
|
|
||||||
author='Tom Christie',
|
|
||||||
author_email='tom@tomchristie.com', # SEE NOTE BELOW (*)
|
|
||||||
packages=get_packages("mkdocs"),
|
|
||||||
include_package_data=True,
|
|
||||||
package_data={'mkdocs': ['py.typed']},
|
|
||||||
install_requires=[
|
|
||||||
'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"',
|
|
||||||
],
|
|
||||||
extras_require={"i18n": ['babel>=2.9.0']},
|
|
||||||
python_requires='>=3.7',
|
|
||||||
entry_points={
|
|
||||||
'console_scripts': [
|
|
||||||
'mkdocs = mkdocs.__main__:cli',
|
|
||||||
],
|
|
||||||
'mkdocs.themes': [
|
|
||||||
'mkdocs = mkdocs.themes.mkdocs',
|
|
||||||
'readthedocs = mkdocs.themes.readthedocs',
|
|
||||||
],
|
|
||||||
'mkdocs.plugins': [
|
|
||||||
'search = mkdocs.contrib.search:SearchPlugin',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
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',
|
|
||||||
],
|
|
||||||
zip_safe=False,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# (*) Please direct queries to the discussion group:
|
|
||||||
# https://groups.google.com/forum/#!forum/mkdocs
|
|
||||||
|
|||||||
3
tox.ini
3
tox.ini
@@ -1,4 +1,5 @@
|
|||||||
[tox]
|
[tox]
|
||||||
|
isolated_build = true
|
||||||
envlist =
|
envlist =
|
||||||
py{37,38,39,310,py3}-{unittests,min-req,integration,integration-no-babel},
|
py{37,38,39,310,py3}-{unittests,min-req,integration,integration-no-babel},
|
||||||
black, isort, flake8, markdown-lint, linkchecker, jshint, csslint, nobabel, codespell
|
black, isort, flake8, markdown-lint, linkchecker, jshint, csslint, nobabel, codespell
|
||||||
@@ -19,7 +20,7 @@ commands=
|
|||||||
[testenv:black]
|
[testenv:black]
|
||||||
deps=black
|
deps=black
|
||||||
skip_install=true
|
skip_install=true
|
||||||
commands={envbindir}/black -l100 -tpy37 --skip-string-normalization mkdocs
|
commands={envbindir}/black mkdocs
|
||||||
|
|
||||||
[testenv:isort]
|
[testenv:isort]
|
||||||
deps=isort
|
deps=isort
|
||||||
|
|||||||
Reference in New Issue
Block a user