bw2data.project#

Module Contents#

Classes#

ProjectDataset

ProjectManager

Functions#

lockable()

writable_project(wrapped, instance, args, kwargs)

Attributes#

READ_ONLY_PROJECT

projects

class bw2data.project.ProjectDataset[source]#

Bases: peewee.Model

Inheritance diagram of bw2data.project.ProjectDataset
data[source]#
full_hash[source]#
name[source]#
class bw2data.project.ProjectManager[source]#

Bases: collections.abc.Iterable

Inheritance diagram of bw2data.project.ProjectManager
property current[source]#
property dir[source]#
property logs_dir[source]#
property output_dir[source]#

Get directory for output files.

Uses environment variable BRIGHTWAY2_OUTPUT_DIR; preferences['output_dir']; or directory output in current project.

Returns output directory path.

property twofive[source]#
_basic_directories = ('backups', 'intermediate', 'lci', 'processed')[source]#
_is_temp_dir = False[source]#
read_only = False[source]#
_create_base_directories()[source]#
_do_automatic_updates()[source]#

Run any available automatic updates

_get_base_directories()[source]#
_reset_meta()[source]#
_reset_sqlite3_databases()[source]#
_restore_orig_directory()[source]#

Point the ProjectManager back to original directories.

Used exclusively in tests.

_use_temp_directory()[source]#

Point the ProjectManager towards a temporary directory instead of user_data_dir.

Used exclusively for tests.

copy_project(new_name, switch=True)[source]#

Copy current project to a new project named new_name. If switch, switch to new project.

create_project(name=None, **kwargs)[source]#
delete_project(name=None, delete_dir=False)[source]#

Delete project name, or the current project.

name is the project to delete. If name is not provided, delete the current project.

By default, the underlying project directory is not deleted; only the project name is removed from the list of active projects. If delete_dir is True, then also delete the project directory.

If deleting the current project, this function sets the current directory to default if it exists, or to a random project.

Returns the current project.

migrate_project_25()[source]#

Migrate project to Brightway 2.5.

Reprocesses all databases and LCIA objects.

purge_deleted_directories()[source]#

Delete project directories for projects which are no longer registered.

Returns number of directories deleted.

report()[source]#

Give a report on current projects, including installed databases and file sizes.

Returns tuples of (project name, number of databases, size of all databases (GB)).

request_directory(name)[source]#

Return the absolute path to the subdirectory dirname, creating it if necessary.

Returns False if directory can’t be created.

set_current(name, writable=True, update=True)[source]#
use_full_hash()[source]#
use_short_hash()[source]#
bw2data.project.lockable()[source]#
bw2data.project.writable_project(wrapped, instance, args, kwargs)[source]#
bw2data.project.READ_ONLY_PROJECT = Multiline-String[source]#
Show Value
"""
***Read only project***

This project is being used by another process and no writes can be made until:
    1. You close the other program, or switch to a different project, *and*
    2. You call `projects.enable_writes` *and* get the response `True`.

    If you are **sure** that this warning is incorrect, call
    `projects.enable_writes(force=True)` to enable writes.
"""
bw2data.project.projects[source]#