File size: 8,574 Bytes
752094d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.version]
path = "src/pdf2u/__init__.py"
# FROM: https://hatch.pypa.io/latest/version/
[tool.hatch.build.targets.wheel]
packages = ["src/pdf2u"]
# FROM: https://hatch.pypa.io/latest/build/
[project]
name = "pdf2u"
version = "0.0.4"
description = "Yet Another Document Translator"
classifiers = [
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
] # FROM: https://pypi.org/classifiers/
readme = "README.md"
requires-python = ">=3.10,<3.13"
license = { file = "LICENSE" }
authors = [{ name = "A.J.Zeller", email = "[email protected]" }]
maintainers = [{ name = "A.J.Zeller", email = "[email protected]" }]
# dynamic = ["version"] # https://hatch.pypa.io/latest/config/metadata/#version
dependencies = [
"bitstring>=4.3.0",
"configargparse>=1.7",
"httpx[socks]>=0.27.0",
"huggingface-hub>=0.27.0",
"numpy>=2.0.2",
"onnx>=1.17.0",
"onnxruntime>=1.16.1",
"openai>=1.59.3",
"opencv-python>=4.10.0.84",
"orjson>=3.10.14",
"pdfminer-six>=20240706",
"peewee>=3.17.8",
"rich>=13.9.4",
"toml>=0.10.2",
"tqdm>=4.67.1",
"xsdata[cli,lxml,soap]>=24.12",
"msgpack>=1.1.0",
"typer>=0.15.1",
"pymupdf==1.24.5",
]
[project.urls]
Homepage = "https://github.com/atticuszeller/pdf2u"
Issues = "https://github.com/atticuszeller/pdf2u/issues"
[project.scripts] # build-backend config needed
pdf2u = "pdf2u.main:app"
# FROM: https://packaging.python.org/en/latest/guides/writing-pyproject-toml/
[project.optional-dependencies]
gui = ["pypdf2>=3.0.1", "streamlit>=1.42.2", "streamlit-pdf-viewer>=0.0.21"]
# optional deps for package installation
[dependency-groups]
dev = [
"ruff>=0.6.3",
"mypy>=1.11.2",
"pre-commit>=3.8.0",
"pytest>=8.3.2",
"pytest-sugar>=1.0.0",
"coverage>=7.6.1",
"git-cliff>=2.6.1",
"bump-my-version>=0.28.0",
"typos>=1.26.8",
"fonttools>=4.56.0",
]
## Test
[tool.mypy]
strict = true
exclude = ["venv", ".venv"]
[tool.pytest.ini_options]
# Set additional command line options for pytest
# Ref: https://docs.pytest.org/en/stable/reference/reference.html#command-line-flags
addopts = "-rXs --strict-config --strict-markers --tb=long"
xfail_strict = true # Treat tests that are marked as xfail but pass as test failures
filterwarnings = ["error"] # Treat all warnings as errors
pythonpath = "src/pdf2u/"
[tool.coverage.run]
branch = true
[tool.coverage.report]
skip_covered = true
show_missing = true
precision = 2
exclude_lines = [
'def __repr__',
'pragma= no cover',
'raise NotImplementedError',
'if TYPE_CHECKING=',
'if typing.TYPE_CHECKING=',
'@overload',
'@typing.overload',
'\(Protocol\)=$',
'typing.assert_never',
'assert_never',
'if __name__ == .__main__.=',
]
## Linter and formatter
[tool.ruff]
# cover and extend the default config in https=//docs.astral.sh/ruff/configuration/
extend-exclude = [""]
target-version = "py310"
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
"ARG001", # unused arguments in functions
]
isort = { combine-as-imports = true, split-on-trailing-comma = false }
# Avoid trying to fix flake8-bugbear (`B`) violations.
unfixable = ["B"]
[tool.ruff.format]
docstring-code-format = true
skip-magic-trailing-comma = true
# Reference
# 1. https=//github.com/Kludex/python-template/blob/main/template/%7B%7B%20project_slug%20%7D%7D/pyproject.toml.jinja
# 2. https=//github.com/fastapi/full-stack-fastapi-template/blob/master/backend/pyproject.toml
# 3. https=//github.com/pydantic/logfire
# 4. https=//coverage.readthedocs.io/en/latest/index.html
## VCS
[tool.git-cliff.remote.github]
owner = "atticuszeller"
repo = "python-uv-package"
[tool.git-cliff.changelog]
# template for the changelog header
header = """
# Changelog\n
All notable changes to this project will be documented in this file.\n
"""
# template for the changelog body
# https://keats.github.io/tera/docs/#introduction
body = """
{% if version %}\
## {{ version | trim_start_matches(pat="v") }} - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
## unreleased
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | striptags | trim | upper_first }}
{% for commit in commits| unique(attribute="message") %}
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
{% if commit.breaking %}[**breaking**] {% endif %}\
{{ commit.message | upper_first }}\
{% if commit.remote.pr_number %} in #{{ commit.remote.pr_number }}{%- endif %}\
{% endfor %}
{% endfor %}\n
"""
# template for the changelog footer
footer = """
<!-- generated by git-cliff -->
"""
# remove the leading and trailings
trim = true
# postprocessors
# postprocessors = [
# { pattern = '<REPO>', replace = "https://github.com/atticuszeller/python-uv" }, # replace repository URL
# ]
# render body even when there are no releases to process
render_always = true
# output file path
output = "CHANGELOG.md"
[tool.git-cliff.git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# filter out the commits that are not conventional
filter_unconventional = true
# process each line of a commit as an individual commit
split_commits = false
# regex for preprocessing the commit messages
commit_preprocessors = [
# If the spelling is incorrect, it will be automatically fixed.
{ pattern = '.*', replace_command = 'typos --write-changes -' },
]
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^feat", group = "<!-- 0 -->π Features" },
{ message = "^fix", group = "<!-- 1 -->π Bug Fixes" },
{ message = "^doc", group = "<!-- 3 -->π Documentation" },
{ message = "^perf", group = "<!-- 4 -->β‘ Performance" },
{ message = "^refactor", group = "<!-- 2 -->π Refactor" },
{ message = "^style", group = "<!-- 5 -->π¨ Styling" },
{ message = "^test", group = "<!-- 6 -->π§ͺ Testing" },
{ message = "^chore\\(release\\)", skip = true },
{ message = "^chore\\(deps.*\\)", skip = true },
{ message = "^chore\\(pr\\)", skip = true },
{ message = "^chore\\(pull\\)", skip = true },
{ message = "^chore|^ci", group = "<!-- 7 -->βοΈ Miscellaneous Tasks" },
{ body = ".*security", group = "<!-- 8 -->π‘οΈ Security" },
{ message = "^revert", group = "<!-- 9 -->βοΈ Revert" },
]
# filter out the commits that are not matched by commit parsers
filter_commits = false
# sort the tags topologically
topo_order = false
# sort the commits inside sections by oldest/newest order
sort_commits = "oldest"
[tool.bumpversion]
current_version = "0.0.4"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
serialize = ["{major}.{minor}.{patch}"]
search = "{current_version}"
replace = "{new_version}"
regex = false
ignore_missing_version = false
ignore_missing_files = false
tag = true
sign_tags = false
tag_name = "v{new_version}"
tag_message = "chore(release): {current_version} β {new_version}"
allow_dirty = true # git-cliff first then bump patch
commit = true
message = "chore(release): {current_version} β {new_version}"
commit_args = ""
setup_hooks = []
pre_commit_hooks = []
post_commit_hooks = []
[[tool.bumpversion.files]]
filename = "src/pdf2u/__init__.py"
[[tool.bumpversion.files]]
filename = "pyproject.toml"
search = "version = \"{current_version}\""
replace = "version = \"{new_version}\""
[[tool.bumpversion.files]]
filename = "CHANGELOG.md"
search = "unreleased"
replace = "{new_version} - {now:%Y-%m-%d}"
# https://callowayproject.github.io/bump-my-version/reference/search-and-replace-config/
|