Skip to main content

hugpy-tools

hugpy_tools — a slim, stdlib-only capability suite for autonomous agents, extracted from abstract_utilities / abstract_webtools and rebuilt with no third-party runtime dependency. Foundation layer: it imports no other hugpy_* package, so it can be lifted out as its own distribution unchanged.

Ownership and allowed dependencies are declared in py/partition.toml; see PARTITION.md at the workspace root.

Allowed Python dependencies inside the ecosystem: none (stdlib only).

Built-in tools

Every fs function takes an already-confined absolute path — call paths.confine(root, path) first to enforce a workspace jail (rejects .., absolute-outside, and symlink escapes in one check).

Module Function What it does
paths confine(root, path, for_write=False) Resolve a path under root; raise PathEscape on any escape.
paths file_parts(path) Decompose into dir/base/name/ext + two enclosing dir levels.
paths sanitize_filename(name) Reduce to one safe path component, length-bounded.
fs read_text(path, max_bytes=None) Read with encoding detection (BOM → utf-8 → cp1252).
fs read_lines(path, start, end, number=False) 1-based inclusive line-range read.
fs atomic_write(path, content, append=False) Durable write (temp file + os.replace); append supported.
fs edit_replace(path, old, new, count=None) Exact string replace with an occurrence-count contract; atomic.
fs file_info(path, hash_files=False) Size, mtime, type, symlink flag, optional sha256.
fs list_dir(path, glob=None, ...) Immediate entries (dirs first), optional fnmatch.
fs tree(path, max_depth=3, max_entries=500) Bounded recursive tree text (never follows dir symlinks).
hashkit sha256_text / sha256_file / quick_hash Content hashing (files streamed in 1 MiB windows).
text count_tokens(text) Dependency-free approximate BPE token count.
text chunk_by_lines / chunk_by_tokens Chunk on line or token budgets (paragraph-aware).
text unified_diff(before, after) Unified diff between two texts.
data read_data(path, fmt=None) Parse JSON always, TOML via stdlib tomllib, YAML if PyYAML present.
data write_json(path, obj) / safe_json_dumps(obj) Atomic JSON write / non-exploding dumps.
timekit now_iso / now_epoch / epoch_to_iso / iso_to_epoch UTC time conversions.
web assess_webpage(url, ...) assessManager-parity structured page assessment over urllib + html.parser.
web prescreen_webpage(url, ...) Cheap title + description + lede relevance pre-screen.

Web assessment

assess_webpage returns the same dict shape as abstract_webtools.assessManager.assess_webpage ({url, title, description, text, metadata, jsonld, links, truncated, render}) plus additive keys final_url, status, canonical, lang, headings, and error. The fetch is http(s)-only, refuses redirects to other schemes, disables file:// / ftp://, caps the body, times out, handles gzip/deflate, and detects charset (Content-Type → BOM → <meta charset> → utf-8 → cp1252).

JS rendering is opt-in and lazy: force_render=True (or an automatic fall-back when the cheap fetch yields almost no text) drives a headless browser only if Playwright or Selenium is installed, and raises a clear "install X" error otherwise. The default path never needs a browser.

Layer

Foundation. hugpy_tools imports no other hugpy_* package. The search subpackage is owned by a separate work-stream.

Metadata

Release files for hugpy-tools 0.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hugpy-tools 0.2.5
File Size Uploaded
hugpy_tools-0.2.5.tar.gz 38.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hugpy-tools 0.2.5
File Interpreter ABI Platform
hugpy_tools-0.2.5-py3-none-any.whl Python 3 none any Details

Total release size: 71.5 kB

Release files / hugpy_tools-0.2.5.tar.gz

Download URL hugpy_tools-0.2.5.tar.gz
Size 38.7 kB
Tags Source
SHA-256 checksum
How to use checksums
dd0a916b9e8ff583e5d8b53c5a017a4d31e30cf855f6ac0c0026040226e1ee99
BLAKE2b-256 checksum
How to use checksums
e826caa42f37bba090d7e0df28ba32b2f5749686b1224178f3147897860046f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / hugpy_tools-0.2.5-py3-none-any.whl

Download URL hugpy_tools-0.2.5-py3-none-any.whl
Size 32.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2c5971cc2850f3f791435af0e0d72d0985572e2ff34e7d4c4f11743d1961be9c
BLAKE2b-256 checksum
How to use checksums
923971e06d34d6c5680cad4f78e3f8b9c085b1ea78209b46767951c53dadde35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

0.2.7

1 release file

0.2.6

2 release files

This release

0.2.5 This release

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page