Skip to content

Commit e193bb8

Browse files
committed
reworking testing tasks
1 parent 44d8b67 commit e193bb8

File tree

3 files changed

+80
-12
lines changed

3 files changed

+80
-12
lines changed

.github/workflows/docs.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# This workflows will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
name: Build docs
5+
6+
on:
7+
push:
8+
branches:
9+
- master
10+
pull_request:
11+
# release:
12+
# types: [published]
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
- name: Set up Python
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: '3.x'
27+
- name: Install Pandoc
28+
run: |
29+
sudo apt-get update
30+
sudo apt-get install -Y pandoc
31+
- name: Install dependencies
32+
run: |
33+
python -m pip install --upgrade pip
34+
pip install build twine
35+
36+
- name: Build docs
37+
run: |
38+
cd docs
39+
make html
40+
twine upload dist/*
41+
- uses: actions/upload-artifact@v3
42+
with:
43+
name: built-docs
44+
path: docs/build/html
45+
46+
deploy:
47+
needs: [build]
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: Download built docs
51+
uses: actions/download-artifact@v3
52+
with:
53+
name: built-docs
54+
path: docs-build
55+
- name: Check for GHPAGES_DEPLOY_KEY token
56+
id: deployable
57+
if: github.event_name == 'release'
58+
env:
59+
GHPAGES_DEPLOY_KEY: "${{ secrets.GHPAGES_DEPLOY_KEY }}"
60+
run: if [ -n "$GHPAGES_DEPLOY_KEY" ]; then echo "DEPLOY=true" >> $GITHUB_OUTPUT; fi
61+
- name: Deploy Docs to GitHub Pages
62+
if: steps.deployable.outputs.DEPLOY
63+
uses: peaceiris/actions-gh-pages@v3
64+
with:
65+
github_token: ${{ secrets.GHPAGES_DEPLOY_KEY }}
66+
publish_dir: docs-build

docs/source/tutorial/execution.ipynb

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,15 @@
1212
},
1313
{
1414
"cell_type": "code",
15-
"execution_count": 1,
15+
"execution_count": 5,
1616
"metadata": {},
1717
"outputs": [
18-
{
19-
"name": "stderr",
20-
"output_type": "stream",
21-
"text": [
22-
"A newer version (0.25) of nipype/pydra is available. You are using 0.25.dev71+g0dc7ec60.d20241216\n"
23-
]
24-
},
2518
{
2619
"name": "stdout",
2720
"output_type": "stream",
2821
"text": [
29-
"LoadJsonOutputs(out={'a': True, 'b': 'two', 'c': 3, 'd': [7, 0.5598136790149003, 6]})\n"
22+
"Sample JSON file created at '0UAqFzWsDK4FrUMp48Y3tT3Q.json' with contents: {\"a\": true, \"b\": \"two\", \"c\": 3, \"d\": [7, 0.5598136790149003, 6]}\n",
23+
"Loaded contents: {'a': True, 'b': 'two', 'c': 3, 'd': [7, 0.5598136790149003, 6]}\n"
3024
]
3125
}
3226
],
@@ -37,14 +31,17 @@
3731
"# Create a sample JSON file to test\n",
3832
"json_file = Json.sample()\n",
3933
"\n",
40-
"# Parameterise the task to load the JSON file\n",
34+
"# Print the path of the sample JSON file and its contents for reference\n",
35+
"print(f\"Sample JSON file created at {json_file.name!r} with contents: {json_file.read_text()}\")\n",
36+
"\n",
37+
"# Parameterise the task specification to load the JSON file\n",
4138
"load_json = LoadJson(file=json_file)\n",
4239
"\n",
43-
"# Run the task\n",
40+
"# Run the task to load the JSON file\n",
4441
"result = load_json()\n",
4542
"\n",
4643
"# Print the output interface of the of the task (LoadJson.Outputs)\n",
47-
"print(result.output)"
44+
"print(f\"Loaded contents: {result.output.out}\")"
4845
]
4946
},
5047
{

pydra/design/python.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ def define(
115115
The outputs of the function or class.
116116
auto_attribs : bool
117117
Whether to use auto_attribs mode when creating the class.
118+
119+
Returns
120+
-------
121+
PythonSpec
122+
The task specification class for the Python function
118123
"""
119124
from pydra.engine.task import PythonTask
120125
from pydra.engine.specs import PythonSpec, PythonOutputs

0 commit comments

Comments
 (0)