11Getting Started
22===============
33
4- This guide introduces the **versioned- config ** package, which simplifies management of
5- project settings and file I/O by combining them in a single :class: `~versioned_config .Config `
4+ This guide introduces the **config-versioned ** package, which simplifies management of
5+ project settings and file I/O by combining them in a single :class: `~config_versioned .Config `
66object.
77
88Data pipelines commonly require reading and writing data to versioned directories. Each
99directory might correspond to one step of a multi-step process, where the version
1010corresponds to particular settings for that step and a chain of prior steps that each
11- have their own respective versions. The :class: `~versioned_config .Config ` class makes it easy
11+ have their own respective versions. The :class: `~config_versioned .Config ` class makes it easy
1212to read and write versioned data based on YAML configuration files that can be saved
1313alongside each versioned output folder.
1414
@@ -22,9 +22,9 @@ string, and boolean settings as well as hierarchically nested values. The
2222.. code-block :: python
2323
2424 import importlib.resources as r
25- from versioned_config import Config
25+ from config_versioned import Config
2626
27- example_config_path = str (r.files(" versioned_config " ) / " data" / " example_config.yaml" )
27+ example_config_path = str (r.files(" config_versioned " ) / " data" / " example_config.yaml" )
2828
2929 The example YAML file looks like this:
3030
@@ -50,7 +50,7 @@ The example YAML file looks like this:
5050 versions :
5151 prepared_data : ' v1'
5252
53- Create a :class: `~versioned_config .Config ` object by passing either a path to a YAML file
53+ Create a :class: `~config_versioned .Config ` object by passing either a path to a YAML file
5454or a plain Python dict. The full config is stored in the ``config `` attribute:
5555
5656.. code-block :: python
@@ -62,7 +62,7 @@ Retrieving settings
6262-------------------
6363
6464You can access the config dict directly (``config.config["a"] ``), but
65- :meth: `~versioned_config .Config.get ` is preferable — it raises a clear ``KeyError `` if a
65+ :meth: `~config_versioned .Config.get ` is preferable — it raises a clear ``KeyError `` if a
6666setting is missing rather than returning ``None `` silently:
6767
6868.. code-block :: python
@@ -85,7 +85,7 @@ Working with directories
8585------------------------
8686
8787Two top-level keys — ``directories `` and ``versions `` — give the
88- :class: `~versioned_config .Config ` object its versioning capability. Each entry under
88+ :class: `~config_versioned .Config ` object its versioning capability. Each entry under
8989``directories `` must have:
9090
9191- **versioned ** (bool) — whether the directory has version subdirectories
@@ -96,8 +96,8 @@ For **versioned** directories the full path is ``{path}/{version}``, where the v
9696string comes from the ``versions `` dict. For **non-versioned ** directories the full
9797path is just ``path ``.
9898
99- Use :meth: `~versioned_config .Config.get_dir_path ` and
100- :meth: `~versioned_config .Config.get_file_path ` to build these paths:
99+ Use :meth: `~config_versioned .Config.get_dir_path ` and
100+ :meth: `~config_versioned .Config.get_file_path ` to build these paths:
101101
102102.. code-block :: python
103103
@@ -136,13 +136,13 @@ Reading and writing files
136136-------------------------
137137
138138Copy the bundled example CSV into the raw data directory, then use
139- :meth: `~versioned_config .Config.read ` and :meth: `~versioned_config .Config.write ` to move data
139+ :meth: `~config_versioned .Config.read ` and :meth: `~config_versioned .Config.write ` to move data
140140through the pipeline:
141141
142142.. code-block :: python
143143
144144 # Copy the example input file into the raw_data directory
145- example_csv = str (r.files(" versioned_config " ) / " data" / " example_input_file.csv" )
145+ example_csv = str (r.files(" config_versioned " ) / " data" / " example_input_file.csv" )
146146 shutil.copy(example_csv, config.get_file_path(" raw_data" , " a" ))
147147
148148 # Read the CSV (returns a pandas DataFrame)
@@ -159,21 +159,21 @@ through the pipeline:
159159 # Both files now appear in the versioned directory
160160 list (config.get_dir_path(" prepared_data" ).iterdir())
161161
162- These methods delegate to :func: `~versioned_config .autoread ` and
163- :func: `~versioned_config .autowrite `, which dispatch on file extension. To see every
162+ These methods delegate to :func: `~config_versioned .autoread ` and
163+ :func: `~config_versioned .autowrite `, which dispatch on file extension. To see every
164164supported extension:
165165
166166.. code-block :: python
167167
168- from versioned_config import get_file_reading_functions, get_file_writing_functions
168+ from config_versioned import get_file_reading_functions, get_file_writing_functions
169169
170170 sorted (get_file_reading_functions().keys())
171171 sorted (get_file_writing_functions().keys())
172172
173173 Saving the config alongside outputs
174174------------------------------------
175175
176- :meth: `~versioned_config .Config.write_self ` writes the current config dict as
176+ :meth: `~config_versioned .Config.write_self ` writes the current config dict as
177177``config.yaml `` into a named directory. This is useful for reproducibility — you can
178178always see exactly which settings produced a given set of outputs:
179179
@@ -188,7 +188,7 @@ Overriding versions at runtime
188188-------------------------------
189189
190190Rather than editing the YAML file between runs, you can pass a ``versions `` dict when
191- constructing a :class: `~versioned_config .Config ` object. This sets or overwrites the
191+ constructing a :class: `~config_versioned .Config ` object. This sets or overwrites the
192192specified versions while leaving all other settings unchanged — useful for command-line
193193scripts or automated pipelines:
194194
0 commit comments