Python client for the Shawking natural-language date/time parsing REST service.
Project description
shawking
shawking is a Python client for the Shawking Spring Boot REST service, which parses natural-language date and time expressions into structured timestamps.
The client is class-based and keeps service connection details plus default parse options in one place. Constructor arguments configure the service IP and port, config() sets reusable defaults, and parse() can override those defaults for individual requests.
- Service repo/API target: Shawking
POST /parse - Python package:
shawking - Documentation: https://adi-amatdev.github.io/shawking/
Install
uv sync
Quick start
from shawking import ShawkingClient
client = ShawkingClient(ip="127.0.0.1", port=8080)
client.config(
time_zone="Asia/Kolkata",
reference_time=1748736000000,
)
result = client.parse("Call me at 9 AM tomorrow")
print(result)
Per-call overrides
from datetime import datetime, timezone
from shawking import ShawkingClient
client = ShawkingClient(ip="192.168.1.20", port=8080)
client.config(time_zone="Asia/Kolkata", reference_time=1748736000000)
result = client.parse(
"Book a flight on 15 Jan 2026",
time_zone="UTC",
reference_time=datetime(2026, 1, 1, tzinfo=timezone.utc),
maxParseDate=1,
)
API
ShawkingClient
ShawkingClient(
ip: str = "127.0.0.1",
port: int = 8080,
*,
scheme: str = "http",
timeout: float = 30.0,
)
Creates a client that points to a running Shawking service such as http://127.0.0.1:8080.
config()
client.config(
*,
time_zone: str | None = ...,
reference_time: int | datetime | None = ...,
**options,
)
Stores default request options for future parse() calls.
time_zonemaps to Shawking'stimeZonereference_timemaps to Shawking'sreferenceTime- extra keyword arguments are forwarded directly to the REST API
- passing
Noneremoves a stored default
parse()
client.parse(
text: str,
*,
time_zone: str | None = ...,
reference_time: int | datetime | None = ...,
**overrides,
)
Parses text by calling POST /parse. Any values passed here override defaults from config() for that one request.
Development
Run tests with:
make test
Run only unit tests with:
make tests -- unit
Run only integration tests with:
SHAWKING_HOST=127.0.0.1 \
SHAWKING_PORT=8080 \
make tests -- integ
SHAWKING_HOST, SHAWKING_PORT, and SHAWKING_SCHEME are optional and default to 127.0.0.1, 8080, and http.
Useful development commands:
make install
Creates the uv environment and installs pre-commit hooks.
make check
Runs the configured quality checks: lockfile validation, pre-commit hooks, static typing, and dependency checks.
make docs-test
Builds the documentation locally to catch MkDocs issues.
make docs
Serves the documentation locally.
make help
Lists all available Make targets.
Build the package
Build a distributable wheel with:
make build
This writes the package artifacts into dist/.
If you want to clean old build output first by hand, run:
make clean-build
Publish
The current publish flow is:
- Update the package version in
pyproject.toml. - Build the package with
make build. - Upload the files in
dist/to PyPI withmake publish.
For PyPI, create an API token on PyPI and export it before publishing:
export TWINE_USERNAME="__token__"
export TWINE_PASSWORD="pypi-your-token-here"
Then publish:
make publish
Or build and publish in one step:
make build-and-publish
Typical release sequence:
# 1. Bump version in pyproject.toml
# 2. Rebuild
make build
# 3. Upload to PyPI
export TWINE_USERNAME="__token__"
export TWINE_PASSWORD="pypi-your-token-here"
make publish
If you want to verify the built artifacts before upload, inspect the dist/ directory after make build.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shawking-0.0.1.tar.gz.
File metadata
- Download URL: shawking-0.0.1.tar.gz
- Upload date:
- Size: 78.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad4536968f6b8b551b43b6720f96f534639271b9334d5150ab2044ef21253b76
|
|
| MD5 |
106607b2566ae532f6499d5ab5b9f33f
|
|
| BLAKE2b-256 |
65f36c98d6ae5a8798b10adb5f81c9b2d13c964302df2359d8b5e07fa75717ff
|
File details
Details for the file shawking-0.0.1-py3-none-any.whl.
File metadata
- Download URL: shawking-0.0.1-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81f3c0ce16dd5e7b8facd3f59e7ae6cc1986671738ecd27a7efc2a8e587f58c6
|
|
| MD5 |
d57aa154daca4034f7bc326493498cbb
|
|
| BLAKE2b-256 |
4c6d588aa3ac7a14700124e39770ba21a8e13b01c02a63138a2120dcbd2ccb91
|