pudl.workspace.setup
#
Tools for setting up and managing PUDL workspaces.
Module Contents#
Classes#
These settings provide access to various PUDL directories. |
Functions#
Attributes#
- class pudl.workspace.setup.PudlPaths(_case_sensitive: bool | None = None, _env_prefix: str | None = None, _env_file: pydantic_settings.sources.DotenvType | None = ENV_FILE_SENTINEL, _env_file_encoding: str | None = None, _env_nested_delimiter: str | None = None, _secrets_dir: str | pathlib.Path | None = None, **values: Any)[source]#
Bases:
pydantic_settings.BaseSettings
These settings provide access to various PUDL directories.
It is primarily configured via PUDL_INPUT and PUDL_OUTPUT environment variables. Other paths of relevance are derived from these.
- property input_dir: pathlib.Path[source]#
Path to PUDL input directory.
- property output_dir: pathlib.Path[source]#
Path to PUDL output directory.
- property settings_dir: pathlib.Path[source]#
Path to directory containing settings files.
- property data_dir: pathlib.Path[source]#
Path to PUDL data directory.
- sqlite_db_uri(name: str) str [source]#
Returns url of locally stored pudl sqlite database with given name.
The name is expected to be the name of the database without the .sqlite suffix. E.g. pudl, ferc1 and so on.
- sqlite_db_path(name: str) pathlib.Path [source]#
Return path to locally stored SQLite DB file.
- output_file(filename: str) pathlib.Path [source]#
Path to file in PUDL output directory.
- pudl.workspace.setup.init(clobber=False)[source]#
Set up a new PUDL working environment based on the user settings.
- Parameters:
clobber (bool) – if True, replace existing files. If False (the default) do not replace existing files.
- Returns:
None
- pudl.workspace.setup.deploy(pkg_path: str, deploy_dir: pathlib.Path, ignore_files: list[str], clobber: bool = False) None [source]#
Deploy all files from a package_data directory into a workspace.
- Parameters:
pkg_path – Dotted module path to the subpackage inside of package_data containing the resources to be deployed.
deploy_dir – Directory on the filesystem to which the files within pkg_path should be deployed.
ignore_files – List of filenames (strings) that may be present in the pkg_path subpackage, but that should be ignored.
clobber – if True, replace existing copies of the files that are being deployed from pkg_path to deploy_dir. If False, do not replace existing files.
- Returns:
None