bw_matchbox
bw_matchbox is a web app for matching two Brightway. It allows you to do complicated matches, such as:
- Link process a to processes b and c, with allocation factors
- Link process a to a proxy for process b, changing the exchange values in b proxy to match those in process a where desired
- Link process a to a proxy for process b, removing some exchanges from b and adding some from a
- Link process a to a proxy for process b, expanding and inlining some exchanges from b to "flatten" its supply chain
Installation
You can install bw_matchbox via [pip] from [PyPI]:
pip install bw_matchbox
It's possible to install the library itself for development purposes (in the cloned project):
pip install -e .
This library depends on:
- Brightway 2.5 (
brightway25) docopt-ngflaskandflask_httpauthtomliwerkzeug
Usage
This is a flask application. Flask has a debug server suitable for development, but it should not be used for production!
To use bw_matchbox, you need to do the following:
Create a configuration file
Configuration is done via a toml file. See config_example.toml for the structure of this file. Here is an example:
[users]
jane = "deer"
john = "doe"
[roles]
editors = ["jane"]
reviewers = ["john"]
[configs]
my_config = { project = "something", source = "database A", target = "database B", proxy = "database C"}
[files]
output_dir = "/Path/to/some/directory"
The config.toml file needs to provide the following:
[users]section: Authentication, via a set of usernames and passwords[roles]section: The exact role labels must be used. Editors can make changes, reviewers can only comment.[configs]section: A combination of Brightway project and the source, target and proxy databases.[files]section: Currently only uses theoutput_dirkey.
The easiest way to set this up is with:
matchbox setup
This will create stub configuration and changes files in your current working directory - note that you should change the configuration and username/password in config.toml.
Running the development server
Just run:
matchbox webapp config.toml
Running in production
You will need to configure the Flask app using configure_app, or re-implement its functionality. Here is an example using waitress:
from bw_matchbox import matchbox_app, configure_app
config_filepath = "/path/to/config.toml"
app = configure_app(config_filepath, matchbox_app)
from waitress import serve
serve(app, port=8080)
Starting the app
Once the app is running and configured locally or remotely, connect to the correct address and port. If you are running locally, this is probably either http://localhost:5000 or http://127.0.0.1:5000.
In the first screen, choose the Brightway project you want to work on. This is matchbox-example if you ran matchbox example_project.
On the next screen, choose one database as the source, and a different database as the target. Currently you need to specify a new proxy database by typing a new database name into the Create a new database input box.
Contributing
Contributions are very welcome. To learn more, see the Contributor Guide.
License
Distributed under the terms of the MIT license, bw_matchbox is free and open source software.
Issues
If you encounter any problems, please [file an issue] along with a detailed description.
Metadata
Release files for bw-matchbox 2.6
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 |
|---|---|---|---|---|
| bw_matchbox-2.6.tar.gz | 187.8 kB | Without provenance | Details for bw_matchbox-2.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bw_matchbox-2.6-py3-none-any.whl | Python 3 | none | any | Details for bw_matchbox-2.6-py3-none-any.whl |
Total release size: 453.0 kB
Release files / bw_matchbox-2.6.tar.gz
| Download URL | bw_matchbox-2.6.tar.gz |
|---|---|
| Size | 187.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8377c826d340302c78a71896e4113d5f73e2d361e7f4ac7e04eaa4712e35985e
|
|
BLAKE2b-256 checksum How to use checksums |
850fcaac8d494f5fe3396cf28c1975ad109ca5244a77d0a50c360dfe4faf94a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / bw_matchbox-2.6-py3-none-any.whl
| Download URL | bw_matchbox-2.6-py3-none-any.whl |
|---|---|
| Size | 265.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d5899e53d6a7201d292d71309745ac002f533d70908c2f3e67030590b3a9c3a0
|
|
BLAKE2b-256 checksum How to use checksums |
a5d139c077bd534327f70c62953e278f187c8ba98f3984e31e313415524bd2a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Security for bw-matchbox 2.6
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.