Skip to content

Commit

Permalink
Some further small refactorings
Browse files Browse the repository at this point in the history
  • Loading branch information
maxschulz-COL committed Oct 18, 2024
1 parent 61d3da8 commit 4574abc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
1 change: 0 additions & 1 deletion .github/workflows/pycafe-dashboards-in-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ jobs:
RUN_ID: ${{ github.run_id }}
GITHUB_REPOSITORY: ${{ github.repository }}
PR_NUMBER: ${{ github.event.number }}
GITHUB_OWNER: mckinsey

run: |
cd vizro-core
Expand Down
10 changes: 3 additions & 7 deletions tools/pycafe/create_pycafe_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
GITHUB_TOKEN = str(os.getenv("GITHUB_TOKEN"))
REPO_NAME = str(os.getenv("GITHUB_REPOSITORY"))
PR_NUMBER = int(os.getenv("PR_NUMBER"))


RUN_ID = str(os.getenv("RUN_ID"))
PACKAGE_VERSION = subprocess.check_output(["hatch", "version"]).decode("utf-8").strip()
PYCAFE_URL = "https://py.cafe"
Expand All @@ -39,10 +37,7 @@ def generate_link(directory: str, extra_requirements: Optional[list[str]] = None
base_url = f"https://raw.githubusercontent.com/mckinsey/vizro/{commit_sha}/vizro-core/{directory}"

# Requirements
if extra_requirements:
extra_requirements_concat: str = "\n".join(extra_requirements)
else:
extra_requirements_concat = ""
extra_requirements_concat = "\n".join(extra_requirements) if extra_requirements else ""
requirements = (
f"""{PYCAFE_URL}/gh/artifact/mckinsey/vizro/actions/runs/{RUN_ID}/pip/vizro-{PACKAGE_VERSION}-py3-none-any.whl\n"""
+ extra_requirements_concat
Expand All @@ -52,7 +47,8 @@ def generate_link(directory: str, extra_requirements: Optional[list[str]] = None
app_file_path = os.path.join(directory, "app.py")
app_content = Path(app_file_path).read_text()
app_content_split = app_content.split('if __name__ == "__main__":')
app_content = app_content_split[0] + textwrap.dedent(app_content_split[1])
if len(app_content_split) > 1:
app_content = app_content_split[0] + textwrap.dedent(app_content_split[1])

# JSON object
json_object = {
Expand Down

0 comments on commit 4574abc

Please sign in to comment.