Skip to main content

Pure mechanism layer for the Astro ecosystem — zero hard dependencies

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

astrobasis-0.1.1.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

astrobasis-0.1.1-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file astrobasis-0.1.1.tar.gz.

File metadata

  • Download URL: astrobasis-0.1.1.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for astrobasis-0.1.1.tar.gz
Algorithm Hash digest
SHA256 cb8b349a96f5e8f3d7048ca0b6c38f53072b554770242d0dcf105552f08683d8
MD5 3bcb9af747cf3ad1eeb0d20e5734178e
BLAKE2b-256 fcd2724c6afd832f66aa79e7471e483b994df3c08e046eeea2cebb0adab72034

See more details on using hashes here.

Provenance

The following attestation bundles were made for astrobasis-0.1.1.tar.gz:

Publisher: ci.yml on Etoileint/AstroProject

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file astrobasis-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: astrobasis-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for astrobasis-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 eda5a314a6587178520675362b2fe7602c2ba7a0598fcdc2261a38952f4d0b24
MD5 932cc49cec24081ba36c672894c7ec5d
BLAKE2b-256 d42211e64e2681b2d6f659cf11c68bf8cf95940ad524a973579ba39436c71a9a

See more details on using hashes here.

Provenance

The following attestation bundles were made for astrobasis-0.1.1-py3-none-any.whl:

Publisher: ci.yml on Etoileint/AstroProject

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page