Description
Python utilities supporting Expert API integrations with StellaSpark Nexus, a real-time digital twin platform for monitoring and simulating the natural and built environment. These utilities are primarily intended for calculations, data pipelines, and automation workflows that interact with Nexus on a database-level.
Compatible with Python 3.7 – 3.14.
About StellaSpark Nexus
StellaSpark Nexus is a digital twin platform that combines geospatial data and time series and turns it into interactive 2D/3D maps, dashboards and a unified API. It is used by governments, NGOs, utilities, contractors, engineers, and technical consultants to unify live data, run operational forecasts and scenario analysis, and share insights across organizations and public stakeholders. It is used in domains such as:
- Urban planning
- Infrastructure and construction
- Water and environmental management
- Energy and utilities
- Mobility and telecommunications
- Real estate
The platform integrates live data from sensors, virtually all geospatial file formats, databases, and external APIs (REST/WFS/database), enabling monitoring, analysis, simulation, and secure data sharing. This repository contains Python utilities that support those workflows.
Installation
Install via PyPI:
pip install stellaspark-utils
Usage
from sqlalchemy import text
from stellaspark_utils.db import get_indexes, DatabaseManager
from stellaspark_utils.text import parse_time_placeholders
# DatabaseManager is a wrapper around a SQLAlchemy engine to set working memory and pool size the DRY way.
# Example 1 instance with argument 'db_url'
db_url = "postgres://<user>:<password>@<host>:<port>/<name>"
db_manager = DatabaseManager(db_url=db_url, max_mb_mem_per_db_worker=64, engine_pool_size=2)
# Example 2 instance with argument 'db_settings'
db_settings = {"USER":"<user>", "PASSWORD":"<password>", "HOST":"<host>", "PORT":"<port>", "NAME":"<name>"}
db_manager = DatabaseManager(db_settings=db_settings, max_mb_mem_per_db_worker=64, engine_pool_size=2)
# This SQL transaction is limited by working memory (max_mb_mem_per_db_worker):
result = db_manager.execute("<sql_query>").all()
# This is also limited by working memory:
with db_manager.get_connection() as connection:
result = connection.execute(text("<sql_query>")).all()
# This SQL transaction is NOT limited by working memory. Only use if you deliberately need to bypass the
# work_mem cap:
with db_manager.engine.connect() as connection:
result = connection.execute(text("<sql_query>")).all()
Development
Build devcontainer image
cd <project_root>
docker-compose build stellaspark_utils
Test coverage (release 4.5)
Name Stmts Miss Cover
-----------------------------------------------
setup.py 9 9 0%
stellaspark_utils/db.py 198 84 58%
stellaspark_utils/text.py 110 82 25%
-----------------------------------------------
TOTAL 317 175 45%
Release
Preparation
- Create a PyPI account and after registering, make sure your account has a PyPI token
- Update version in setup.py
- Update the CHANGES.rst with a change message and release date of today
- Optionally, autoformat code (see above)
- Push changes to GitHub (preferably in a branch 'release__')
Release steps
cd <project_root>
make_nice # Autoformat python code
pytest # Test against every Python version listed in setup.py's classifiers
build # Runs pip-audit
release # When prompted for password use your PyPI token including the 'pypi-' prefix
Metadata
Release files for stellaspark-utils 4.5
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 |
|---|---|---|---|---|
| stellaspark_utils-4.5.tar.gz | 16.6 kB | Without provenance | Details for stellaspark_utils-4.5.tar.gz |
Release files / stellaspark_utils-4.5.tar.gz
| Download URL | stellaspark_utils-4.5.tar.gz |
|---|---|
| Size | 16.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
193e900d2a7c394c250ccc3ee64bd4503c7656647b1a9dbff3ae4bed899bbe12
|
|
BLAKE2b-256 checksum How to use checksums |
b3c676d32e976b6bd8fc91c884b5d7b814ae0c44e0a9db37baabc0e71f98384d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.9
|
Security for stellaspark-utils 4.5
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.