[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 = "hello@atticux.me" }] maintainers = [{ name = "A.J.Zeller", email = "hello@atticux.me" }] # 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 = """ """ # remove the leading and trailings trim = true # postprocessors # postprocessors = [ # { pattern = '', 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 = "๐Ÿš€ Features" }, { message = "^fix", group = "๐Ÿ› Bug Fixes" }, { message = "^doc", group = "๐Ÿ“š Documentation" }, { message = "^perf", group = "โšก Performance" }, { message = "^refactor", group = "๐Ÿšœ Refactor" }, { message = "^style", group = "๐ŸŽจ Styling" }, { message = "^test", group = "๐Ÿงช 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 = "โš™๏ธ Miscellaneous Tasks" }, { body = ".*security", group = "๐Ÿ›ก๏ธ Security" }, { message = "^revert", group = "โ—€๏ธ 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\\d+)\\.(?P\\d+)\\.(?P\\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/