Skip to content

Commit 74114e9

Browse files
committed
Move from setup.cfg to pyproject.toml
Because Python is simply incapable of making an actually good packaging solution and sticking to it.
1 parent 5df53a2 commit 74114e9

File tree

3 files changed

+47
-56
lines changed

3 files changed

+47
-56
lines changed

pyproject.toml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "html5-parser"
7+
version = "0.4.12"
8+
authors = [
9+
{name = "Kovid Goyal", email = "redacted@acme.com"},
10+
]
11+
description = "Fast C based HTML 5 parsing for python"
12+
license = "Apache-2.0"
13+
classifiers = [
14+
"Development Status :: 5 - Production/Stable",
15+
"Intended Audience :: Developers",
16+
"Natural Language :: English",
17+
"Operating System :: OS Independent",
18+
"Programming Language :: Python",
19+
"Topic :: Text Processing",
20+
"Topic :: Text Processing :: Markup",
21+
"Topic :: Text Processing :: Markup :: HTML",
22+
"Topic :: Text Processing :: Markup :: XML",
23+
]
24+
dependencies = [
25+
"chardet",
26+
"lxml>=3.8.0",
27+
]
28+
29+
[project.urls]
30+
Homepage = "https://html5-parser.readthedocs.io"
31+
32+
[project.optional-dependencies]
33+
soup = ["beautifulsoup4"]
34+
35+
[tool.setuptools]
36+
package-dir = {"" = "src"}
37+
packages = ["html5_parser"]

setup.cfg

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

unix_build.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@
1717
from collections import namedtuple
1818
from copy import deepcopy
1919
from itertools import chain
20-
try:
21-
import configparser
22-
except ImportError:
23-
import ConfigParser as configparser
20+
from typing import NamedTuple
2421

2522
self_path = os.path.abspath(__file__)
2623
base = os.path.dirname(self_path)
@@ -32,10 +29,15 @@
3229
is_ci = os.environ.get('CI') == 'true'
3330
Env = namedtuple('Env', 'cc cflags ldflags linker debug cc_name cc_ver')
3431
PKGCONFIG = os.environ.get('PKGCONFIG_EXE', 'pkg-config')
35-
cfg = configparser.ConfigParser()
36-
cfg.read(os.path.join(base, 'setup.cfg'))
37-
version = namedtuple('Version', 'major minor patch')(
38-
*map(int, cfg.get('metadata', 'version').split('.')))
32+
with open('pyproject.toml') as f:
33+
version_str = re.search(r'^version = "(\d+)\.(\d+).(\d+)"', f.read(), flags=re.MULTILINE)
34+
35+
class Version(NamedTuple):
36+
major: int
37+
minor: int
38+
patch: int
39+
assert version_str is not None
40+
version = Version(*map(int, version_str.groups()))
3941

4042

4143
def safe_makedirs(path):

0 commit comments

Comments
 (0)