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.0.tar.gz (11.9 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.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for astrobasis-0.1.0.tar.gz
Algorithm Hash digest
SHA256 aa2fe0d2304e289c6a6a74124d4c712b8cc8b10215caf271f5abd05534d21cb9
MD5 8d745e803f60eb9ccc5326eabbbede3a
BLAKE2b-256 db43e7de9aad195eb52cc97da1eec955bae2887056e002fb1f34db55ca4797e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for astrobasis-0.1.0.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.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for astrobasis-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d89ba003c69c7f5b43845ebebb289d50516e1c48c7c933e3a3af9584e06934c6
MD5 51ddce6ccb878fb905fd37611aea866a
BLAKE2b-256 f04c9d4d915a55edb4156d436e093ea4ef8258cc0f17181d61bd0a2133f8dbbb

See more details on using hashes here.

Provenance

The following attestation bundles were made for astrobasis-0.1.0-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