Prepare environment
mkdir nasa-client
cd nasa-client
uv init --package nasa-client-pro --python=3.14
uv venv
source .venv/bin/activate
touch main.py
Create .env file
touch .env .gitignore
# Add your NASA_API_KEY API key to the .env file
echo "NASA_API_KEY=your_api_key_here" >> .env
cd src/nasa_client_pro
touch client.py
Add packages
- https://github.com/Delgan/loguru.git
- https://github.com/psf/black.git
- https://github.com/theskumar/python-dotenv.git
uv add requests python-dotenv loguru black
from .client import NASAClient
- makes it easy to
import - . means from the current package
- go inside client.py and import NASAClient
- without it, users would have to write
from nasa_client_pro.client import NASAClient
- with it, users can simply write
from nasa_client_pro import NASAClient
__all__=[NASAClient]
- this controls what gets exported publicly from your package
- think of it like a
public API whitelist - if someone does
from nasa_client_pro import *(cleaner, more user-friendly API)- only things listed in
__all__will be imported
- only things listed in
Bonus: what happens without __all__?
Format code
black main.py
black src/nasa_client_pro/*.py
Git
git init
git add .
git commit -m "Initial commit"
git branch -M main
git remote add origin https://github.com/<USERNAME>/nasa-client-pro.git
git push -u origin main
Run Locally
uv run main.py
Build Package
uv add build twine
Build and Publish to PyPI
# build project
uv build
# publish project
export UV_PUBLISH_USERNAME="__token__"
export UV_PUBLISH_PASSWORD="pypi-AgEIcHlwaS5vcmcCJ..."
uv publish
# another
export PYPI_TOKEN="pypi-AgEIcHlwaS5vcmcCJ..."
uv publish --username __token__ --password $PYPI_TOKEN
# another
uv publish --username __token__ --password "pypi-AgEIcHlwaS5vcmcCJ..."
# using twine: https://twine.readthedocs.io/en/stable/
export TWINE_USERNAME=__token__
export TWINE_PASSWORD="pypi-AgEIcHlwaS5vcmcCJ..."
twine upload dist/*
twine upload dist/* --verbose --username __token__ --password "pypi-AgEIcHlwaS5vcmcCJ..."
# debug trick
uv publish https://test.pypi.org/legacy/ --username __token__ --password $PYPI_TOKEN
Install Wheel Files
pip install dist/nasa_client_pro-0.6.0-py3-none-any.whl
uv tool install dist/nasa_client_pro-0.6.0-py3-none-any.whl
USAGE
pip install nasa-client-prooruv add nasa-client-pro --upgrade- export NASA_API_KEY=tYYvy2MZehnbOAY5t...
import os
from nasa_client_pro import NASAClient
from dotenv import load_dotenv
from loguru import logger
# load_dotenv(".env", override=True)
NASA_API_KEY = os.getenv("NASA_API_KEY")
def main():
# --- Usage (Clean and simple) ---
nasa = NASAClient(api_key=NASA_API_KEY)
# 1. Get the cool space photo of the day
logger.info("Fetching APOD...")
pods = nasa.get_apod(start_date="2026-04-01", end_date="2026-04-07")
# print(pod)
for pod in pods:
print(f"Today's Title: {pod['title']}")
print(f"Today's URL: {pod['url']}")
print(f"Today's Explanation: {pod['explanation']}")
print(f"Date: {pod['date']}")
print("-"*100)
print("-" * 100)
# 2. Check for "Space Rocks" near us
logger.info("Searching for asteroids...")
asteroids = nasa.search_asteroids("2026-04-01", "2026-04-06")
print(f"Found: {asteroids['element_count']} asteroids this week!")
if __name__ == "__main__":
main()
Metadata
Release files for nasa-client-pro 0.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nasa_client_pro-0.8.0.tar.gz | 2.8 kB | Without provenance | Details for nasa_client_pro-0.8.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nasa_client_pro-0.8.0-py3-none-any.whl | Python 3 | none | any | Details for nasa_client_pro-0.8.0-py3-none-any.whl |
Total release size: 6.7 kB
Release files / nasa_client_pro-0.8.0.tar.gz
| Download URL | nasa_client_pro-0.8.0.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e4e262cf52838bc26e6d2cb982deab333287d9299f20ae66dd5b0230762a9789
|
|
BLAKE2b-256 checksum How to use checksums |
39aaeac9127a34526ba32bb640ce566d3dac669207f1ae01961eafbba4656978
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / nasa_client_pro-0.8.0-py3-none-any.whl
| Download URL | nasa_client_pro-0.8.0-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4b69809c7f6329885a65ac966f4554aef61a56f16e3dbebe96264872d9f4faa8
|
|
BLAKE2b-256 checksum How to use checksums |
8a54ca1250c7d4b16dc20752fb9fa4e5cd782808ffcafb605ab2d45273a4c274
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for nasa-client-pro 0.8.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.