Contains all the python boilerplate you need to create a Brightway ecosystem package.
Project description
trailpack
Installation
You can install trailpack via [pip] from [PyPI]:
$ pip install trailpack
Usage
Web UI
Trailpack includes a Streamlit-based web UI for mapping Excel columns to PyST concepts:
# Run the UI
streamlit run trailpack/ui/streamlit_app.py
Or using the run script:
python trailpack/ui/run_streamlit.py
The UI provides a 3-step workflow with smooth transitions:
- Upload File & Select Language: Upload an Excel file and select language for PyST mapping
- Select Sheet: Choose which sheet to process with data preview
- Map Columns: Map each column to PyST concepts with automatic suggestions and dataframe preview
The view object is stored internally for further processing.
For more details, see trailpack/ui/README.md.
Deploying to Streamlit Cloud? See STREAMLIT_DEPLOYMENT.md for complete deployment instructions.
Python API
You can also use trailpack programmatically:
from trailpack.excel import ExcelReader
from trailpack.pyst.api.client import get_suggest_client
# Read Excel structure
reader = ExcelReader("data.xlsx")
sheets = reader.sheets()
columns = reader.columns("Sheet1")
# Get PyST suggestions
client = get_suggest_client()
suggestions = await client.suggest("carbon footprint", "en")
✨ New: UI-Ready DataPackage Schema Classes
This project now includes comprehensive schema classes for building data package metadata through user interfaces:
Key Features
DataPackageSchema: Defines field types, validation rules, and UI configurationMetaDataBuilder: Fluent interface for creating metadata programmatically- Field validation: Built-in validation for package names, versions, URLs
- UI integration ready: Field definitions include labels, placeholders, patterns
- Standards compliant: Follows Frictionless Data Package specification
Quick Example
from trailpack.datapackage_schema import MetaDataBuilder, Resource, Field
# Create metadata with fluent interface
metadata = (MetaDataBuilder()
.set_basic_info(name="my-dataset", title="My Dataset")
.add_license("CC-BY-4.0")
.add_contributor("Your Name", "author")
.add_resource(Resource(name="data", path="data.parquet"))
.build())
# Use with existing Packing class
from trailpack.packing import Packing
packer = Packing(df, metadata)
packer.write_parquet("output.parquet")
UI Integration
The schema classes provide everything needed for UI frameworks:
- Field definitions with types, labels, validation patterns
- Enumerated options for dropdowns (licenses, profiles, etc.)
- Built-in validation methods
- Error messages for invalid input
See examples/datapackage_ui_demo.py for detailed usage examples.
Contributing
Contributions are very welcome. To learn more, see the Contributor Guide.
License
Distributed under the terms of the MIT license, trailpack is free and open source software.
Issues
If you encounter any problems, please file an issue along with a detailed description.
Building the Documentation
You can build the documentation locally by installing the documentation Conda environment:
conda env create -f docs/environment.yml
activating the environment
conda activate sphinx_trailpaack
and running the build command:
sphinx-build docs _build/html --builder=html --jobs=auto --write-all; open _build/html/index.html
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file trailpack-0.1.0.tar.gz.
File metadata
- Download URL: trailpack-0.1.0.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3356e0675905420f6a7efeb76cd1d6065f46ff7d3918e0b8ba6731bdc8d655b
|
|
| MD5 |
18ea6ea600aad7fb149c4c17178997cb
|
|
| BLAKE2b-256 |
966b25f421a53c04e7ccde055d492bfe4c453f49ab28f6bac68b1f732a4bd941
|
Provenance
The following attestation bundles were made for trailpack-0.1.0.tar.gz:
Publisher:
python-package-deploy.yml on TimoDiepers/trailpack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
trailpack-0.1.0.tar.gz -
Subject digest:
e3356e0675905420f6a7efeb76cd1d6065f46ff7d3918e0b8ba6731bdc8d655b - Sigstore transparency entry: 607664714
- Sigstore integration time:
-
Permalink:
TimoDiepers/trailpack@4d42e2deb75b3b47ebeb1aa348feb12f4775fc1a -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/TimoDiepers
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-package-deploy.yml@4d42e2deb75b3b47ebeb1aa348feb12f4775fc1a -
Trigger Event:
push
-
Statement type:
File details
Details for the file trailpack-0.1.0-py3-none-any.whl.
File metadata
- Download URL: trailpack-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a764d5368903b94af80d524934fa1f58c996d664f9be1328a3b21ae27047525
|
|
| MD5 |
4c5592bac1123499a8b6ab14aeacaa2b
|
|
| BLAKE2b-256 |
75378b477f7d7808dc45e52e3297e70216139d7511eb95a4c6acb774a42308d1
|
Provenance
The following attestation bundles were made for trailpack-0.1.0-py3-none-any.whl:
Publisher:
python-package-deploy.yml on TimoDiepers/trailpack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
trailpack-0.1.0-py3-none-any.whl -
Subject digest:
1a764d5368903b94af80d524934fa1f58c996d664f9be1328a3b21ae27047525 - Sigstore transparency entry: 607664715
- Sigstore integration time:
-
Permalink:
TimoDiepers/trailpack@4d42e2deb75b3b47ebeb1aa348feb12f4775fc1a -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/TimoDiepers
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-package-deploy.yml@4d42e2deb75b3b47ebeb1aa348feb12f4775fc1a -
Trigger Event:
push
-
Statement type: