Skip to content

Commit 4cd75f0

Browse files
committed
Final cleanups on modernization of build process.
1 parent 7ab3a0e commit 4cd75f0

File tree

5 files changed

+64
-24
lines changed

5 files changed

+64
-24
lines changed

README.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,41 @@ Hello, [world](https://www.google.com/earth/)!
6262
`html2text` is available on pypi
6363
https://pypi.org/project/html2text/
6464

65-
```
65+
```shell
6666
$ pip install html2text
6767
```
6868

69+
## Development
6970

70-
## How to run unit tests
71+
### How to run unit tests
7172

72-
tox
73+
```shell
74+
$ tox
75+
```
7376

7477
To see the coverage results:
7578

76-
coverage html
79+
```shell
80+
$ coverage html
81+
```
7782

7883
then open the `./htmlcov/index.html` file in your browser.
7984

85+
86+
### Code Quality & Pre Commit
87+
88+
The CI runs several linting steps, including:
89+
90+
- mypy
91+
- Flake8
92+
- Black
93+
94+
To make sure the code passes the CI linting steps, run:
95+
96+
```shell
97+
$ tox -e pre-commit
98+
```
99+
80100
## Documentation
81101

82102
Documentation lives [here](https://github.com/Alir3z4/html2text/blob/master/docs/usage.md)

html2text/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
from typing import Dict, List, Optional, Tuple, Union
1010

1111
from . import config
12-
from ._version import __version_tuple__ as __version__
1312
from ._typing import OutCallback
13+
from ._version import __version_tuple__
1414
from .elements import AnchorElement, ListElement
1515
from .utils import (
1616
control_character_replacements,
@@ -29,6 +29,8 @@
2929
unifiable_n,
3030
)
3131

32+
__version__ = __version_tuple__
33+
3234
# TODO:
3335
# Support decoded entities with UNIFIABLE.
3436

html2text/cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import argparse
22
import sys
33

4-
from . import HTML2Text, __version__, config
4+
from . import HTML2Text, config
5+
from ._version import __version_tuple__ as __version__
56

67

78
def main() -> None:

pyproject.toml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,24 @@ description = "Turn HTML into equivalent Markdown-structured text."
88
readme = "README.md"
99
authors = [{name = "Aaron Swartz", email = "me@aaronsw.com"}]
1010
maintainers = [{name = "Alireza Savand", email = "alireza.savand@gmail.com"}]
11-
license = {text = "GNU GPL 3"}
11+
license = "GPL-3.0-or-later"
1212
classifiers = [
1313
"Development Status :: 5 - Production/Stable",
1414
"Intended Audience :: Developers",
15-
"License :: OSI Approved :: GNU General Public License (GPL)",
1615
"Operating System :: OS Independent",
1716
"Programming Language :: Python",
1817
"Programming Language :: Python :: 3",
19-
"Programming Language :: Python :: 3.5",
20-
"Programming Language :: Python :: 3.6",
21-
"Programming Language :: Python :: 3.7",
22-
"Programming Language :: Python :: 3.8",
2318
"Programming Language :: Python :: 3.9",
19+
"Programming Language :: Python :: 3.10",
20+
"Programming Language :: Python :: 3.11",
21+
"Programming Language :: Python :: 3.12",
22+
"Programming Language :: Python :: 3.13",
2423
"Programming Language :: Python :: 3 :: Only",
2524
"Programming Language :: Python :: Implementation :: CPython",
2625
"Programming Language :: Python :: Implementation :: PyPy",
2726
]
2827
urls = {Homepage = "https://github.com/Alir3z4/html2text/"}
29-
requires-python = ">=3.5"
28+
requires-python = ">=3.9"
3029
dynamic = ["version"]
3130

3231
[project.scripts]
@@ -44,13 +43,23 @@ html2text = ["py.typed"]
4443
[tool.setuptools_scm]
4544
write_to = "html2text/_version.py"
4645

46+
[tool.black]
47+
line-length = 88
48+
target-version = ['py313']
49+
extend-exclude = '''
50+
/(
51+
html2text/_version.py
52+
)
53+
'''
54+
4755
[tool.flake8] # you will need Flake8-pyproject
4856
max_line_length = "88"
4957
extend-ignore = "E203"
5058

5159
[tool.isort]
5260
profile = "black"
5361
combine_as_imports = true
62+
extend_skip = ["html2text/_version.py"]
5463

5564
[tool.mypy]
56-
python_version = "3.5"
65+
python_version = "3.9"

tox.ini

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,37 @@ setenv =
1818

1919
[testenv:black]
2020
basepython = python3
21-
commands =
22-
black --target-version py38 --line-length 88 --check --diff .
23-
deps =
24-
black
21+
commands = black --check --diff .
22+
deps = black
2523
skip_install = true
2624

2725
[testenv:flake8]
2826
basepython = python3
29-
commands =
30-
flake8 --max-line-length 88
27+
commands = flake8
3128
deps =
3229
flake8
30+
Flake8-pyproject
3331
skip_install = true
3432

3533
[testenv:isort]
3634
basepython = python3
37-
commands =
38-
isort --check-only --diff .
39-
deps =
40-
isort
35+
commands = isort --check-only --diff .
36+
deps = isort
4137
skip_install = true
4238

4339
[testenv:mypy]
4440
commands = mypy --strict html2text
4541
deps = mypy
42+
43+
[testenv:pre-commit]
44+
basepython = python3
45+
commands =
46+
isort --atomic .
47+
flake8
48+
black .
49+
deps =
50+
isort
51+
flake8
52+
Flake8-pyproject
53+
black
4654
skip_install = true

0 commit comments

Comments
 (0)