Skip to content

Commit 389bddb

Browse files
authored
Merge pull request #5 from globus/render-docs
Import doc site examples and setup rendering toolchain
2 parents a656e36 + c898a38 commit 389bddb

File tree

20 files changed

+1098
-21
lines changed

20 files changed

+1098
-21
lines changed

.flake8

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[flake8]
2+
exclude = .git,.tox,__pycache__,.eggs,dist,.venv*,docs,build
3+
max-line-length = 88
4+
extend-ignore = W503,W504,E203

.github/workflows/release.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# build and release new docs as a release asset
2+
name: 📦 Package Docs
3+
on:
4+
release:
5+
types: [created]
6+
7+
permissions:
8+
contents: "write"
9+
10+
jobs:
11+
doc:
12+
name: Bundle and Release Docs
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
16+
- uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
17+
with:
18+
python-version: "3.13"
19+
- name: Install pipx
20+
run: python -m pip install pipx
21+
- name: Build the Doc Bundle
22+
run: |
23+
pipx run ./support/build-doc-bundle.py -o doc_bundle.tar.gz
24+
# upload as a release asset
25+
- name: Upload Doc Bundle
26+
env:
27+
GH_TOKEN: ${{ github.token }}
28+
run: gh release upload "${{ github.ref_name }}" doc_bundle.tar.gz

.github/workflows/test.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: "🧪 Test"
2+
on:
3+
push:
4+
branches:
5+
- "main"
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
name: "${{ matrix.name }}"
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
include:
15+
- name: "Test"
16+
runner: "ubuntu-latest"
17+
cpythons:
18+
- "3.13"
19+
tox-environments:
20+
- "mypy"
21+
- "build_doc_bundle"
22+
cache-paths:
23+
- ".mypy_cache/"
24+
uses: "globus/workflows/.github/workflows/tox.yaml@f41714f6a8b102569807b348fce50960f9617df8" # v1.2
25+
with:
26+
config: "${{ toJSON(matrix) }}"

.pre-commit-config.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,26 @@ repos:
2222
- id: codespell
2323
args: ["--ignore-regex", "https://[^\\s]*"]
2424

25+
- repo: https://github.com/python-jsonschema/check-jsonschema
26+
rev: 0.33.0
27+
hooks:
28+
- id: check-github-workflows
29+
2530
- repo: "https://github.com/sirosen/texthooks"
2631
rev: 0.6.8
2732
hooks:
2833
- id: alphabetize-codeowners
34+
35+
- repo: https://github.com/psf/black-pre-commit-mirror
36+
rev: 25.1.0
37+
hooks:
38+
- id: black
39+
40+
- repo: https://github.com/PyCQA/flake8
41+
rev: 7.2.0
42+
hooks:
43+
- id: flake8
44+
additional_dependencies:
45+
- 'flake8-bugbear==24.12.12'
46+
- 'flake8-comprehensions==3.16.0'
47+
- 'flake8-typing-as-t==1.0.0'

compute_transfer_examples/register_compute_func.py

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
11
#!/usr/bin/env python
22

3+
34
def do_tar(
45
src_paths: list[str],
56
dest_path: str,
67
gcs_base_path: str = "/",
78
) -> str:
89
"""
9-
Create a tar.gz archive from source files or directories and save it to the given destination.
10+
Create a tar.gz archive from source files or directories and save it to the
11+
given destination.
1012
1113
Parameters:
1214
src_paths (list[str]): Source paths of files or directories to be archived.
13-
dest_path (str): Destination path where the tar.gz archive will be written. This can be either
14-
an existing directory or a file path (with the parent directory existing).
15-
gcs_base_path (str): The shared GCS collection's configured base path. Default is "/".
15+
dest_path (str): Destination path where the tar.gz archive will be
16+
written. This can be either an existing directory or a
17+
file path (with the parent directory existing).
18+
gcs_base_path (str): The shared GCS collection's configured base path.
19+
Default is "/".
1620
1721
Returns:
1822
str: The output tar archive file path.
1923
2024
Raises:
21-
ValueError: If src_paths is empty, dest_path is None, any provided path does not begin with the expected
22-
prefix, or if any source path or destination (or its parent) is invalid.
25+
ValueError: If src_paths is empty, dest_path is None, any provided path
26+
does not begin with the expected prefix, or if any source
27+
path or destination (or its parent) is invalid.
2328
RuntimeError: If an error occurs during the creation of the tar archive.
2429
2530
Example:
@@ -48,7 +53,8 @@ def transform_path_from_absolute(path: str) -> str:
4853
"""Transform an absolute filesystem path back to a GCS-style path."""
4954
if not path.startswith(gcs_base_path):
5055
raise ValueError(
51-
f"Path '{path}' does not start with the expected prefix '{gcs_base_path}'."
56+
f"Path '{path}' does not start with "
57+
f"the expected prefix '{gcs_base_path}'."
5258
)
5359
return path.replace(gcs_base_path, "/", 1)
5460

@@ -72,7 +78,9 @@ def transform_path_from_absolute(path: str) -> str:
7278
# Validate transformed_dest_path
7379
if transformed_dest_path.exists():
7480
if not (transformed_dest_path.is_dir() or transformed_dest_path.is_file()):
75-
raise ValueError(f"Destination path '{dest_path}' is neither a directory nor a file.")
81+
raise ValueError(
82+
f"Destination path '{dest_path}' is neither a directory nor a file."
83+
)
7684
else:
7785
if not transformed_dest_path.parent.exists():
7886
raise ValueError(
@@ -95,7 +103,10 @@ def transform_path_from_absolute(path: str) -> str:
95103
transformed_dest_tar_path = transformed_dest_path.with_name(fn + ".tar.gz")
96104

97105
# Informative message (could be replaced with logging.info in production code)
98-
print(f"Creating tar file at {transformed_dest_tar_path.absolute()} with {len(transformed_src_paths)} source(s)")
106+
print(
107+
f"Creating tar file at {transformed_dest_tar_path.absolute()} "
108+
f"with {len(transformed_src_paths)} source(s)"
109+
)
99110

100111
# Create the tar.gz archive with exception handling.
101112
try:
@@ -108,11 +119,16 @@ def transform_path_from_absolute(path: str) -> str:
108119
try:
109120
transformed_dest_tar_path.unlink()
110121
except Exception as unlink_err:
111-
print(f"Warning: Failed to remove incomplete tar file '{transformed_dest_tar_path}': {unlink_err}")
122+
print(
123+
f"Warning: Failed to remove incomplete tar file "
124+
f"'{transformed_dest_tar_path}': {unlink_err}"
125+
)
112126
raise RuntimeError(f"Failed to create tar archive: {e}") from e
113127

114128
# Transform the output path back to a GCS-style path and return.
115-
result_path = transform_path_from_absolute(str(transformed_dest_tar_path.absolute()))
129+
result_path = transform_path_from_absolute(
130+
str(transformed_dest_tar_path.absolute())
131+
)
116132
return result_path
117133

118134

support/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Support Tooling for Globus Flows Examples
2+
3+
This directory contains internal tools for maintaining the example repository.

0 commit comments

Comments
 (0)