Skip to main content

NSB for Python

Night-sky background evaluation and observation planning for astronomy.

nsb-py provides Python bindings to NSB's Rust scientific engine. Evaluate integrated optical night-sky background at a ground-based observer, UTC instant and sky direction, or search for observing windows satisfying brightness and visibility constraints.

Install

Python 3.10 or newer is required:

python -m pip install nsb-py==0.3.0

The installed distribution is nsb-py; the import is nsb. Compatible siderust and tempoch Python runtime packages are installed as dependencies (siderust>=0.6.0,<0.7, tempoch>=0.5.0,<0.6). Version 0.3.0 requires successful registry publication. Migrating from 0.2.0? Use siderust.direction.ICRS in place of siderust.Direction; fixed Alt/Az pointings use siderust.direction.Horizontal. See the Python guide.

Evaluate a point

This example uses geographic coordinates of CTAO South with generic clear-sky assumptions, not a site-calibrated observatory profile. All times must be timezone-aware.

from datetime import datetime, timezone

import nsb
import siderust
from siderust.direction import ICRS

observer = siderust.Observer(
    lon_deg=-70.31634, lat_deg=-24.683427, height_m=2184.6
)
target = ICRS(ra_deg=266.41683, dec_deg=-29.00781)

evaluator = nsb.NsbEvaluator()
query = nsb.PointQuery(
    observer,
    datetime(2026, 6, 19, 3, tzinfo=timezone.utc),
    target,
)
result = evaluator.evaluate(query)
print(f"{result.integrated_photons_cm2_ns_sr:.3e} ph/(cm² ns sr)")

Point outputs integrate 300–650 nm in ph cm^-2 ns^-1 sr^-1. See the Python API guide for component breakdowns, observing-window searches and model configuration.

Scientific applicability

NSB combines zodiacal light, integrated starlight, airglow and scattered moonlight. The default configuration is a planning model, not a prediction of absolute night-sky brightness calibrated at an observatory.

In 0.3.0, Automatic Airglow selects experimental PALACE Oxygen, limited to standard continuum geometry and zenith distance ≤60°. Out-of-domain queries raise errors; no alternative model is silently substituted. The bundled Gaia-derived Starlight map has verified provenance and cross-implementation evidence, not independently established absolute observational accuracy. CTAO planning presets are not observatory calibrations.

Before scientific use, consult validation and limitations and the model-maturity specification.

License, data and citation

NSB source code is AGPL-3.0-only. Scientific datasets retain separate licenses and conditions; Gaia-derived Starlight is subject to applicable CC BY-NC 3.0 IGO terms, potentially restricting commercial use. See third-party notices and source terms. Cite the software using CITATION.cff.

The NSB repository contains Rust, Python and CLI guides, runnable examples and reproducible scientific evidence.

Metadata

Release files for nsb-py 0.3.0

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

Source distribution (sdist)

Source distribution for nsb-py 0.3.0
File Size Uploaded Provenance Actions
nsb_py-0.3.0.tar.gz 6.5 MB With provenance Details for nsb_py-0.3.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for nsb-py 0.3.0
File Actions
nsb_py-0.3.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for nsb_py-0.3.0-cp310-abi3-win_amd64.whl
nsb_py-0.3.0-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details for nsb_py-0.3.0-cp310-abi3-manylinux_2_28_x86_64.whl
nsb_py-0.3.0-cp310-abi3-manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.28+ ARM64 Details for nsb_py-0.3.0-cp310-abi3-manylinux_2_28_aarch64.whl
nsb_py-0.3.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for nsb_py-0.3.0-cp310-abi3-macosx_11_0_arm64.whl
nsb_py-0.3.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for nsb_py-0.3.0-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 56.5 MB

Release files / nsb_py-0.3.0.tar.gz

Download URL nsb_py-0.3.0.tar.gz
Size 6.5 MB
Tags Source
SHA-256 checksum
How to use checksums
2a3833d5728f1f6d1eb8498c0f516a228d40761cea893e82e037e98fa6a23256
BLAKE2b-256 checksum
How to use checksums
5965fb886e171ecb875682e63bac747d8271a0408e1287b115bc4c5ccddfa1e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Oct 27, 2026.

Transparency log

Release files / nsb_py-0.3.0-cp310-abi3-win_amd64.whl

Download URL nsb_py-0.3.0-cp310-abi3-win_amd64.whl
Size 9.8 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
4dc34dbb8e44aa34f29365cf1677ae65f8d0303c8504c2700309385142b3b765
BLAKE2b-256 checksum
How to use checksums
924b3ae66961c9ddc131356f2565bf65042e8ffa192cee4c2ba7da1eb96f4988
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Oct 27, 2026.

Transparency log

Release files / nsb_py-0.3.0-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL nsb_py-0.3.0-cp310-abi3-manylinux_2_28_x86_64.whl
Size 10.1 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
ce3ffadb0ec51a53740238336ee28caf2816665de57975aeb2ea7ed59b25793c
BLAKE2b-256 checksum
How to use checksums
e8155a9b52e0f64d18df9fbd94b1503e4cae998c42be77446599a0fd342be412
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Oct 27, 2026.

Transparency log

Release files / nsb_py-0.3.0-cp310-abi3-manylinux_2_28_aarch64.whl

Download URL nsb_py-0.3.0-cp310-abi3-manylinux_2_28_aarch64.whl
Size 10.1 MB
Tags CPython 3.10 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
b1afa163ddef34fc2c2efc010fa11e958ee07ed0a6c76fbf716751937e3eb6e7
BLAKE2b-256 checksum
How to use checksums
5596268094f9bb4d9c135d8610e33c030efc5cb794fd8679d126cdce097a1783
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Oct 27, 2026.

Transparency log

Release files / nsb_py-0.3.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL nsb_py-0.3.0-cp310-abi3-macosx_11_0_arm64.whl
Size 10.0 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c5bb2ac9943693221b44b3bca7da6737db13b73423a9431ede1d036e6d316d20
BLAKE2b-256 checksum
How to use checksums
4e690e49f85d2580f1212609e439ae48d8a0ea82dde8f2e3b1783932d974bda0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Oct 27, 2026.

Transparency log

Release files / nsb_py-0.3.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL nsb_py-0.3.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 10.0 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
018a0715ae571015916cb23ead682f48c1a6bec49cc423221a24d2deba302ad1
BLAKE2b-256 checksum
How to use checksums
1d33ad20f915e2923183610d8be234705db5ec71a779a6fca9ca2db7aea6ea2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Oct 27, 2026.

Transparency log

Security for nsb-py 0.3.0

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.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for nsb_py-0.3.0.tar.gz

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 Oct 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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