Skip to content
Closed
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.

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",
]
51 changes: 48 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,52 @@
[build-system]
requires = [
"setuptools>=42",
"wheel"
"hatchling>=0.21.0",
]
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 = [

@facelessuser facelessuser Mar 20, 2022

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE TO SELF: not sure if the includes are all correct. Will need to double-check that we are including what we expect in the sdist and not what we don't.

"/docs/src/markdown",
"/docs/theme",
"/requirements/*.txt",
"/pymdownx",
"/tests",
"/.coveragerc",
"/.dictionary",
"/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