Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from facelessuser/chore/hatchling
Use hatchling for build
- Loading branch information
Showing
10 changed files
with
121 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
"""Dynamically define some metadata.""" | ||
import os | ||
from hatchling.metadata.plugin.interface import MetadataHookInterface | ||
|
||
|
||
def get_version_dev_status(root): | ||
"""Get version_info without importing the entire module.""" | ||
|
||
import importlib.util | ||
|
||
path = os.path.join(root, "materialx", "__meta__.py") | ||
spec = importlib.util.spec_from_file_location("__meta__", path) | ||
module = importlib.util.module_from_spec(spec) | ||
spec.loader.exec_module(module) | ||
return module.__version_info__._get_dev_status() | ||
|
||
|
||
def get_requirements(root): | ||
"""Load list of dependencies.""" | ||
|
||
install_requires = [] | ||
with open(os.path.join(root, "requirements", "project.txt")) as f: | ||
for line in f: | ||
if not line.startswith("#"): | ||
install_requires.append(line.strip()) | ||
return install_requires | ||
|
||
|
||
class CustomMetadataHook(MetadataHookInterface): | ||
"""Our metadata hook.""" | ||
|
||
def update(self, metadata): | ||
"""See https://ofek.dev/hatch/latest/plugins/metadata-hook/ for more information.""" | ||
|
||
metadata["dependencies"] = get_requirements(self.root) | ||
metadata["classifiers"] = [ | ||
f"Development Status :: {get_version_dev_status(self.root)}", | ||
"Environment :: Console", | ||
"Intended Audience :: Developers", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Topic :: Internet :: WWW/HTTP :: Dynamic Content", | ||
"Topic :: Software Development :: Libraries :: Python Modules", | ||
"Topic :: Text Processing :: Filters", | ||
"Topic :: Text Processing :: Markup :: HTML", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,50 @@ | ||
[build-system] | ||
requires = [ | ||
"setuptools>=42", | ||
"wheel" | ||
"hatchling>=0.21.1", | ||
] | ||
build-backend = "hatchling.build" | ||
|
||
build-backend = "setuptools.build_meta" | ||
[project] | ||
name = "mkdocs-material-extensions" | ||
description = "Extension pack for Python Markdown and MkDocs Material." | ||
readme = "README.md" | ||
license = "MIT" | ||
requires-python = ">=3.7" | ||
authors = [ | ||
{ name = "Isaac Muse", email = "Isaac.Muse@gmail.com" }, | ||
] | ||
keywords = [ | ||
"extensions", | ||
"markdown", | ||
] | ||
dynamic = [ | ||
"classifiers", | ||
"dependencies", | ||
"version", | ||
] | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/facelessuser/mkdocs-material-extensions'" | ||
|
||
[tool.hatch.version] | ||
source = "code" | ||
path = "materialx/__meta__.py" | ||
|
||
[tool.hatch.build.targets.sdist] | ||
include = [ | ||
"/requirements/*.txt", | ||
"/materialx/**/*.py", | ||
"/tests/**/*.py", | ||
"/.pyspelling.yml", | ||
"/.coveragerc", | ||
"/tox.ini", | ||
"/LICENSE.md", | ||
"/changelog.md" | ||
] | ||
|
||
[tool.hatch.build.targets.wheel] | ||
include = [ | ||
"/materialx", | ||
] | ||
|
||
[tool.hatch.metadata.hooks.custom] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters