Skip to content

✨ Capture osparc envs automatically using a pydantic model #170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

bisgaard-itis
Copy link
Collaborator

@bisgaard-itis bisgaard-itis commented Jul 12, 2024

What do these changes do?

import os
from osparc import Configuration, ApiClient

cfg = Configuration(
    host=os.environ["OSPARC_API_HOST"],
    username=os.environ["OSPARC_API_KEY"],
    password=os.environ["OSPARC_API_SECRET"],
)
api_client = ApiClient(configuration=cfg)

in order to initiate a session with osparc. Now the user can do

import os
from osparc import ApiClient

api_client = ApiClient()

and the credentials will be automatically captured from the environment.

Limitations

  • osparc.Configuration also allows experts users to configure the client in more advances ways, e.g. setting a specific retry strategy. The implementation I add in this PR provides the user with two options: Either use the default behavior in which case the credentials will be caught from the env or explicitly define everything yourself. I.e. the user cannot only define e.g. the retry strategy or get osparc to capture the environment variables automatically. I consider this acceptable because the advanced use case is for expert users who will not be afraid to add a few extra lines of code.

Related issue/s

How to test

For internal developers

pcrespov and others added 11 commits June 19, 2024 16:28
fix dependency issue and bump version

point to website in project description

fix broken dependency

improve doc

add github token to download artifacts

ensure only read-access @wvangeit

yet another attempt at downloading artifacts

make sure to use repo that ran the trigger wf

another attempt at fixing

change owner

allow publishing to testpypi also when pr

minor change

revert minor (but breaking) change

minor fix

add debug messages

another debug message

hopefully the final version

final fix

minor fix

move master and tag to individual jobs

add debug messages

add python script for determining semantic version

minor changes

minor changes

improve error handling and add version file to artifacts

check if release

minor fix

ensure to enter venv

also when tagging

source venv in publishin workflow

ensure only master

add script for testing 'pure' semver

adapt workflows to new python script

minor change

attempt to evaluate expressions correctly

several fixes to fix tests

ensure repo is checked out in publish workflow

several small fixes

cleanup

debug

minor cleanup

mionr changes

add debug message

minor change

minor change

yet another try

minor change

minor change

minor change

mionr change

minor changes

correct workflow run id

cosmetic change

avoid using gh

change to a single job for publishing

minor cleanup

swap loops in clean up jobs

correction

get correct versions of github workflow files

update a couple of other files

update a few more tests

update yet another file

yet another file
@bisgaard-itis bisgaard-itis self-assigned this Jul 12, 2024
@bisgaard-itis bisgaard-itis added the enhancement New feature or request label Jul 12, 2024
@bisgaard-itis bisgaard-itis added this to the Tom Bombadil milestone Jul 12, 2024
@bisgaard-itis bisgaard-itis marked this pull request as ready for review July 12, 2024 12:58
@bisgaard-itis bisgaard-itis requested a review from pcrespov as a code owner July 12, 2024 12:58
Copy link
Member

@pcrespov pcrespov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done! I liked a lot your solution!
thx for your help.
I took the liberty to add "close (my PR)" in your description so that it closes my PR when this gets merged. thx

@bisgaard-itis
Copy link
Collaborator Author

Well done! I liked a lot your solution! thx for your help. I took the liberty to add "close (my PR)" in your description so that it closes my PR when this gets merged. thx

thanks

@bisgaard-itis bisgaard-itis force-pushed the is5925/osparc-envs-auto branch from be5ece2 to eee80b1 Compare July 12, 2024 13:31
@bisgaard-itis bisgaard-itis merged commit 6729cef into ITISFoundation:master Jul 12, 2024
16 checks passed
@bisgaard-itis bisgaard-itis deleted the is5925/osparc-envs-auto branch July 12, 2024 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants