diff --git a/.gitignore b/.gitignore index 497d09cec..cb6bfa6a1 100644 --- a/.gitignore +++ b/.gitignore @@ -58,13 +58,13 @@ target/ tools/emoji.md -site/* +site/ -tools/tags/* +tools/tags/ tmp* -node_modules/* +node_modules/ manifest*.json *.dic diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index b8640124e..000000000 --- a/MANIFEST.in +++ /dev/null @@ -1,17 +0,0 @@ -recursive-include pymdownx *.py -recursive-include tests *.txt *.html *.yml *.py *.css -recursive-include docs/src/markdown *.md *.png *.gif *.html -recursive-include docs/theme *.js *.css *.html *.svg *.txt -recursive-include requirements *.txt -recursive-exclude site * -include .dictionary -include mkdocs.yml -include setup.py -include setup.cfg -include run_tests.py -include tox.ini -include .coveragerc -include LICENSE.md -include README.md -include MANIFEST.in -include pyproject.toml diff --git a/docs/src/markdown/.snippets/abbr.txt b/docs/src/markdown/.snippets/abbr.md similarity index 100% rename from docs/src/markdown/.snippets/abbr.txt rename to docs/src/markdown/.snippets/abbr.md diff --git a/docs/src/markdown/.snippets/critic-accept-example.txt b/docs/src/markdown/.snippets/critic-accept-example.txt deleted file mode 100644 index 57adc97a2..000000000 --- a/docs/src/markdown/.snippets/critic-accept-example.txt +++ /dev/null @@ -1 +0,0 @@ -

Here is some Markdown. I am adding this here. Here is some more text. And here is even more text that I am adding. Paragraph was deleted and replaced with some spaces.

Spaces were removed and a paragraph was added.

And here is a comment on some text. Substitutions are great!

General block handling.

\ No newline at end of file diff --git a/docs/src/markdown/.snippets/critic-preview-example.txt b/docs/src/markdown/.snippets/critic-preview-example.txt deleted file mode 100644 index b2b276fb3..000000000 --- a/docs/src/markdown/.snippets/critic-preview-example.txt +++ /dev/null @@ -1 +0,0 @@ -

Here is some incorrect Markdown. I am adding this here. Here is some more text that I am removingtext. And here is even more text that I am adding.  Paragraph was deleted and replaced with some spaces.

 

Spaces were removed and a paragraph was added.

And here is a comment on some textThis works quite well. I just wanted to comment on it.. Substitutions isare great!

General block handling.

\ No newline at end of file diff --git a/docs/src/markdown/.snippets/links.txt b/docs/src/markdown/.snippets/links.md similarity index 100% rename from docs/src/markdown/.snippets/links.txt rename to docs/src/markdown/.snippets/links.md diff --git a/docs/src/markdown/.snippets/refs.md b/docs/src/markdown/.snippets/refs.md new file mode 100644 index 000000000..a3583e700 --- /dev/null +++ b/docs/src/markdown/.snippets/refs.md @@ -0,0 +1,4 @@ +--8<-- +links.md +abbr.md +--8<-- diff --git a/docs/src/markdown/.snippets/refs.txt b/docs/src/markdown/.snippets/refs.txt deleted file mode 100644 index 1715a5c14..000000000 --- a/docs/src/markdown/.snippets/refs.txt +++ /dev/null @@ -1,4 +0,0 @@ ---8<-- -links.txt -abbr.txt ---8<-- diff --git a/docs/src/markdown/.snippets/uml.txt b/docs/src/markdown/.snippets/uml.md similarity index 100% rename from docs/src/markdown/.snippets/uml.txt rename to docs/src/markdown/.snippets/uml.md diff --git a/docs/src/markdown/extensions/emoji.md b/docs/src/markdown/extensions/emoji.md index 97e84047d..5f8ae29be 100644 --- a/docs/src/markdown/extensions/emoji.md +++ b/docs/src/markdown/extensions/emoji.md @@ -520,5 +520,3 @@ Option | Type | Default | Description } } ``` - ---8<-- "refs.txt" diff --git a/docs/src/markdown/extensions/escapeall.md b/docs/src/markdown/extensions/escapeall.md index 7c3b3e7d2..e37b8199e 100644 --- a/docs/src/markdown/extensions/escapeall.md +++ b/docs/src/markdown/extensions/escapeall.md @@ -57,5 +57,3 @@ Option | Type | Default | Description ----------- | ---- | --------------- | ---------- `hardbreak` | bool | `#!py3 False` | Escaped newlines will be hard breaks: `#!html
`. `nbsp` | bool | `#!py3 False` | Escaped spaces will be non-breaking spaces: `#!html  `. - ---8<-- "links.txt" diff --git a/docs/src/markdown/extensions/keys.md b/docs/src/markdown/extensions/keys.md index f6d05dd52..19fef301c 100644 --- a/docs/src/markdown/extensions/keys.md +++ b/docs/src/markdown/extensions/keys.md @@ -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" diff --git a/docs/src/markdown/extensions/saneheaders.md b/docs/src/markdown/extensions/saneheaders.md index e8136f5f7..052df0c2f 100644 --- a/docs/src/markdown/extensions/saneheaders.md +++ b/docs/src/markdown/extensions/saneheaders.md @@ -36,5 +36,3 @@ With SaneHeaders, only the first is a header: ##Not a Header ``` - ---8<-- "links.txt" diff --git a/docs/src/markdown/extensions/striphtml.md b/docs/src/markdown/extensions/striphtml.md index 0e68e5006..378bb78cd 100644 --- a/docs/src/markdown/extensions/striphtml.md +++ b/docs/src/markdown/extensions/striphtml.md @@ -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" diff --git a/docs/src/markdown/extensions/tabbed.md b/docs/src/markdown/extensions/tabbed.md index 6389e03f7..a4a1031bb 100644 --- a/docs/src/markdown/extensions/tabbed.md +++ b/docs/src/markdown/extensions/tabbed.md @@ -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" diff --git a/docs/src/markdown/extensions/tilde.md b/docs/src/markdown/extensions/tilde.md index a55e35b8d..b8d3b82e4 100644 --- a/docs/src/markdown/extensions/tilde.md +++ b/docs/src/markdown/extensions/tilde.md @@ -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" diff --git a/docs/src/markdown/extras/mermaid.md b/docs/src/markdown/extras/mermaid.md index 657b6e684..2c46b2542 100644 --- a/docs/src/markdown/extras/mermaid.md +++ b/docs/src/markdown/extras/mermaid.md @@ -488,5 +488,3 @@ graph TD C -->|One| D[Result 1] C -->|Two| E[Result 2] ``` - ---8<-- "links.txt" diff --git a/docs/src/markdown/extras/slugs.md b/docs/src/markdown/extras/slugs.md index 9e4007620..5e57a6b7e 100644 --- a/docs/src/markdown/extras/slugs.md +++ b/docs/src/markdown/extras/slugs.md @@ -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" diff --git a/docs/src/mkdocs.yml b/docs/src/mkdocs.yml index 757a14ef1..86e828d19 100644 --- a/docs/src/mkdocs.yml +++ b/docs/src/mkdocs.yml @@ -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" diff --git a/hatch_build.py b/hatch_build.py new file mode 100644 index 000000000..a55213ccb --- /dev/null +++ b/hatch_build.py @@ -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", + ] diff --git a/mkdocs.yml b/mkdocs.yml index 06182fca5..a48726ba0 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -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" diff --git a/pyproject.toml b/pyproject.toml index 285367ae3..dbd3f0d51 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 21934a22d..000000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[metadata] -license_file = LICENSE.md diff --git a/setup.py b/setup.py deleted file mode 100644 index fb128e383..000000000 --- a/setup.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -"""Setup pymdown-extensions.""" - -from setuptools import setup, find_packages -import os - - -def get_version(): - """Get version and version_info without importing the entire module.""" - - import importlib.util - - path = os.path.join(os.path.dirname(__file__), 'pymdownx', '__meta__.py') - spec = importlib.util.spec_from_file_location("__meta__", path) - module = importlib.util.module_from_spec(spec) - spec.loader.exec_module(module) - vi = module.__version_info__ - return vi._get_canonical(), vi._get_dev_status() - - -def get_requirements(req): - """Load list of dependencies.""" - - install_requires = [] - with open(req) as f: - for line in f: - if not line.startswith("#"): - install_requires.append(line.strip()) - return install_requires - - -def get_description(): - """Get long description.""" - - with open("README.md", 'r') as f: - desc = f.read() - return desc - - -VER, DEVSTATUS = get_version() - - -setup( - name='pymdown-extensions', - version=VER, - keywords='markdown extensions', - description='Extension pack for Python Markdown.', - long_description=get_description(), - long_description_content_type='text/markdown', - author='Isaac Muse', - author_email='Isaac.Muse@gmail.com', - python_requires='>=3.7', - url='https://github.com/facelessuser/pymdown-extensions', - packages=find_packages(exclude=['tools', 'test*']), - install_requires=get_requirements("requirements/project.txt"), - license='MIT License', - classifiers=[ - 'Development Status :: %s' % DEVSTATUS, - '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', - ] -) diff --git a/tox.ini b/tox.ini index 4027aa6ee..45b1a203a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,4 +1,5 @@ [tox] +isolated_build = true envlist = {py37,py38,py39,py310}, lint, documents