Skip to content

Commit

Permalink
feat: add async support
Browse files Browse the repository at this point in the history
  • Loading branch information
Goldziher committed Jan 10, 2025
1 parent 2c7e516 commit 7ba04ae
Show file tree
Hide file tree
Showing 19 changed files with 1,499 additions and 326 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,6 @@ virtualenv

# mac os
.DS_Store

# lock files
*.lock
62 changes: 29 additions & 33 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,53 +1,49 @@
# This file configures pre-commit hooks.
# See https://pre-commit.com/ for general information
# See https://pre-commit.com/hooks.html for a listing of possible hooks

default_language_version:
python: python3.12
repos:
# General hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-docstring-first
- id: check-json
exclude: "tsconfig.*json"
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-executables-have-shebangs
- id: end-of-file-fixer
exclude_types:
- svg
- pofile
exclude: "(^LICENSE$)"
- id: mixed-line-ending
args:
- "--fix=lf"
- id: trailing-whitespace
exclude_types:
- svg
- id: check-case-conflict
- id: detect-private-key
# See https://github.com/prettier/prettier/issues/15742 for the fork reason
- repo: https://github.com/rbubley/mirrors-prettier
rev: "v3.4.2"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.0
hooks:
- id: prettier
types_or:
- javascript
- ts
- markdown
- id: ruff
args: [--fix]
- id: ruff-format
- 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.8.2'
exclude: ^tests
additional_dependencies:
- tomli
- repo: https://github.com/jsh9/pydoclint
rev: 0.5.15
hooks:
# Run the linter.
- id: ruff
# Run the formatter.
- id: ruff-format
- id: pydoclint
args:
[
--style=google,
--check-return-types=False,
--arg-type-hints-in-docstring=False,
]
- repo: https://github.com/tox-dev/pyproject-fmt
rev: "v2.5.0"
hooks:
- id: pyproject-fmt
- repo: local
hooks:
- id: mypy
name: mypy
entry: uv run mypy
require_serial: true
language: system
types: [python]
61 changes: 42 additions & 19 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,43 @@ classifiers = [
"Programming Language :: Python :: Implementation :: PyPy",
]
dynamic = [ "version" ]

#
# Dependencies and local dev dependencies
#

dependencies = [
"anyio>=4.8",
"httpx>=0.27",
"typing-extensions; python_version<'3.11'",
]

urls.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"
urls.documentation = "https://github.com/stumpylog/tika-rest-client#readme"
urls.issues = "https://github.com/stumpylog/tika-rest-client/issues"
#
# 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"

urls.source = "https://github.com/stumpylog/tika-rest-client"

[dependency-groups]
dev = [
"coverage[toml]>=7.6.10",
"coverage-enable-subprocess>=1",
"mypy>=1.14.1",
"pytest>=8.3.4",
"pytest-asyncio>=0.25.2",
"pytest-docker>=3.1.1",
"pytest-httpx>=0.35",
"pytest-mock>=3.14",
"pytest-randomly>=3.16",
"pytest-rerunfailures>=15",
"pytest-sugar>=1",
"pytest-xdist[psutil]>=3.6.1",
"python-magic>=0.4.27",
"ruff>=0.9",
]

[tool.hatch.version]
path = "src/tika_client/__about__.py"
Expand Down Expand Up @@ -77,6 +101,8 @@ dependencies = [
"pytest-randomly ~= 3.15",
"pytest-rerunfailures ~= 15.0",
"pytest-xdist[psutil] ~= 3.6",
"pytest-asyncio ~= 0.25",
"pytest-asyncio ~= 0.25",
]
extra-dependencies = [
"pytest-sugar",
Expand Down Expand Up @@ -237,14 +263,14 @@ max_supported_python = "3.13"
[tool.pytest.ini_options]
minversion = "8.0"
testpaths = [ "tests" ]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "session"

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

[tool.coverage.paths]
tika_client = [ "src/tika_client", "*/tika-client/src/tika_client" ]
Expand All @@ -256,15 +282,12 @@ exclude_lines = [
"if __name__ == '__main__':",
"if TYPE_CHECKING:",
]
fail_under = 80 # adjust this as required, for libraries i prefer 100 or there about

[tool.mypy]
#disallow_any_expr = true
#disallow_untyped_defs = true
#disallow_incomplete_defs = true
check_untyped_defs = true
strict_optional = true

warn_redundant_casts = true
warn_unused_ignores = true
warn_unreachable = true
warn_unused_configs = true
packages = [ "tika_client", "tests" ]
python_version = "3.9"
disable_error_code = 'import-untyped'
implicit_reexport = false
show_error_codes = true
strict = true
3 changes: 2 additions & 1 deletion src/tika_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
#
# SPDX-License-Identifier: MPL-2.0

from tika_client.client import AsyncTikaClient
from tika_client.client import TikaClient
from tika_client.data_models import DublinCoreKey
from tika_client.data_models import TikaKey
from tika_client.data_models import XmpKey

__all__ = ["DublinCoreKey", "TikaClient", "TikaKey", "XmpKey"]
__all__ = ["AsyncTikaClient", "DublinCoreKey", "TikaClient", "TikaKey", "XmpKey"]
Loading

0 comments on commit 7ba04ae

Please sign in to comment.