Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Hatch for build backend #1644

Merged
merged 4 commits into from
Apr 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ target/

tools/emoji.md

site/*
site/

tools/tags/*
tools/tags/

tmp*

node_modules/*
node_modules/

manifest*.json
*.dic
Expand Down
17 changes: 0 additions & 17 deletions MANIFEST.in

This file was deleted.

1 change: 0 additions & 1 deletion docs/src/markdown/.snippets/critic-accept-example.txt

This file was deleted.

1 change: 0 additions & 1 deletion docs/src/markdown/.snippets/critic-preview-example.txt

This file was deleted.

4 changes: 4 additions & 0 deletions docs/src/markdown/.snippets/refs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
--8<--
links.md
abbr.md
--8<--
4 changes: 0 additions & 4 deletions docs/src/markdown/.snippets/refs.txt

This file was deleted.

File renamed without changes.
2 changes: 0 additions & 2 deletions docs/src/markdown/extensions/emoji.md
Original file line number Diff line number Diff line change
Expand Up @@ -520,5 +520,3 @@ Option | Type | Default | Description
}
}
```

--8<-- "refs.txt"
2 changes: 0 additions & 2 deletions docs/src/markdown/extensions/escapeall.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,3 @@ Option | Type | Default | Description
----------- | ---- | --------------- | ----------
`hardbreak` | bool | `#!py3 False` | Escaped newlines will be hard breaks: `#!html <br>`.
`nbsp` | bool | `#!py3 False` | Escaped spaces will be non-breaking spaces: `#!html &nbsp;`.

--8<-- "links.txt"
2 changes: 0 additions & 2 deletions docs/src/markdown/extensions/keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -362,5 +362,3 @@ Option | Type | Default | Description
`class` | string | `#!py3 'keys'` | Defines a class(es) to apply to the HTML wrapper element.
`camel_case` | bool | `#!py3 False` | Allow the use of camel case for key names `PgUp` --> `pg-up`.
`key_map` | dict | `#!py3 {}` | Add additional keys to the key-map index or override output of existing outputs. See [Extending/Modifying Key-Map Index](#extendingmodifying-key-map-index) for more info.

--8<-- "links.txt"
2 changes: 0 additions & 2 deletions docs/src/markdown/extensions/saneheaders.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,3 @@ With SaneHeaders, only the first is a header:

##Not a Header
```

--8<-- "links.txt"
2 changes: 0 additions & 2 deletions docs/src/markdown/extensions/striphtml.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,3 @@ Option | Type | Default | Description
`strip_comments` | bool | `#!py3 True` | Strip HTML comments during post process.
`strip_js_on_attributes` | bool | `#!py3 True` | Strip JavaScript script attributes with the pattern on* during post process.
`strip_attributes` | [string] | `#!py3 []` | A list of tag attribute names to strip.

--8<-- "links.txt"
2 changes: 0 additions & 2 deletions docs/src/markdown/extensions/tabbed.md
Original file line number Diff line number Diff line change
Expand Up @@ -536,5 +536,3 @@ to some practical number.
Option | Type | Default | Description
----------------- | ---- | ------------- | -----------
`alternate_style` | bool | `#!py3 False` | Use the experimental, alternative style.

--8<-- "refs.txt"
2 changes: 0 additions & 2 deletions docs/src/markdown/extensions/tilde.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,3 @@ Option | Type | Default | Description
`smart_delete` | bool | `#!py3 True` | Use smart logic with delete characters.
`delete` | bool | `#!py3 True` | Enable delete feature.
`subscript` | bool | `#!py3 True` | Enable subscript feature.

--8<-- "links.txt"
2 changes: 0 additions & 2 deletions docs/src/markdown/extras/mermaid.md
Original file line number Diff line number Diff line change
Expand Up @@ -488,5 +488,3 @@ graph TD
C -->|One| D[Result 1]
C -->|Two| E[Result 2]
```

--8<-- "links.txt"
2 changes: 0 additions & 2 deletions docs/src/markdown/extras/slugs.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,3 @@ extension_configs = {

If you are using something like [MkDocs][mkdocs], check out our [FAQ](../faq.md#function-references-in-yaml) which gives
guidance on how to specify configurable functions in the YAML configuration.

--8<-- "refs.txt"
2 changes: 1 addition & 1 deletion docs/src/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ markdown_extensions:
- docs/src/markdown/.snippets
- LICENSE.md
auto_append:
- refs.txt
- refs.md
check_paths: true
- pymdownx.keys:
separator: "\uff0b"
Expand Down
52 changes: 52 additions & 0 deletions hatch_build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
"""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, "pymdownx", "__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",
]
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ markdown_extensions:
- docs/src/markdown/.snippets
- LICENSE.md
auto_append:
- refs.txt
- refs.md
check_paths: true
- pymdownx.keys:
separator: "\uff0b"
Expand Down
65 changes: 62 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,66 @@
[build-system]
requires = [
"setuptools>=42",
"wheel"
"hatchling>=0.21.1",
]
build-backend = "hatchling.build"

build-backend = "setuptools.build_meta"
[project]
name = "pymdown-extensions"
description = "Extension pack for Python Markdown."
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/pymdown-extensions"

[tool.hatch.version]
source = "code"
path = "pymdownx/__meta__.py"

[tool.hatch.build.targets.sdist]
include = [
"/docs/src/markdown/**/*.md",
"/docs/src/markdown/**/*.gif",
"/docs/src/markdown/**/*.png",
"/docs/src/markdown/dictionary/*.txt",
"/docs/theme/**/*.css",
"/docs/theme/**/*.js",
"/docs/theme/**/*.html",
"/docs/theme/**/*.css.map",
"/docs/theme/**/*.js.map",
"/requirements/*.txt",
"/pymdownx/**/*.py",
"/tests/**/*.txt",
"/tests/**/*.py",
"/tests/**/*.html",
"/tests/**/*.yml",
"/tests/**/*.css",
"/tests/**/*.png",
"/tools/__init__.py",
"/tools/pymdownx_md_render.py",
"/.pyspelling.yml",
"/.coveragerc",
"/mkdocs.yml",
"/run_tests.py",
"/tox.ini",
]

[tool.hatch.build.targets.wheel]
include = [
"/pymdownx",
]

[tool.hatch.metadata.hooks.custom]
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

74 changes: 0 additions & 74 deletions setup.py

This file was deleted.

1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[tox]
isolated_build = true
envlist =
{py37,py38,py39,py310}, lint, documents

Expand Down