Skip to content

Commit 4e5be66

Browse files
authored
🔧 MAINTAIN: Move from setuptools to flit (#208)
1 parent 7748e13 commit 4e5be66

File tree

11 files changed

+117
-177
lines changed

11 files changed

+117
-177
lines changed

.github/workflows/tests.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
push:
88
branches: [master]
99
tags:
10-
- 'v*'
10+
- "v[0-9]+.[0-9]+.[0-9]+*"
1111
pull_request:
1212
schedule:
1313
- cron: '0 0 * * 0' # every week
@@ -113,19 +113,19 @@ jobs:
113113
steps:
114114
- name: Checkout source
115115
uses: actions/checkout@v2
116-
- name: Set up Python 3.7
116+
- name: Set up Python 3.8
117117
uses: actions/setup-python@v2
118118
with:
119-
python-version: '3.7'
120-
- name: Build package
119+
python-version: '3.8'
120+
- name: install flit
121121
run: |
122-
pip install build
123-
python -m build
124-
- name: Publish
125-
uses: pypa/gh-action-pypi-publish@v1.1.0
126-
with:
127-
user: __token__
128-
password: ${{ secrets.PYPI_KEY }}
122+
pip install flit~=3.4
123+
- name: Build and publish
124+
run: |
125+
flit publish
126+
env:
127+
FLIT_USERNAME: __token__
128+
FLIT_PASSWORD: ${{ secrets.PYPI_KEY }}
129129

130130
allgood:
131131
runs-on: ubuntu-latest

.pre-commit-config.yaml

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,26 @@ exclude: >
1616
repos:
1717

1818
- repo: https://github.com/pre-commit/pre-commit-hooks
19-
rev: v3.4.0
19+
rev: v4.2.0
2020
hooks:
2121
- id: check-json
2222
- id: check-yaml
2323
- id: end-of-file-fixer
2424
- id: trailing-whitespace
2525

26-
- repo: https://github.com/mgedmin/check-manifest
27-
rev: "0.46"
28-
hooks:
29-
- id: check-manifest
30-
args: [--no-build-isolation]
31-
additional_dependencies: [setuptools>=46.4.0]
32-
33-
# this is not used for now,
34-
# since it converts markdown-it-py to markdown_it_py and removes comments
35-
# - repo: https://github.com/asottile/setup-cfg-fmt
36-
# rev: v1.17.0
37-
# hooks:
38-
# - id: setup-cfg-fmt
39-
4026
- repo: https://github.com/psf/black
41-
rev: 20.8b1
27+
rev: 22.3.0
4228
hooks:
4329
- id: black
4430

4531
- repo: https://gitlab.com/pycqa/flake8
46-
rev: 3.9.1
32+
rev: 3.9.2
4733
hooks:
4834
- id: flake8
4935
additional_dependencies: [flake8-bugbear==21.3.1]
5036

5137
- repo: https://github.com/pre-commit/mirrors-mypy
52-
rev: v0.812
38+
rev: v0.942
5339
hooks:
5440
- id: mypy
5541
additional_dependencies: [attrs]

MANIFEST.in

Lines changed: 0 additions & 24 deletions
This file was deleted.

docs/contributing.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ It can be setup by:
2929
Editors like VS Code also have automatic code reformat utilities, which can adhere to this standard.
3030

3131
All functions and class methods should be annotated with types and include a docstring.
32-
The preferred docstring format is outlined in `markdown-it-py/docstring.fmt.mustache` and can be used automatically with the [autodocstring](https://marketplace.visualstudio.com/items?itemName=njpwerner.autodocstring) VS Code extension.
3332

3433
## Testing
3534

docstring.fmt.mustache

Lines changed: 0 additions & 20 deletions
This file was deleted.

markdown_it/token.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def __getattr__(self, name):
173173
return getattr(self.opening, name)
174174

175175
def attrGet(self, name: str) -> None | str | int | float:
176-
""" Get the value of attribute `name`, or null if it does not exist."""
176+
"""Get the value of attribute `name`, or null if it does not exist."""
177177
return self.opening.attrGet(name)
178178

179179

markdown_it/tree.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def _attribute_token(self) -> Token:
276276

277277
@property
278278
def tag(self) -> str:
279-
"""html tag name, e.g. \"p\""""
279+
"""html tag name, e.g. \"p\" """
280280
return self._attribute_token().tag
281281

282282
@property

pyproject.toml

Lines changed: 96 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,100 @@
11
[build-system]
2-
requires = ["setuptools>=46.4.0", "wheel"]
3-
build-backend = "setuptools.build_meta"
2+
requires = ["flit_core >=3.4,<4"]
3+
build-backend = "flit_core.buildapi"
4+
5+
[project]
6+
name = "markdown-it-py"
7+
dynamic = ["version"]
8+
description = "Python port of markdown-it. Markdown parsing, done right!"
9+
readme = "README.md"
10+
authors = [{name = "Chris Sewell", email = "chrisj_sewell@hotmail.com"}]
11+
license = {file = "LICENSE"}
12+
classifiers = [
13+
"Development Status :: 5 - Production/Stable",
14+
"Intended Audience :: Developers",
15+
"License :: OSI Approved :: MIT License",
16+
"Programming Language :: Python :: 3",
17+
"Programming Language :: Python :: 3.7",
18+
"Programming Language :: Python :: 3.8",
19+
"Programming Language :: Python :: 3.9",
20+
"Programming Language :: Python :: 3.10",
21+
"Programming Language :: Python :: Implementation :: CPython",
22+
"Programming Language :: Python :: Implementation :: PyPy",
23+
"Topic :: Software Development :: Libraries :: Python Modules",
24+
"Topic :: Text Processing :: Markup",
25+
]
26+
keywords = ["markdown", "lexer", "parser", "commonmark", "markdown-it"]
27+
requires-python = ">=3.7"
28+
dependencies = [
29+
"attrs>=19,<22",
30+
"mdurl~=0.1",
31+
"typing_extensions>=3.7.4;python_version<'3.8'",
32+
]
33+
34+
[project.urls]
35+
Homepage = "https://github.com/executablebooks/markdown-it-py"
36+
Documentation = "https://markdown-it-py.readthedocs.io"
37+
38+
[project.optional-dependencies]
39+
code_style = ["pre-commit==2.6"]
40+
compare = [
41+
"commonmark~=0.9.1",
42+
"markdown~=3.3.6",
43+
"mistletoe~=0.8.1",
44+
"mistune~=2.0.2",
45+
"panflute~=2.1.3",
46+
]
47+
linkify = ["linkify-it-py~=1.0"]
48+
plugins = ["mdit-py-plugins"]
49+
rtd = [
50+
"myst-nb==0.13.0a1",
51+
"pyyaml",
52+
"sphinx>=2,<4",
53+
"sphinx-copybutton",
54+
"sphinx-panels~=0.4.0",
55+
"sphinx_book_theme",
56+
]
57+
testing = [
58+
"coverage",
59+
"pytest",
60+
"pytest-cov",
61+
"pytest-regressions",
62+
]
63+
benchmarking = [
64+
"psutil",
65+
"pytest",
66+
"pytest-benchmark~=3.2",
67+
]
68+
profiling = ["gprof2dot"]
69+
70+
[project.scripts]
71+
markdown-it = "markdown_it.cli.parse:main"
72+
73+
[tool.flit.module]
74+
name = "markdown_it"
75+
76+
[tool.flit.sdist]
77+
exclude = [
78+
"docs/",
79+
"tests/",
80+
"benchmarking/"
81+
]
82+
83+
[tool.mypy]
84+
show_error_codes = true
85+
warn_unused_ignores = true
86+
warn_redundant_casts = true
87+
no_implicit_optional = true
88+
strict_equality = true
89+
implicit_reexport = false
90+
91+
[[tool.mypy.overrides]]
92+
module = ["tests.test_plugins.*", "markdown.*"]
93+
ignore_errors = true
94+
95+
[[tool.mypy.overrides]]
96+
module = ["markdown.*"]
97+
ignore_missing_imports = true
498

599
[tool.pytest.ini_options]
6100
xfail_strict = true

setup.cfg

Lines changed: 0 additions & 93 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 6 deletions
This file was deleted.

tox.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,7 @@ commands =
5656
gprof2dot -f pstats -o "{toxworkdir}/prof/output.dot" "{toxworkdir}/prof/output.pstats"
5757
dot -Tsvg -o "{toxworkdir}/prof/output.svg" "{toxworkdir}/prof/output.dot"
5858
python -c 'import pathlib; print("profiler svg output under file://\{0\}".format(pathlib.Path(r"{toxworkdir}") / "prof" / "output.svg"))'
59+
60+
[flake8]
61+
max-line-length = 100
62+
extend-ignore = E203

0 commit comments

Comments
 (0)