Skip to content

Commit 3d27841

Browse files
🧪 Update version and testing for release (#75)
* remove new functionality * change version * add staging branch to client-server compatibility * update API * start changing docu * update tutorial * update documentation * make sure master is up to date with changes to staging * skip notebook tests if not correct versions * minor changes to make notebook tests pass * fix * cosmetic change * update basic tutorial * attempt to add workflow for publishing both packages * go back to 3.9 * introduce dev features flag * change e2e tests * cosmetic change * add dev feature flag to pytest ini * improve decorator * improve logging * naming change * change naming conventions for e2e tests * ensure to record dev features * minor change * fix install script * fix run script * improve client ref * update compatibility json * minor change
1 parent d732e18 commit 3d27841

21 files changed

+997
-327
lines changed

‎.github/workflows/publish-python-client.yml‎

Lines changed: 77 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ jobs:
1414
build-n-publish:
1515
runs-on: ubuntu-latest
1616
outputs:
17-
wheel: ${{ steps.find-wheel.outputs.osparc-wheel-path }}
18-
dist-dir: ${{ steps.find-wheel.outputs.osparc-auto-wheel-dir }}
17+
osparc: ${{ steps.find-wheel.outputs.osparc-wheel }}
18+
osparc_client: ${{ steps.find-wheel.outputs.osparc_client-wheel }}
1919
steps:
2020
- uses: actions/checkout@v3
2121
with:
@@ -35,34 +35,16 @@ jobs:
3535
- name: Determine wheel artifact
3636
id: find-wheel
3737
run: |
38-
OSPARC_WHEEL=$(ls clients/python/artifacts/dist/osparc-*.whl)
39-
OSPARC_AUTO_GENERATED_WHEEL=$(ls clients/python/artifacts/dist/osparc_client*.whl)
40-
echo "osparc-wheel-path=${OSPARC_WHEEL}" >> $GITHUB_OUTPUT
41-
echo "osparc-wheel-dir=$(dirname ${OSPARC_WHEEL})" >> $GITHUB_OUTPUT
42-
echo "osparc-wheel-name=$(basename ${OSPARC_WHEEL})" >> $GITHUB_OUTPUT
43-
echo "osparc-auto-wheel-path=${OSPARC_AUTO_GENERATED_WHEEL}" >> $GITHUB_OUTPUT
44-
echo "osparc-auto-wheel-dir=$(dirname ${OSPARC_AUTO_GENERATED_WHEEL})" >> $GITHUB_OUTPUT
45-
echo "osparc-auto-wheel-name=$(basename ${OSPARC_AUTO_GENERATED_WHEEL})" >> $GITHUB_OUTPUT
38+
cd clients/python/artifacts/dist
39+
OSPARC_WHEEL=$(ls osparc-*.whl)
40+
OSPARC_CLIENT_WHEEL=$(ls osparc_client*.whl)
41+
echo "osparc-wheel=${OSPARC_WHEEL}" >> $GITHUB_OUTPUT
42+
echo "osparc_client-wheel=${OSPARC_CLIENT_WHEEL}" >> $GITHUB_OUTPUT
4643
- name: Upload wheels
4744
uses: actions/upload-artifact@v3
4845
with:
4946
name: osparc_python_wheels
5047
path: clients/python/artifacts/dist/
51-
- name: Publish package to Test PyPI
52-
uses: pypa/gh-action-pypi-publish@release/v1
53-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
54-
with:
55-
password: ${{ secrets.TEST_PYPI_TOKEN }}
56-
repository-url: https://test.pypi.org/legacy/
57-
verbose: true
58-
packages-dir: ${{ steps.find-wheel.outputs.wheel-dir }}
59-
- name: Publish package to PyPI
60-
uses: pypa/gh-action-pypi-publish@release/v1
61-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
62-
with:
63-
password: ${{ secrets.PYPI_TOKEN }}
64-
verbose: true
65-
packages-dir: ${{ steps.find-wheel.outputs.wheel-dir }}
6648

6749
test-20-04:
6850
name: python ${{ matrix.python-version }} ubuntu-20.04
@@ -87,17 +69,17 @@ jobs:
8769
key: ${{ runner.os }}-pip-{{ matrix.python-version }}
8870
restore-keys: |
8971
${{ runner.os }}-pip
90-
- name: Donwload client
72+
- name: Download wheels
9173
uses: actions/download-artifact@v3
9274
with:
9375
name: osparc_python_wheels
9476
path: clients/python/artifacts/dist/
9577
- name: Install and Test
9678
run: |
97-
make devenv
79+
python -m venv .venv
9880
source .venv/bin/activate
9981
python -m pip install pytest
100-
python -m pip install ${{needs.build-n-publish.outputs.wheel}} --find-links=${{needs.build-n-publish.outputs.dist-dir}}
82+
python -m pip install clients/python/artifacts/dist/${{needs.build-n-publish.outputs.osparc}} --find-links=clients/python/artifacts/dist
10183
cd clients/python
10284
make install-test
10385
pytest -v --ignore=/artifacts/client --ignore=test/e2e
@@ -123,17 +105,81 @@ jobs:
123105
key: ${{ runner.os }}-pip-{{ matrix.python-version }}
124106
restore-keys: |
125107
${{ runner.os }}-pip
126-
- name: Donwload client
108+
- name: Download wheels
127109
uses: actions/download-artifact@v3
128110
with:
129111
name: osparc_python_wheels
130112
path: clients/python/artifacts/dist/
131113
- name: Install and Test
132114
run: |
133-
make devenv
115+
python -m venv .venv
134116
source .venv/bin/activate
135117
python -m pip install pytest
136-
python -m pip install ${{needs.build-n-publish.outputs.wheel}} --find-links=${{needs.build-n-publish.outputs.dist-dir}}
118+
python -m pip install clients/python/artifacts/dist/${{needs.build-n-publish.outputs.osparc}} --find-links=clients/python/artifacts/dist
137119
cd clients/python
138120
make install-test
139121
pytest -v --ignore=/artifacts/client --ignore=test/e2e
122+
123+
publish-osparc_client-to-pypi:
124+
name: Publish osparc_client wheel
125+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
126+
runs-on: ubuntu-latest
127+
needs: [build-n-publish, test-20-04, test-latest]
128+
environment:
129+
name: pypi
130+
url: https://pypi.org/p/osparc_client
131+
permissions:
132+
id-token: write # IMPORTANT: mandatory for trusted publishing
133+
steps:
134+
- name: Download wheels
135+
uses: actions/download-artifact@v3
136+
with:
137+
name: osparc_python_wheels
138+
path: dist/
139+
- name: Remove osparc wheel
140+
run: rm -f dist/${{needs.build-n-publish.outputs.osparc}}
141+
- name: Publish osparc_client to Test PyPI
142+
uses: pypa/gh-action-pypi-publish@release/v1
143+
with:
144+
password: ${{ secrets.TEST_PYPI_TOKEN }}
145+
repository-url: https://test.pypi.org/legacy/
146+
verbose: true
147+
packages-dir: dist/
148+
- name: Publish osparc_client to PyPI
149+
uses: pypa/gh-action-pypi-publish@release/v1
150+
with:
151+
password: ${{ secrets.PYPI_TOKEN }}
152+
verbose: true
153+
packages-dir: dist/
154+
155+
publish-osparc-to-pypi:
156+
name: Publish osparc wheel
157+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
158+
runs-on: ubuntu-latest
159+
needs: [build-n-publish, test-20-04, test-latest]
160+
environment:
161+
name: pypi
162+
url: https://pypi.org/p/osparc
163+
permissions:
164+
id-token: write # IMPORTANT: mandatory for trusted publishing
165+
steps:
166+
- name: Download wheels
167+
uses: actions/download-artifact@v3
168+
with:
169+
name: osparc_python_wheels
170+
path: dist/
171+
- name: Remove osparc_client wheel
172+
run: rm -f dist/${{needs.build-n-publish.outputs.osparc_client}}
173+
- name: Publish osparc to Test PyPI
174+
uses: pypa/gh-action-pypi-publish@release/v1
175+
with:
176+
password: ${{ secrets.TEST_PYPI_TOKEN }}
177+
repository-url: https://test.pypi.org/legacy/
178+
verbose: true
179+
packages-dir: dist/
180+
- name: Publish osparc to PyPI
181+
uses: pypa/gh-action-pypi-publish@release/v1
182+
with:
183+
password: ${{ secrets.PYPI_TOKEN }}
184+
verbose: true
185+
packages-dir: dist/

‎clients/python/client/osparc/__init__.py‎

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
"""
2-
0.6.0 osparc client
3-
"""
4-
from typing import Tuple
1+
from typing import List, Tuple
52

63
import nest_asyncio
74
from osparc_client import ( # APIs; API client; models
@@ -18,15 +15,11 @@
1815
HTTPValidationError,
1916
Job,
2017
JobInputs,
21-
JobMetadata,
22-
JobMetadataUpdate,
2318
JobOutputs,
2419
JobStatus,
25-
Links,
2620
Meta,
2721
MetaApi,
2822
OnePageSolverPort,
29-
OnePageStudyPort,
3023
OpenApiException,
3124
Profile,
3225
ProfileUpdate,
@@ -35,9 +28,6 @@
3528
from osparc_client import ( # APIs; API client; models
3629
Solver,
3730
SolverPort,
38-
StudiesApi,
39-
Study,
40-
StudyPort,
4131
UserRoleEnum,
4232
UsersApi,
4333
UsersGroup,
@@ -48,15 +38,26 @@
4838
from ._files_api import FilesApi
4939
from ._info import openapi
5040
from ._solvers_api import SolversApi
51-
from ._utils import PaginationGenerator
41+
from ._utils import dev_features_enabled
5242

5343
nest_asyncio.apply() # allow to run coroutines via asyncio.run(coro)
5444

55-
__all__: Tuple[str, ...] = (
56-
# imports from osparc_client
45+
dev_features: List[str] = []
46+
if dev_features_enabled():
47+
dev_features = [
48+
"PaginationGenerator",
49+
"StudiesApi",
50+
"StudyPort",
51+
"Study",
52+
"JobMetadataUpdate",
53+
"Links",
54+
"JobMetadata",
55+
"OnePageStudyPort",
56+
]
57+
58+
__all__: Tuple[str, ...] = tuple(dev_features) + (
5759
"__version__",
5860
"FilesApi",
59-
"PaginationGenerator",
6061
"MetaApi",
6162
"SolversApi",
6263
"UsersApi",
@@ -83,16 +84,8 @@
8384
"ApiValueError",
8485
"ApiKeyError",
8586
"ApiException",
86-
"StudiesApi",
8787
"OnePageSolverPort",
88-
"StudyPort",
89-
"Study",
90-
"JobMetadataUpdate",
91-
"Links",
9288
"SolverPort",
93-
"JobMetadata",
9489
"ErrorGet",
95-
"OnePageStudyPort",
96-
# imports from osparc
9790
"openapi",
98-
)
91+
) # type: ignore

0 commit comments

Comments
 (0)