Skip to content

Commit f8e2a77

Browse files
committed
migrate to pyproject.toml for world peace
1 parent 9b19623 commit f8e2a77

File tree

8 files changed

+92
-92
lines changed

8 files changed

+92
-92
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ repos:
2121
"--ignore=D10,D212,D203,D401"
2222
]
2323

24+
- repo: https://github.com/gitleaks/gitleaks
25+
rev: v8.18.2
26+
hooks:
27+
- id: gitleaks
28+
2429
- repo: https://github.com/PyCQA/pylint
2530
rev: v2.17.7
2631
hooks:

mindee/version

Lines changed: 0 additions & 1 deletion
This file was deleted.

mindee/versions.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
import os
21
import sys
32

4-
dir_path = os.path.dirname(os.path.realpath(__file__))
5-
with open(os.path.join(dir_path, "version"), "r", encoding="utf-8") as version_file:
6-
__version__ = version_file.read().strip()
3+
__version__ = "4.13.0"
74

85
python_version = f"{sys.version_info[0]}.{sys.version_info[1]}"
96

pyproject.toml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,82 @@
1+
[build-system]
2+
requires = ["setuptools", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "mindee"
7+
authors = [
8+
{name = "Mindee", email = "opensource@mindee.com"},
9+
]
10+
dynamic = ["version"]
11+
description = "Mindee API helper library for Python"
12+
readme = "README.md"
13+
license = {file = "LICENSE"}
14+
classifiers = [
15+
"Programming Language :: Python :: 3",
16+
"Programming Language :: Python :: 3.7",
17+
"Programming Language :: Python :: 3.8",
18+
"Programming Language :: Python :: 3.9",
19+
"Programming Language :: Python :: 3.10",
20+
"Programming Language :: Python :: 3.11",
21+
"Programming Language :: Python :: 3.12",
22+
"Operating System :: OS Independent",
23+
"Development Status :: 5 - Production/Stable",
24+
"Intended Audience :: Developers",
25+
"Topic :: Software Development :: Libraries",
26+
"License :: OSI Approved :: MIT License",
27+
]
28+
29+
requires-python = ">=3.7"
30+
31+
dependencies = [
32+
"pypdfium2>=4.0,<5",
33+
"Pillow>=9.5.0",
34+
"pytz>=2023.3",
35+
"requests~=2.32.3",
36+
]
37+
38+
[project.urls]
39+
Homepage = "https://www.mindee.com"
40+
Documentation = "https://developers.mindee.com/docs/python-sdk"
41+
Repository = "https://github.com/publicMindee/mindee-api-python"
42+
Issues = "https://github.com/mindee/mindee-api-python/issues"
43+
Changelog = "https://github.com/mindee/mindee-api-python/blob/main/CHANGELOG.md"
44+
45+
[project.optional-dependencies]
46+
dev = [
47+
"pylint==2.17.7",
48+
"setuptools==51.3.3",
49+
"pre-commit~=3.5.0",
50+
"types-pytz>=2023.3",
51+
"types-requests~=2.31",
52+
"toml~=0.10.2",
53+
"pytest~=7.4",
54+
"pytest-cov~=4.1",
55+
]
56+
docs = [
57+
"sphinx~=5.3",
58+
"sphinx_rtd_theme~=1.1",
59+
"sphinx-autodoc-typehints~=1.20",
60+
]
61+
build = [
62+
"build",
63+
"twine",
64+
]
65+
66+
[project.scripts]
67+
mindee = "mindee.cli:main"
68+
69+
70+
[tool.setuptools]
71+
packages = ["mindee", ]
72+
73+
[tool.setuptools.dynamic]
74+
version = {attr = "mindee.versions.__version__"}
75+
76+
[tool.setuptools.package-data]
77+
"mindee" = ["py.typed"]
78+
79+
180
[tool.black]
281
line-length = 88
382
target-version = [
@@ -26,6 +105,7 @@ warn_unreachable = true
26105
module = "pypdfium2.*"
27106
ignore_missing_imports = true
28107

108+
29109
[tool.pylic]
30110
safe_licenses = [
31111
"Apache Software License",
@@ -36,6 +116,7 @@ safe_licenses = [
36116
"Historical Permission Notice and Disclaimer (HPND)"
37117
]
38118

119+
39120
[tool.pytest.ini_options]
40121
addopts = "--pyargs --cov mindee --cov-report term:skip-covered --cov-report term-missing -m 'not regression and not integration'"
41122
python_files = "test*.py"

setup.cfg

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

setup.py

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

tests/test_cli.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import json
22
from argparse import Namespace
3-
from sys import api_version
43

54
import pytest
65

tests/test_pkg_versions.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
"""Test to check if style packages are in same versions as pre-commit config."""
22

3-
import configparser
43
import re
54
from pathlib import Path
65

6+
import toml
7+
78

89
def _test_version(versions_a, versions_b, key):
910
assert versions_a[key].replace("v", "") == versions_b[key].replace("v", "")
1011

1112

1213
def test_style_pkg_versions():
1314
"""Check black, flake8, isort and pydocstyle versions consistency."""
14-
config = configparser.ConfigParser()
15-
config.read(Path(__file__).parent.parent.joinpath("setup.cfg"))
16-
line_sep = re.compile(r"(==|~=)")
15+
config = toml.load(Path(__file__).parent.parent.joinpath("pyproject.toml"))
16+
line_sep = re.compile(r"(==|~=|>=)")
1717
requirements_versions = {}
18-
for line in config["options.extras_require"]["dev"].split():
18+
for line in config["project"]["optional-dependencies"]["dev"]:
1919
split_line = line_sep.split(line.strip())
2020
requirements_versions[split_line[0]] = split_line[2]
2121

0 commit comments

Comments
 (0)