From ec10f5e3f86c4a716fdfec78eccea3ec0dddfac0 Mon Sep 17 00:00:00 2001 From: Nikhil Woodruff Date: Mon, 26 May 2025 23:10:25 +0100 Subject: [PATCH 1/2] Data upload is missing HF token Fixes #272 --- changelog_entry.yaml | 4 ++++ policyengine_us_data/utils/data_upload.py | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29b..583f16e7 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: patch + changes: + fixed: + - Missing HF token. diff --git a/policyengine_us_data/utils/data_upload.py b/policyengine_us_data/utils/data_upload.py index 721c4c77..3e82ca87 100644 --- a/policyengine_us_data/utils/data_upload.py +++ b/policyengine_us_data/utils/data_upload.py @@ -6,6 +6,7 @@ from importlib import metadata import google.auth import logging +import os def upload_data_files( @@ -43,7 +44,10 @@ def upload_files_to_hf( """ api = HfApi() hf_operations = [] - + + token = os.environ.get( + "HUGGING_FACE_TOKEN", + ) for file_path in files: file_path = Path(file_path) if not file_path.exists(): @@ -55,6 +59,7 @@ def upload_files_to_hf( ) ) commit_info = api.create_commit( + token=token, repo_id=hf_repo_name, operations=hf_operations, repo_type=hf_repo_type, @@ -64,6 +69,7 @@ def upload_files_to_hf( # Tag commit with version api.create_tag( + token=token, repo_id=hf_repo_name, tag=version, revision=commit_info.oid, From ec96af1e2c261dec515d3338b171d29f61856049 Mon Sep 17 00:00:00 2001 From: Nikhil Woodruff Date: Mon, 26 May 2025 23:10:53 +0100 Subject: [PATCH 2/2] Format --- policyengine_us_data/utils/data_upload.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/policyengine_us_data/utils/data_upload.py b/policyengine_us_data/utils/data_upload.py index 3e82ca87..7e84a2d7 100644 --- a/policyengine_us_data/utils/data_upload.py +++ b/policyengine_us_data/utils/data_upload.py @@ -44,7 +44,7 @@ def upload_files_to_hf( """ api = HfApi() hf_operations = [] - + token = os.environ.get( "HUGGING_FACE_TOKEN", )