Skip to main content

astrobasis 天枢

Pure mechanism layer for the Astro ecosystem. Zero hard dependencies beyond Python 3.12 stdlib.

Install

pip install astrobasis

For JSON performance acceleration:

pip install astrobasis[fast]

Or from source:

pip install -e .

What's inside

Module Purpose
_logging Structured logfmt logging — mandatory event field, key=value output
_atomic POSIX atomic file writes — mkstemp → fsync → os.replace
_json_compat orjson / stdlib json compatibility layer with graceful fallback
_types Shared protocols — AsyncCloseable for async resource lifecycle

Usage

Structured logging

from astrobasis import LogfmtLogger

logger = LogfmtLogger("my_module")
logger.info("request_complete", url="https://example.com", status=200)
# → ts=2026-07-17T... level=INFO logger=my_module event=request_complete url=https://example.com status=200

Atomic file writes

from astrobasis import atomic_write_json

data = {"key": "value", "nested": [1, 2, 3]}
atomic_write_json("/path/to/config.json", data)
# POSIX atomic: write to temp → fsync → os.replace. Concurrent reads always see complete data.

JSON compatibility

from astrobasis import _json_dumps

data = {"items": ["a", "b", "c"]}
result = _json_dumps(data)
# Uses orjson if installed (`pip install astrobasis[fast]`), stdlib json otherwise.

Async resource protocol

from astrobasis import AsyncCloseable


class MyResource(AsyncCloseable):
    async def aclose(self) -> None:
        await self._client.close()

License

Apache 2.0

Metadata

Release files for astrobasis 0.1.1

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

Source distribution (sdist)

Source distribution for astrobasis 0.1.1
File Size Uploaded
astrobasis-0.1.1.tar.gz 13.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for astrobasis 0.1.1
File Interpreter ABI Platform
astrobasis-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 28.6 kB

Release files / astrobasis-0.1.1.tar.gz

Download URL astrobasis-0.1.1.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
cb8b349a96f5e8f3d7048ca0b6c38f53072b554770242d0dcf105552f08683d8
BLAKE2b-256 checksum
How to use checksums
fcd2724c6afd832f66aa79e7471e483b994df3c08e046eeea2cebb0adab72034
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 26, 2026.

Transparency log

Release files / astrobasis-0.1.1-py3-none-any.whl

Download URL astrobasis-0.1.1-py3-none-any.whl
Size 14.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eda5a314a6587178520675362b2fe7602c2ba7a0598fcdc2261a38952f4d0b24
BLAKE2b-256 checksum
How to use checksums
d42211e64e2681b2d6f659cf11c68bf8cf95940ad524a973579ba39436c71a9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 26, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

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