Skip to content
This repository was archived by the owner on Oct 16, 2025. It is now read-only.

Commit c668baa

Browse files
committed
maintain: set PEP621 metadata. move to src-layout
1 parent 86217c6 commit c668baa

File tree

11 files changed

+179
-200
lines changed

11 files changed

+179
-200
lines changed

.bumpversion.cfg

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[bumpversion]
2+
commit = True
3+
tag = True
4+
tag_name = v{new_version}
5+
current_version = 1.0.0
6+
7+
[bumpversion:file:pyproject.toml]
8+
search = version = "{current_version}" # DO NOT EDIT THIS LINE MANUALLY. LET bump2version UTILITY DO IT
9+
replace = version = "{new_version}" # DO NOT EDIT THIS LINE MANUALLY. LET bump2version UTILITY DO IT
10+
11+
[bumpversion:file:src/mdformat_tables/__init__.py]
12+
search = __version__ = "{current_version}"
13+
replace = __version__ = "{new_version}"

.flake8

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[flake8]
2+
max-line-length = 88
3+
max-complexity = 10
4+
extend-ignore =
5+
# E203: Whitespace before ':' (violates PEP8 and black style)
6+
E203,
7+
# A005: A module is shadowing a Python builtin module
8+
A005,
9+
extend-exclude = */site-packages/*

.github/workflows/tests.yaml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
tags: [ 'v[0-9]+.[0-9]+.[0-9]+*' ]
7+
pull_request:
8+
branches: [ master ]
9+
10+
jobs:
11+
12+
pre-commit:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-python@v5
18+
with:
19+
python-version: '3.x'
20+
- name: Run pre-commit
21+
run: |
22+
pipx run pre-commit run --all-files
23+
24+
tests:
25+
runs-on: ${{ matrix.os }}
26+
strategy:
27+
matrix:
28+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
29+
os: [ubuntu-latest, macos-latest, windows-latest]
30+
31+
steps:
32+
- uses: actions/checkout@v4
33+
34+
- name: Set up Python ${{ matrix.python-version }}
35+
uses: actions/setup-python@v5
36+
with:
37+
python-version: ${{ matrix.python-version }}
38+
39+
- name: Installation
40+
run: |
41+
pip install -r tests/requirements.txt .
42+
43+
- name: Run pytest
44+
run: |
45+
pytest --cov --cov-fail-under=100
46+
47+
pre-commit-hook:
48+
runs-on: ubuntu-latest
49+
50+
steps:
51+
- uses: actions/checkout@v4
52+
- uses: actions/setup-python@v5
53+
with:
54+
python-version: '3.x'
55+
56+
- name: Installation
57+
run: |
58+
pip install pre-commit
59+
pip install .
60+
61+
- name: run pre-commit with plugin
62+
run: |
63+
pre-commit run --config .pre-commit-test.yaml --all-files --verbose --show-diff-on-failure
64+
65+
publish:
66+
name: Publish to PyPi
67+
needs: [pre-commit, tests, pre-commit-hook]
68+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
69+
runs-on: ubuntu-latest
70+
steps:
71+
- uses: actions/checkout@v4
72+
- uses: actions/setup-python@v5
73+
with:
74+
python-version: '3.x'
75+
- name: Install build and publish tools
76+
run: |
77+
pip install build twine
78+
- name: Build and check
79+
run: |
80+
rm -rf dist/ && python -m build
81+
twine check --strict dist/*
82+
- name: Publish
83+
run: |
84+
twine upload dist/*
85+
env:
86+
TWINE_USERNAME: __token__
87+
TWINE_PASSWORD: ${{ secrets.PYPI_KEY }}

.github/workflows/tests.yml

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

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,8 @@ dmypy.json
128128
# Pyre type checker
129129
.pyre/
130130

131+
# IntelliJ
132+
.idea/
133+
134+
# VS Code
131135
.vscode/

README.md

Lines changed: 2 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# mdformat-tables
22

33
[![Build Status][ci-badge]][ci-link]
4-
[![codecov.io][cov-badge]][cov-link]
54
[![PyPI version][pypi-badge]][pypi-link]
65

76
An [mdformat](https://github.com/hukkin/mdformat) plugin for rendering tables.
@@ -26,56 +25,7 @@ to:
2625

2726
For further examples, see tests/fixtures.md in the repository.
2827

29-
## Development
30-
31-
This package utilises [flit](https://flit.readthedocs.io) as the build engine, and [tox](https://tox.readthedocs.io) for test automation.
32-
33-
To install these development dependencies:
34-
35-
```bash
36-
pip install flit tox
37-
```
38-
39-
To run the tests:
40-
41-
```bash
42-
tox
43-
```
44-
45-
To run the code formatting and style checks:
46-
47-
```bash
48-
tox -e py311-pre-commit
49-
```
50-
51-
or directly
52-
53-
```bash
54-
pip install pre-commit
55-
pre-commit run --all
56-
```
57-
58-
To run the pre-commit hook test:
59-
60-
```bash
61-
tox -e py311-hook
62-
```
63-
64-
## Publish to PyPi
65-
66-
Either use flit directly:
67-
68-
```bash
69-
flit publish
70-
```
71-
72-
or trigger the GitHub Action job, by creating a release with a tag equal to the version, e.g. `v0.0.1`.
73-
74-
Note, this requires generating an API key on PyPi and adding it to the repository `Settings/Secrets`, under the name `PYPI_KEY`.
75-
76-
[ci-badge]: https://github.com/hukkin/mdformat-tables/actions/workflows/tests.yml/badge.svg?branch=master
77-
[ci-link]: https://github.com/hukkin/mdformat/actions?query=workflow%3ACI+branch%3Amaster+event%3Apush
78-
[cov-badge]: https://codecov.io/gh/hukkin/mdformat-tables/branch/master/graph/badge.svg
79-
[cov-link]: https://codecov.io/gh/hukkin/mdformat-tables
28+
[ci-badge]: https://github.com/hukkin/mdformat-tables/actions/workflows/tests.yaml/badge.svg?branch=master
29+
[ci-link]: https://github.com/hukkin/mdformat-tables/actions?query=workflow%3ACI+branch%3Amaster+event%3Apush
8030
[pypi-badge]: https://img.shields.io/pypi/v/mdformat-tables.svg
8131
[pypi-link]: https://pypi.org/project/mdformat-tables

pyproject.toml

Lines changed: 61 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,37 @@
11
[build-system]
2-
requires = ["flit_core >=2,<4"]
2+
requires = ["flit_core>=3.2.0,<4"]
33
build-backend = "flit_core.buildapi"
44

5-
[tool.flit.metadata]
6-
module = "mdformat_tables"
7-
author = "Chris Sewell"
8-
author-email = "[email protected]"
9-
maintainer = "Taneli Hukkinen"
10-
maintainer-email = "[email protected]"
11-
description-file = "README.md"
12-
home-page = "https://github.com/hukkin/mdformat-tables"
5+
[project]
6+
name = "mdformat-tables"
7+
version = "1.0.0" # DO NOT EDIT THIS LINE MANUALLY. LET bump2version UTILITY DO IT
8+
authors = [
9+
{ name = "Chris Sewell", email = "[email protected]"},
10+
]
11+
maintainers = [
12+
{ name = "Taneli Hukkinen", email = "[email protected]"},
13+
]
14+
description = "Mdformat plugin for rendering tables"
15+
readme = "README.md"
16+
license = { file = "LICENSE" }
17+
requires-python = ">=3.9"
18+
dependencies = [
19+
'mdformat >=0.7.19,<0.8.0',
20+
'wcwidth >=0.2.13',
21+
]
1322
classifiers = [
14-
"Intended Audience :: Developers",
1523
"License :: OSI Approved :: MIT License",
16-
"Programming Language :: Python :: 3",
17-
"Topic :: Software Development :: Libraries :: Python Modules",
24+
"Topic :: Documentation",
25+
"Topic :: Text Processing :: Markup",
1826
]
19-
keywords = "mdformat,markdown,markdown-it"
20-
21-
requires-python=">=3.9"
22-
requires=["mdformat>=0.7.19,<0.8.0", "wcwidth>=0.2.13"]
27+
keywords = ["mdformat", "markdown", "formatter", "gfm"]
2328

24-
[tool.flit.metadata.requires-extra]
25-
test = [
26-
"pytest~=6.0",
27-
"coverage",
28-
"pytest-cov",
29-
]
29+
[project.urls]
30+
"Homepage" = "https://github.com/hukkin/mdformat-tables"
3031

31-
[tool.flit.entrypoints."mdformat.parser_extension"]
32-
tables = "mdformat_tables"
32+
[project.entry-points."mdformat.parser_extension"]
33+
"tables" = "mdformat_tables"
3334

34-
[tool.flit.sdist]
35-
include = []
36-
exclude = [".github/", "tests/"]
3735

3836
[tool.isort]
3937
# Force imports to be sorted by module, independent of import type
@@ -46,3 +44,39 @@ known_first_party = ["mdformat_tables", "tests"]
4644

4745
# Settings for Black compatibility
4846
profile = "black"
47+
48+
49+
[tool.pytest.ini_options]
50+
addopts = "--strict-markers --strict-config"
51+
xfail_strict = true
52+
53+
54+
[tool.tox]
55+
requires = ["tox>=4.21.1"]
56+
# Only run pytest envs when no args given to tox
57+
env_list = ["3.9", "3.10", "3.11", "3.12", "3.13"]
58+
59+
[tool.tox.env_run_base]
60+
description = "run tests under {base_python}"
61+
deps = [
62+
"-r tests/requirements.txt",
63+
]
64+
commands = [
65+
["pytest", { replace = "posargs", default = ["--cov", "--cov-fail-under", "100"], extend = true }],
66+
]
67+
68+
[tool.tox.env."pre-commit"]
69+
description = "run linters"
70+
skip_install = true
71+
deps = ["pre-commit"]
72+
commands = [
73+
["pre-commit", "run", { replace = "posargs", default = ["--all-files"], extend = true }],
74+
]
75+
76+
[tool.tox.env."hook"]
77+
description = "test unreleased changes via pre-commit hook"
78+
skip_install = true
79+
deps = ["pre-commit"]
80+
commands = [
81+
["pre-commit", "run", "--config", ".pre-commit-test.yaml", { replace = "posargs", default = ["--all-files", "--verbose", "--show-diff-on-failure"], extend = true }],
82+
]

mdformat_tables/__init__.py renamed to src/mdformat_tables/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
"""An mdformat plugin for rendering tables."""
2-
31
__version__ = "1.0.0"
42

53
from .plugin import ( # noqa: F401
File renamed without changes.

0 commit comments

Comments
 (0)