Skip to content

Commit

Permalink
16.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
imahdimir committed Oct 16, 2023
1 parent 76fdc5a commit af35125
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "githubdata"
version = "16.0.0"
version = "16.1.0"
authors = [{ name = "Mahdi Mir", email = "[email protected]" }]
description = "A simple Python package to easily download from and manage a GitHub \"Data repository\""
readme = "README.md"
Expand Down
3 changes: 3 additions & 0 deletions src/githubdata/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from .github_data_repo import default_githubdata_dir
from .github_data_repo import GitHubDataRepo
from .utils import clone_overwrite_a_repo__ret_gdr_obj
from .utils import commit_and_push_by_u_repo
from .utils import get_data_wo_double_clone
from .utils import make_data_fn
from .utils import upload_2_github
18 changes: 18 additions & 0 deletions src/githubdata/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,21 @@ def clone_overwrite_a_repo__ret_gdr_obj(gd_url) :
gdr = GitHubDataRepo(gd_url)
gdr.clone_overwrite()
return gdr

def commit_and_push_by_u_repo(gdr: GitHubDataRepo) :
msg = 'Updated by associated \"u-\" repo/code'
gdr.commit_and_push(msg)

def upload_2_github(df , fn: str , gdr: GitHubDataRepo) :
if hasattr(gdr , "data_fp") :
dfp = gdr.data_fp
dfp.unlink()

nfp = gdr.local_path / fn

df.to_parquet(nfp , index = False)

commit_and_push_by_u_repo(gdr)

def make_data_fn(dn , iso_date) :
return "{}_{}.parquet".format(dn , iso_date)

0 comments on commit af35125

Please sign in to comment.