Skip to content

Commit

Permalink
Chore: Dependency updates (#23)
Browse files Browse the repository at this point in the history
* Upgrades dependencies and hook versions

* Changelog note

* Spelling fix

---------

Co-authored-by: Trenton Holmes <[email protected]>
  • Loading branch information
stumpylog and Trenton Holmes authored Oct 8, 2024
1 parent e302d15 commit 8741c3b
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .docker/docker-compose.ci-test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# docker-compose file for running testing with Tika container
# for a more end to end test of the Tika related functionality
# Can be used locally or by the CI to start the nessecary container with the
# Can be used locally or by the CI to start the necessary container with the
# correct networking for the tests

version: "3"
Expand Down
17 changes: 13 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
repos:
# General hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-docstring-first
- id: check-json
Expand All @@ -26,19 +26,28 @@ repos:
- svg
- id: check-case-conflict
- id: detect-private-key
- repo: https://github.com/pre-commit/mirrors-prettier
rev: 'v3.1.0'
# See https://github.com/prettier/prettier/issues/15742 for the fork reason
- repo: https://github.com/rbubley/mirrors-prettier
rev: "v3.3.3"
hooks:
- id: prettier
types_or:
- javascript
- ts
- markdown
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
# Python hooks
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.4.8'
rev: 'v0.6.9'
hooks:
# Run the linter.
- id: ruff
# Run the formatter.
- id: ruff-format
- repo: https://github.com/tox-dev/pyproject-fmt
rev: "2.2.4"
hooks:
- id: pyproject-fmt
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- Bump pypa/gh-action-pypi-publish from 1.9.0 to 1.10.2 (by [@dependabot](https://github.com/apps/dependabot) in [#22](https://github.com/stumpylog/tika-client/pull/22))
- Update `pre-commit` to 4.0.1 ([#23](https://github.com/stumpylog/tika-client/pull/23))

## [0.6.0] - 2024-07-18

Expand Down
135 changes: 72 additions & 63 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
#
# Project Configuration
#

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

requires = [ "hatchling" ]

[project]
name = "tika-client"
dynamic = ["version"]
description = "A modern REST client for Apache Tika server"
readme = "README.md"
requires-python = ">=3.8"
keywords = [ "api", "client", "html", "office", "pdf", "tika" ]
license = "MPL-2.0"
keywords = ["api", "pdf", "html", "client", "office", "tika"]
authors = [
{ name = "Trenton H", email = "[email protected]" },
]
requires-python = ">=3.8"
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)",
"Operating System :: OS Independent",
"Intended Audience :: Developers",
"Environment :: Web Environment",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
Expand All @@ -33,36 +33,37 @@ classifiers = [
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
dynamic = [ "version" ]
dependencies = [
"httpx ~= 0.27; python_version >= '3.9'",
"httpx ~= 0.24; python_version < '3.9'",
"typing-extensions; python_version < '3.11'"
"httpx~=0.24; python_version<'3.9'",
"httpx~=0.27; python_version>='3.9'",
"typing-extensions; python_version<'3.11'",
]

[project.urls]
Documentation = "https://github.com/stumpylog/tika-rest-client#readme"
Issues = "https://github.com/stumpylog/tika-rest-client/issues"
Source = "https://github.com/stumpylog/tika-rest-client"
Changelog = "https://github.com/stumpylog/tika-rest-client/blob/main/CHANGELOG.md"
urls.Changelog = "https://github.com/stumpylog/tika-rest-client/blob/main/CHANGELOG.md"

#
# Hatch Configuration
#
urls.Documentation = "https://github.com/stumpylog/tika-rest-client#readme"
urls.Issues = "https://github.com/stumpylog/tika-rest-client/issues"
urls.Source = "https://github.com/stumpylog/tika-rest-client"

[tool.hatch.version]
path = "src/tika_client/__about__.py"

[tool.hatch.build.targets.sdist]
exclude = [
".github",
".docker"
".docker",
]

[tool.hatch.envs.default]
installer = "uv"

[tool.hatch.envs.hatch-static-analysis]
# https://hatch.pypa.io/latest/config/internal/static-analysis/
dependencies = ["ruff ~= 0.5.6"]
dependencies = [ "ruff ~= 0.6" ]
config-path = "none"

[tool.hatch.envs.hatch-test]
Expand All @@ -81,72 +82,74 @@ dependencies = [
]
extra-dependencies = [
"pytest-sugar",
"pytest-httpx ~= 0.30; python_version >= '3.9'",
"pytest-httpx == 0.30.0; python_version >= '3.9'",
"pytest-httpx ~= 0.22; python_version < '3.9'",
"python-magic",
]
extra-args = ["--maxprocesses=8", "--pythonwarnings=all"]
extra-args = [ "--maxprocesses=8", "--pythonwarnings=all" ]

[tool.hatch.envs.hatch-test.scripts]
run = [
"python3 --version",
"pytest{env:HATCH_TEST_ARGS:} {args}"]
"pytest{env:HATCH_TEST_ARGS:} {args}",
]

run-cov = [
"python3 --version",
"coverage erase",
"coverage run -m pytest{env:HATCH_TEST_ARGS:} {args}"
"coverage run -m pytest{env:HATCH_TEST_ARGS:} {args}",
]
cov-combine = ["coverage combine"]
cov-combine = [ "coverage combine" ]
cov-report = [
"coverage report",
"coverage json",
"coverage html"
"coverage html",
]

[[tool.hatch.envs.hatch-test.matrix]]
python = ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.8", "pypy3.9", "pypy3.10"]
python = [ "3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.8", "pypy3.9", "pypy3.10" ]

#
# Custom Environments
#
[tool.hatch.envs.typing]
detached = true
dependencies = [
"mypy ~= 1.11.0",
"mypy ~= 1.11",
"httpx",
]

[tool.hatch.envs.typing.scripts]
run = [
"mypy --version",
"mypy --install-types --non-interactive {args:src/tika_client}"
"mypy --install-types --non-interactive {args:src/tika_client}",
]

[tool.hatch.envs.pre-commit]
template = "pre-commit"
detached = true
dependencies = [
"pre-commit ~= 3.8.0",
"pre-commit ~= 4.0",
"pre-commit-uv",
]

[tool.hatch.envs.pre-commit.scripts]
check = ["pre-commit run --all-files"]
update = ["pre-commit autoupdate"]
check = [ "pre-commit run --all-files" ]
update = [ "pre-commit autoupdate" ]

#
# Tool Configuration
#

[tool.ruff]
# https://docs.astral.sh/ruff/settings/
fix = true
output-format = "grouped"
target-version = "py38"
line-length = 120

[tool.ruff.lint]
# https://docs.astral.sh/ruff/settings/
fix = true
output-format = "grouped"
# https://docs.astral.sh/ruff/rules/
extend-select = [
lint.extend-select = [
"A",
"ARG",
"B",
Expand All @@ -169,15 +172,15 @@ extend-select = [
"ISC",
"N",
"PERF",
"PIE",
"PGH",
"PTH",
"PIE",
"PL",
"PLC",
"PLE",
"PLR",
"PLW",
"PT",
"PTH",
"Q",
"RSE",
"RUF",
Expand All @@ -195,47 +198,56 @@ extend-select = [
"W",
"YTT",
]
ignore = [
lint.ignore = [
# Allow non-abstract empty methods in abstract base classes
"B027",
# Ignore complexity
"C901",
# Allow boolean positional values in function calls, like `dict.get(... True)`
"FBT003",
"PLR0911",
"PLR0912",
"PLR0913",
"PLR0915",
# Ignore checks for possible passwords
"S105", "S106", "S107",
# Ignore complexity
"C901", "PLR0911", "PLR0912", "PLR0913", "PLR0915",
"S105",
"S106",
"S107",
# Ignore no author and missing issue link in TODO tags
"TD002", "TD003"
"TD002",
"TD003",
]

[tool.ruff.lint.isort]
force-single-line = true
known-first-party = ["tika_client"]

[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "all"

[tool.ruff.lint.per-file-ignores]
# Tests can use magic values, assertions, and relative imports
"tests/**/*" = ["PLR2004",
"S101",
"TID252",
# Allow more complex pytest.raises
"PT012",
"DTZ001"
]
lint.per-file-ignores."tests/**/*" = [
"DTZ001",
"PLR2004",
# Allow more complex pytest.raises
"PT012",
"S101",
"TID252",
]
# No relative imports
lint.flake8-tidy-imports.ban-relative-imports = "all"
# One import per line
lint.isort.force-single-line = true
# Recognize us please
lint.isort.known-first-party = [ "tika_client" ]

[tool.pytest.ini_options]
minversion = "7.0"
testpaths = [ "tests" ]

[tool.coverage.run]
source_pkgs = ["tika_client", "tests"]
source_pkgs = [ "tika_client", "tests" ]
branch = true
parallel = true
omit = [
"src/tika_client/__about__.py",
]

[tool.coverage.paths]
tika_client = ["src/tika_client", "*/tika-client/src/tika_client"]
tests = ["tests", "*/tika-client/tests"]
tika_client = [ "src/tika_client", "*/tika-client/src/tika_client" ]
tests = [ "tests", "*/tika-client/tests" ]

[tool.coverage.report]
exclude_lines = [
Expand All @@ -255,6 +267,3 @@ warn_redundant_casts = true
warn_unused_ignores = true
warn_unreachable = true
warn_unused_configs = true

[tool.pytest.ini_options]
minversion = "7.0"
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
SAMPLE_DIR: Final[Path] = Path(__file__).parent.resolve() / "samples"


@pytest.fixture()
@pytest.fixture
def tika_client() -> TikaClient:
with TikaClient(tika_url=TIKA_URL, log_level=logging.INFO) as client:
yield client


@pytest.fixture()
@pytest.fixture
def tika_client_compressed() -> TikaClient:
with TikaClient(tika_url=TIKA_URL, log_level=logging.INFO, compress=True) as client:
yield client

0 comments on commit 8741c3b

Please sign in to comment.