Skip to content

🔧 MAINTAIN: Move from setuptools to flit #208

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

Merged
merged 4 commits into from
Apr 14, 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
22 changes: 11 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
push:
branches: [master]
tags:
- 'v*'
- "v[0-9]+.[0-9]+.[0-9]+*"
pull_request:
schedule:
- cron: '0 0 * * 0' # every week
Expand Down Expand Up @@ -113,19 +113,19 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Build package
python-version: '3.8'
- name: install flit
run: |
pip install build
python -m build
- name: Publish
uses: pypa/gh-action-pypi-publish@v1.1.0
with:
user: __token__
password: ${{ secrets.PYPI_KEY }}
pip install flit~=3.4
- name: Build and publish
run: |
flit publish
env:
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.PYPI_KEY }}

allgood:
runs-on: ubuntu-latest
Expand Down
22 changes: 4 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,40 +16,26 @@ exclude: >
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
rev: v4.2.0
hooks:
- id: check-json
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/mgedmin/check-manifest
rev: "0.46"
hooks:
- id: check-manifest
args: [--no-build-isolation]
additional_dependencies: [setuptools>=46.4.0]

# this is not used for now,
# since it converts markdown-it-py to markdown_it_py and removes comments
# - repo: https://github.com/asottile/setup-cfg-fmt
# rev: v1.17.0
# hooks:
# - id: setup-cfg-fmt

- repo: https://github.com/psf/black
rev: 20.8b1
rev: 22.3.0
hooks:
- id: black

- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.1
rev: 3.9.2
hooks:
- id: flake8
additional_dependencies: [flake8-bugbear==21.3.1]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.812
rev: v0.942
hooks:
- id: mypy
additional_dependencies: [attrs]
24 changes: 0 additions & 24 deletions MANIFEST.in

This file was deleted.

1 change: 0 additions & 1 deletion docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ It can be setup by:
Editors like VS Code also have automatic code reformat utilities, which can adhere to this standard.

All functions and class methods should be annotated with types and include a docstring.
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.

## Testing

Expand Down
20 changes: 0 additions & 20 deletions docstring.fmt.mustache

This file was deleted.

2 changes: 1 addition & 1 deletion markdown_it/token.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def __getattr__(self, name):
return getattr(self.opening, name)

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


Expand Down
2 changes: 1 addition & 1 deletion markdown_it/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def _attribute_token(self) -> Token:

@property
def tag(self) -> str:
"""html tag name, e.g. \"p\""""
"""html tag name, e.g. \"p\" """
return self._attribute_token().tag

@property
Expand Down
98 changes: 96 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,100 @@
[build-system]
requires = ["setuptools>=46.4.0", "wheel"]
build-backend = "setuptools.build_meta"
requires = ["flit_core >=3.4,<4"]
build-backend = "flit_core.buildapi"

[project]
name = "markdown-it-py"
dynamic = ["version"]
description = "Python port of markdown-it. Markdown parsing, done right!"
readme = "README.md"
authors = [{name = "Chris Sewell", email = "chrisj_sewell@hotmail.com"}]
license = {file = "LICENSE"}
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Text Processing :: Markup",
]
keywords = ["markdown", "lexer", "parser", "commonmark", "markdown-it"]
requires-python = ">=3.7"
dependencies = [
"attrs>=19,<22",
"mdurl~=0.1",
"typing_extensions>=3.7.4;python_version<'3.8'",
]

[project.urls]
Homepage = "https://github.com/executablebooks/markdown-it-py"
Documentation = "https://markdown-it-py.readthedocs.io"

[project.optional-dependencies]
code_style = ["pre-commit==2.6"]
compare = [
"commonmark~=0.9.1",
"markdown~=3.3.6",
"mistletoe~=0.8.1",
"mistune~=2.0.2",
"panflute~=2.1.3",
]
linkify = ["linkify-it-py~=1.0"]
plugins = ["mdit-py-plugins"]
rtd = [
"myst-nb==0.13.0a1",
"pyyaml",
"sphinx>=2,<4",
"sphinx-copybutton",
"sphinx-panels~=0.4.0",
"sphinx_book_theme",
]
testing = [
"coverage",
"pytest",
"pytest-cov",
"pytest-regressions",
]
benchmarking = [
"psutil",
"pytest",
"pytest-benchmark~=3.2",
]
profiling = ["gprof2dot"]

[project.scripts]
markdown-it = "markdown_it.cli.parse:main"

[tool.flit.module]
name = "markdown_it"

[tool.flit.sdist]
exclude = [
"docs/",
"tests/",
"benchmarking/"
]

[tool.mypy]
show_error_codes = true
warn_unused_ignores = true
warn_redundant_casts = true
no_implicit_optional = true
strict_equality = true
implicit_reexport = false

[[tool.mypy.overrides]]
module = ["tests.test_plugins.*", "markdown.*"]
ignore_errors = true

[[tool.mypy.overrides]]
module = ["markdown.*"]
ignore_missing_imports = true

[tool.pytest.ini_options]
xfail_strict = true
93 changes: 0 additions & 93 deletions setup.cfg

This file was deleted.

6 changes: 0 additions & 6 deletions setup.py

This file was deleted.

4 changes: 4 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,7 @@ commands =
gprof2dot -f pstats -o "{toxworkdir}/prof/output.dot" "{toxworkdir}/prof/output.pstats"
dot -Tsvg -o "{toxworkdir}/prof/output.svg" "{toxworkdir}/prof/output.dot"
python -c 'import pathlib; print("profiler svg output under file://\{0\}".format(pathlib.Path(r"{toxworkdir}") / "prof" / "output.svg"))'

[flake8]
max-line-length = 100
extend-ignore = E203