pudl.workspace.setup
#
Tools for setting up and managing PUDL workspaces.
Module Contents#
Classes#
Validates potential path that doesn't exist. |
|
These settings provide access to various PUDL directories. |
Functions#
Attributes#
- class pudl.workspace.setup.MissingPath[source]#
Bases:
pathlib.Path
Validates potential path that doesn’t exist.
- classmethod validate(value: pathlib.Path) pathlib.Path [source]#
Validates that path doesn’t exist.
- class pudl.workspace.setup.PudlPaths[source]#
Bases:
pydantic.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.
- property pudl_db: pathlib.Path[source]#
Returns url of locally stored pudl sqlite database.
- sqlite_db(name: str) str [source]#
Returns url of locally stored pudl slqlite 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.
- 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