Skip to content

Commit 16bb437

Browse files
authored
Modernized metadata (#4341)
* Revert "Revert "Switched to new build and publish workflow (#4337)" (#4340)" This reverts commit 1a9bc1d. * Create setup.py * update
1 parent 209b653 commit 16bb437

File tree

5 files changed

+72
-80
lines changed

5 files changed

+72
-80
lines changed

.github/workflows/publish.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ jobs:
4646
python-version: ${{ env.PYTHON_VERSION }}
4747

4848
- name: Set up Python dependencies
49-
run: pip install --upgrade setuptools wheel twine
49+
run: pip install --upgrade build twine
5050

5151
- name: Build Python package
52-
run: python setup.py build sdist bdist_wheel --universal
52+
run: python -m build
5353

5454
- name: Publish Python package
5555
env:

Dockerfile

+1-2
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,10 @@ WORKDIR /tmp
3232

3333
# Copy files necessary for build
3434
COPY material material
35-
COPY MANIFEST.in MANIFEST.in
3635
COPY package.json package.json
3736
COPY README.md README.md
3837
COPY requirements.txt requirements.txt
39-
COPY setup.py setup.py
38+
COPY pyproject.toml pyproject.toml
4039

4140
# Perform build and cleanup artifacts and caches
4241
RUN \

MANIFEST.in

-11
This file was deleted.

pyproject.toml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
[build-system]
2+
requires = ["hatchling", "hatch-requirements-txt", "hatch-nodejs-version"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "mkdocs-material"
7+
dynamic = [
8+
"version",
9+
"dependencies",
10+
"license",
11+
"description",
12+
"authors",
13+
"keywords",
14+
"urls",
15+
]
16+
readme = "README.md"
17+
requires-python = ">=3.7"
18+
classifiers = [
19+
"Development Status :: 5 - Production/Stable",
20+
"Environment :: Web Environment",
21+
"License :: OSI Approved :: MIT License",
22+
"Programming Language :: JavaScript",
23+
"Programming Language :: Python",
24+
"Topic :: Documentation",
25+
"Topic :: Software Development :: Documentation",
26+
"Topic :: Text Processing :: Markup :: HTML",
27+
]
28+
29+
[project.entry-points."mkdocs.plugins"]
30+
search = "material.plugins.search.plugin:SearchPlugin"
31+
social = "material.plugins.social.plugin:SocialPlugin"
32+
tags = "material.plugins.tags.plugin:TagsPlugin"
33+
34+
[project.entry-points."mkdocs.themes"]
35+
material = "material"
36+
37+
[tool.hatch.version]
38+
source = "nodejs"
39+
40+
[tool.hatch.metadata.hooks.nodejs]
41+
fields = ["license", "description", "authors", "keywords", "urls"]
42+
43+
[tool.hatch.metadata.hooks.requirements_txt]
44+
filename = "requirements.txt"
45+
46+
[tool.hatch.build.targets.wheel]
47+
include = ["/material"]
48+
49+
[tool.hatch.build.targets.sdist]
50+
include = ["/material", "/package.json", "/requirements.txt"]
51+
exclude = ["/material/overrides"]

setup.py

+18-65
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,32 @@
1-
# Copyright (c) 2016-2022 Martin Donath <[email protected]>
1+
import sys
22

3-
# Permission is hereby granted, free of charge, to any person obtaining a copy
4-
# of this software and associated documentation files (the "Software"), to
5-
# deal in the Software without restriction, including without limitation the
6-
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7-
# sell copies of the Software, and to permit persons to whom the Software is
8-
# furnished to do so, subject to the following conditions:
3+
from setuptools import setup
94

10-
# The above copyright notice and this permission notice shall be included in
11-
# all copies or substantial portions of the Software.
5+
sys.stderr.write(
6+
"""
7+
===============================
8+
Unsupported installation method
9+
===============================
10+
This version of mkdocs-material no longer supports
11+
installation with `python setup.py install`.
1212
13-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15-
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18-
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19-
# IN THE SOFTWARE.
13+
Please use `python -m pip install .` instead.
14+
"""
15+
)
16+
sys.exit(1)
2017

21-
import json
22-
from setuptools import setup, find_packages
2318

24-
# Load package.json contents
25-
with open("package.json") as f:
26-
package = json.load(f)
19+
# The below code will never execute, however GitHub is particularly
20+
# picky about where it finds Python packaging metadata.
21+
# See: https://github.com/github/feedback/discussions/6456
2722

28-
# Load list of dependencies
2923
with open("requirements.txt") as f:
3024
install_requires = [
3125
line for line in f.read().split("\n")
3226
if line and not line.startswith("#")
3327
]
3428

35-
# Load README contents
36-
with open("README.md", encoding = "utf-8") as f:
37-
long_description = f.read()
38-
39-
# Package description
4029
setup(
41-
name = "mkdocs-material",
42-
version = package["version"],
43-
url = package["homepage"],
44-
project_urls = {
45-
"Source": "https://github.com/squidfunk/mkdocs-material",
46-
},
47-
license = package["license"],
48-
description = package["description"],
49-
long_description = long_description,
50-
long_description_content_type = "text/markdown",
51-
author = package["author"]["name"],
52-
author_email = package["author"]["email"],
53-
keywords = package["keywords"],
54-
classifiers = [
55-
"Development Status :: 5 - Production/Stable",
56-
"Environment :: Web Environment",
57-
"License :: OSI Approved :: MIT License",
58-
"Programming Language :: JavaScript",
59-
"Programming Language :: Python",
60-
"Topic :: Documentation",
61-
"Topic :: Software Development :: Documentation",
62-
"Topic :: Text Processing :: Markup :: HTML"
63-
],
64-
packages = find_packages(exclude = ["src", "src.*"]),
65-
include_package_data = True,
66-
install_requires = install_requires,
67-
python_requires='>=3.7',
68-
entry_points = {
69-
"mkdocs.themes": [
70-
"material = material"
71-
],
72-
"mkdocs.plugins": [
73-
"search = material.plugins.search.plugin:SearchPlugin",
74-
"social = material.plugins.social.plugin:SocialPlugin",
75-
"tags = material.plugins.tags.plugin:TagsPlugin"
76-
]
77-
},
78-
zip_safe = False
30+
name="mkdocs-material",
31+
install_requires=install_requires,
7932
)

0 commit comments

Comments
 (0)