-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathupdate_registry.py
More file actions
33 lines (25 loc) · 844 Bytes
/
update_registry.py
File metadata and controls
33 lines (25 loc) · 844 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import os
import yaml
import pandas as pd
from methods_io import read_project_cards
from methods_add_cards import add_cards_to_registry
CARD_DIR = os.path.join(".", "projects")
REGISTRY_FILE = "registry.csv"
CONFIG_FILE = "registry_config.yml"
def update_registry(
config_file: str = CONFIG_FILE,
input_reg_file: str = REGISTRY_FILE,
output_reg_file: str = REGISTRY_FILE,
card_dir: str = CARD_DIR,
write_card_updates: bool = True,
):
input_reg_df = pd.read_csv(input_reg_file)
with open(config_file, "r") as file:
config_dict = yaml.safe_load(file)
card_file_list = read_project_cards(card_dir)
df = add_cards_to_registry(
card_file_list, input_reg_df, config_dict, write_card_updates
)
df.to_csv(output_reg_file, index=False)
if __name__ == "__main__":
update_registry()