Sfoglia il codice sorgente

test using datalad api in pydoit

Johannes Gütschow 9 mesi fa
parent
commit
8dfe888d3a
2 ha cambiato i file con 22 aggiunte e 5 eliminazioni
  1. 19 5
      dodo.py
  2. 3 0
      pyproject.toml

+ 19 - 5
dodo.py

@@ -4,8 +4,11 @@ Define the tasks for UNFCCC data repository
 import os
 import sys
 
+import datalad.api
 from doit import get_var
 
+root_path = "."
+
 # TODO: task for folder mapping
 
 # create virtual environment
@@ -85,10 +88,21 @@ def task_update_bur():
     """Update list of BUR submissions"""
     return {
         "targets": ["downloaded_data/UNFCCC/submissions-bur.csv"],
+        # "actions": [
+        #     'datalad run -m "Fetch BUR submissions" '
+        #     "-o downloaded_data/UNFCCC/submissions-bur.csv "
+        #     "python src/unfccc_ghg_data/unfccc_downloader/fetch_submissions_bur.py"
+        # ],
         "actions": [
-            'datalad run -m "Fetch BUR submissions" '
-            "-o downloaded_data/UNFCCC/submissions-bur.csv "
-            "python src/unfccc_ghg_data/unfccc_downloader/fetch_submissions_bur.py"
+            datalad.api.run(
+                cmd="python3 src/unfccc_ghg_data/unfccc_downloader/"
+                "fetch_submissions_bur.py",
+                dataset=root_path,
+                message="Fetch BUR submissions",
+                outputs="downloaded_data/UNFCCC/submissions-bur.csv",
+                dry_run=None,
+                explicit=True,
+            )
         ],
         "task_dep": ["set_env"],
         "verbosity": 2,
@@ -222,7 +236,7 @@ def task_update_btr():
         ],
         "task_dep": ["set_env"],
         "verbosity": 2,
-        "setup": ["setup_venv"],
+        "setup": ["in_venv"],
     }
 
 
@@ -243,7 +257,7 @@ def task_download_btr():
         ],
         "task_dep": ["set_env"],
         "verbosity": 2,
-        "setup": ["setup_venv"],
+        "setup": ["in_venv"],
     }
 
 

+ 3 - 0
pyproject.toml

@@ -142,6 +142,9 @@ docstring-code-format = true
 "scripts/*" = [
     "S101" # S101 Use of `assert` detected
 ]
+"dodo.py" = [
+    "E501"  # don't enforce line length
+]
 
 [tool.ruff.isort]
 known-first-party = ["src"]