Brightway2

Latest version: v2.4.6

Safety actively analyzes 629723 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 6 of 34

4.0.dev2

Fix bug for `prepare_lca_inputs` without remapping dicts.

4.0.dev1

Breaking changes

Python 2 compatibility removed

Removing the Python 2 compatibility layer allows for much cleaner and more compact code, and the use of some components from the in-development Brightway version 3 libraries.

All internal paths are now `pathlib.Path` objects

This allows for cleaner and more consistent code. Includes things like `projects.dir`.

`SingleFile` and `JSON` backends removed

These backends were implemented many years ago, and most of the current code already assumes the SQLite backend.

SQLite backend code refactored

The `peewee` directory is removed, and most of the code now lives in `bw2data.backends`. `LCIBackend` is removed, and now `SQLiteBackend` directly subclasses `ProcessedDataStore`.

Other changes

Use of `bw_processing`

We now use [bw_processing](https://github.com/brightway-lca/bw_processing) to create processed arrays. Processed arrays are compressed directories (because there is a metadata file as well, and possibly multiple array files). All databases, methods, etc. will need to be reprocessed, but this happens automatically via a data migration.

`bw_processing` has a completely different API, and LCA objects no longer have a single set of parameters (like `tech_params`) for each matrix - instead, they have data resources, which offer more flexibility, but also more complexity. See the `bw_processing`, `matrix_utils`, and `bw2calc` documentation.

Database IDs for activities preferred

Using integer IDs is the preferred way to identify activities and products in Brightway 3. You can now easily get the integer id of an activity:

python

>>> a = bw2data.Database("something").random()

>>> a.id
19014



And use the integer ID in the `get` functions:

python

>>> bw2data.get_activity(19014)
'treatment of aluminium in car shredder residue, municipal incineration' (kilogram, RoW, None)

>>> bw2data.Database("something").get(19014)
'treatment of aluminium in car shredder residue, municipal incineration' (kilogram, RoW, None)



You can also call `get_id` on activity keys:

python

>>> bw2data.get_id(a)
19014

>>> bw2data.get_id(a.key)
19014



`mapping` no longer used, though compatibility layer added

You can still import `mapping`, but this will just look up the IDs from the SQLite database. There is no longer a separate file.

This change means that you **can no longer add exchanges or characterization factors which reference activities that don't (yet) exist**.

Smaller changes

* `IOTableBackend.write` arguments have changed to `(products, prod_exchanges, tech_exchanges, bio_exchanges)`.
* `bw2data.utils.safe_filename` was moved to `bw_processing`
* `Database.get` is removed (though `Database('foo').get()` still works). Use `get_activity` instead.

3.6.2

* Fixed invalid variable name creation

3.6.1

Merged PR [19: Fix activityparam rename](https://bitbucket.org/cmutel/brightway2-data/pull-requests/19).

3.6

- Merged multiple pull requests ([12](https://bitbucket.org/cmutel/brightway2-data/pull-requests/12), [#13](https://bitbucket.org/cmutel/brightway2-data/pull-requests/13), [#14](https://bitbucket.org/cmutel/brightway2-data/pull-requests/14), [#15](https://bitbucket.org/cmutel/brightway2-data/pull-requests/15), [#16](https://bitbucket.org/cmutel/brightway2-data/pull-requests/16), [#17](https://bitbucket.org/cmutel/brightway2-data/pull-requests/17), [#18](https://bitbucket.org/cmutel/brightway2-data/pull-requests/18)) from Daniël de Koning related to improving the handling of parameters, as part of his work on including parameterization in the [Activity browser](https://github.com/LCA-ActivityBrowser/activity-browser).

3.5.1

- Remove temporary directories after tests finish

Page 6 of 34

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.