Skip to content

Commit

Permalink
🧪 Update version and testing for release (#75)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
bisgaard-itis authored Oct 9, 2023
1 parent d732e18 commit 3d27841
Show file tree
Hide file tree
Showing 21 changed files with 997 additions and 327 deletions.
108 changes: 77 additions & 31 deletions .github/workflows/publish-python-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
build-n-publish:
runs-on: ubuntu-latest
outputs:
wheel: ${{ steps.find-wheel.outputs.osparc-wheel-path }}
dist-dir: ${{ steps.find-wheel.outputs.osparc-auto-wheel-dir }}
osparc: ${{ steps.find-wheel.outputs.osparc-wheel }}
osparc_client: ${{ steps.find-wheel.outputs.osparc_client-wheel }}
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -35,34 +35,16 @@ jobs:
- name: Determine wheel artifact
id: find-wheel
run: |
OSPARC_WHEEL=$(ls clients/python/artifacts/dist/osparc-*.whl)
OSPARC_AUTO_GENERATED_WHEEL=$(ls clients/python/artifacts/dist/osparc_client*.whl)
echo "osparc-wheel-path=${OSPARC_WHEEL}" >> $GITHUB_OUTPUT
echo "osparc-wheel-dir=$(dirname ${OSPARC_WHEEL})" >> $GITHUB_OUTPUT
echo "osparc-wheel-name=$(basename ${OSPARC_WHEEL})" >> $GITHUB_OUTPUT
echo "osparc-auto-wheel-path=${OSPARC_AUTO_GENERATED_WHEEL}" >> $GITHUB_OUTPUT
echo "osparc-auto-wheel-dir=$(dirname ${OSPARC_AUTO_GENERATED_WHEEL})" >> $GITHUB_OUTPUT
echo "osparc-auto-wheel-name=$(basename ${OSPARC_AUTO_GENERATED_WHEEL})" >> $GITHUB_OUTPUT
cd clients/python/artifacts/dist
OSPARC_WHEEL=$(ls osparc-*.whl)
OSPARC_CLIENT_WHEEL=$(ls osparc_client*.whl)
echo "osparc-wheel=${OSPARC_WHEEL}" >> $GITHUB_OUTPUT
echo "osparc_client-wheel=${OSPARC_CLIENT_WHEEL}" >> $GITHUB_OUTPUT
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: osparc_python_wheels
path: clients/python/artifacts/dist/
- name: Publish package to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
with:
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository-url: https://test.pypi.org/legacy/
verbose: true
packages-dir: ${{ steps.find-wheel.outputs.wheel-dir }}
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
with:
password: ${{ secrets.PYPI_TOKEN }}
verbose: true
packages-dir: ${{ steps.find-wheel.outputs.wheel-dir }}

test-20-04:
name: python ${{ matrix.python-version }} ubuntu-20.04
Expand All @@ -87,17 +69,17 @@ jobs:
key: ${{ runner.os }}-pip-{{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip
- name: Donwload client
- name: Download wheels
uses: actions/download-artifact@v3
with:
name: osparc_python_wheels
path: clients/python/artifacts/dist/
- name: Install and Test
run: |
make devenv
python -m venv .venv
source .venv/bin/activate
python -m pip install pytest
python -m pip install ${{needs.build-n-publish.outputs.wheel}} --find-links=${{needs.build-n-publish.outputs.dist-dir}}
python -m pip install clients/python/artifacts/dist/${{needs.build-n-publish.outputs.osparc}} --find-links=clients/python/artifacts/dist
cd clients/python
make install-test
pytest -v --ignore=/artifacts/client --ignore=test/e2e
Expand All @@ -123,17 +105,81 @@ jobs:
key: ${{ runner.os }}-pip-{{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip
- name: Donwload client
- name: Download wheels
uses: actions/download-artifact@v3
with:
name: osparc_python_wheels
path: clients/python/artifacts/dist/
- name: Install and Test
run: |
make devenv
python -m venv .venv
source .venv/bin/activate
python -m pip install pytest
python -m pip install ${{needs.build-n-publish.outputs.wheel}} --find-links=${{needs.build-n-publish.outputs.dist-dir}}
python -m pip install clients/python/artifacts/dist/${{needs.build-n-publish.outputs.osparc}} --find-links=clients/python/artifacts/dist
cd clients/python
make install-test
pytest -v --ignore=/artifacts/client --ignore=test/e2e
publish-osparc_client-to-pypi:
name: Publish osparc_client wheel
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs: [build-n-publish, test-20-04, test-latest]
environment:
name: pypi
url: https://pypi.org/p/osparc_client
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download wheels
uses: actions/download-artifact@v3
with:
name: osparc_python_wheels
path: dist/
- name: Remove osparc wheel
run: rm -f dist/${{needs.build-n-publish.outputs.osparc}}
- name: Publish osparc_client to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository-url: https://test.pypi.org/legacy/
verbose: true
packages-dir: dist/
- name: Publish osparc_client to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TOKEN }}
verbose: true
packages-dir: dist/

publish-osparc-to-pypi:
name: Publish osparc wheel
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs: [build-n-publish, test-20-04, test-latest]
environment:
name: pypi
url: https://pypi.org/p/osparc
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download wheels
uses: actions/download-artifact@v3
with:
name: osparc_python_wheels
path: dist/
- name: Remove osparc_client wheel
run: rm -f dist/${{needs.build-n-publish.outputs.osparc_client}}
- name: Publish osparc to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository-url: https://test.pypi.org/legacy/
verbose: true
packages-dir: dist/
- name: Publish osparc to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TOKEN }}
verbose: true
packages-dir: dist/
41 changes: 17 additions & 24 deletions clients/python/client/osparc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
"""
0.6.0 osparc client
"""
from typing import Tuple
from typing import List, Tuple

import nest_asyncio
from osparc_client import ( # APIs; API client; models
Expand All @@ -18,15 +15,11 @@
HTTPValidationError,
Job,
JobInputs,
JobMetadata,
JobMetadataUpdate,
JobOutputs,
JobStatus,
Links,
Meta,
MetaApi,
OnePageSolverPort,
OnePageStudyPort,
OpenApiException,
Profile,
ProfileUpdate,
Expand All @@ -35,9 +28,6 @@
from osparc_client import ( # APIs; API client; models
Solver,
SolverPort,
StudiesApi,
Study,
StudyPort,
UserRoleEnum,
UsersApi,
UsersGroup,
Expand All @@ -48,15 +38,26 @@
from ._files_api import FilesApi
from ._info import openapi
from ._solvers_api import SolversApi
from ._utils import PaginationGenerator
from ._utils import dev_features_enabled

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

__all__: Tuple[str, ...] = (
# imports from osparc_client
dev_features: List[str] = []
if dev_features_enabled():
dev_features = [
"PaginationGenerator",
"StudiesApi",
"StudyPort",
"Study",
"JobMetadataUpdate",
"Links",
"JobMetadata",
"OnePageStudyPort",
]

__all__: Tuple[str, ...] = tuple(dev_features) + (
"__version__",
"FilesApi",
"PaginationGenerator",
"MetaApi",
"SolversApi",
"UsersApi",
Expand All @@ -83,16 +84,8 @@
"ApiValueError",
"ApiKeyError",
"ApiException",
"StudiesApi",
"OnePageSolverPort",
"StudyPort",
"Study",
"JobMetadataUpdate",
"Links",
"SolverPort",
"JobMetadata",
"ErrorGet",
"OnePageStudyPort",
# imports from osparc
"openapi",
)
) # type: ignore
Loading

0 comments on commit 3d27841

Please sign in to comment.