Skip to content

Commit

Permalink
Update release pipeline and solve fake object oriented problem with a…
Browse files Browse the repository at this point in the history
… solution that it deserves
  • Loading branch information
agahkarakuzu committed Aug 9, 2024
1 parent c06384a commit edd97b2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/test_release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Publish Python 🐍 distribution to TestPyPI
on: push
name: Publish TestPyPI

on:
push:
tags:
- 'v*.*.*'

jobs:
pypi-test-publish:
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
name: publish
on:
push:
tags:
- 'v*.*.*'

on:
workflow_run:
workflows: ['Publish TestPyPI']
types:
- completed

jobs:
pypi-publish:
name: upload release to PyPI
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
# Specifying a GitHub environment is optional, but strongly encouraged
environment: release
Expand Down
15 changes: 8 additions & 7 deletions repo2data/repo2data.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@ def __init__(self, data_requirement=None, server=False):
self._data_requirement_path = None
self._data_requirement_file = None
self._use_server = server
self._server_dst_folder = "./data"

self.load_data_requirement(data_requirement)

def set_server_dst_folder(self,directory):
self._server_dst_folder = directory

def _set_data_requirement_path(self, data_requirement_path):
"""Define path to the requirement file"""
if data_requirement_path is None:
Expand Down Expand Up @@ -99,19 +103,19 @@ def install(self):
for key, value in self._data_requirement_file.items():
if isinstance(value, dict):
ret += [Repo2DataChild(value, self._use_server,
self._data_requirement_path,key).install()]
self._data_requirement_path,key,self._server_dst_folder).install()]
# if not, it is a single assignment
else:
ret += [Repo2DataChild(self._data_requirement_file,
self._use_server, self._data_requirement_path).install()]
self._use_server, self._data_requirement_path, None, self._server_dst_folder).install()]

return ret


class Repo2DataChild():
"""Repo2data child class which install the dataset"""

def __init__(self, data_requirement_file=None, use_server=False, data_requirement_path=None, download_key = None):
def __init__(self, data_requirement_file=None, use_server=False, data_requirement_path=None, download_key = None, server_dst_folder=None):
"""Initialize the Repo2Data child class.
Parameters
----------
Expand All @@ -124,7 +128,7 @@ def __init__(self, data_requirement_file=None, use_server=False, data_requiremen
self._dst_path = None
self._use_server = use_server
self._data_requirement_path = data_requirement_path
self._server_dst_folder = "./data"
self._server_dst_folder = server_dst_folder
self._download_key = download_key
if self._download_key:
self._cache_record = f"{self._download_key}_repo2data_cache_record.json"
Expand All @@ -133,9 +137,6 @@ def __init__(self, data_requirement_file=None, use_server=False, data_requiremen

self.load_data_requirement(data_requirement_file)

def set_server_dst_folder(self,directory):
self._server_dst_folder = directory

def load_data_requirement(self, data_requirement_file):
"""Load the json data requirement file and set destination folder"""
# here we should load just a json data
Expand Down

0 comments on commit edd97b2

Please sign in to comment.