Skip to content
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

return python objects instead of text #162

Closed
sstrong99 opened this issue Aug 22, 2024 · 5 comments
Closed

return python objects instead of text #162

sstrong99 opened this issue Aug 22, 2024 · 5 comments

Comments

@sstrong99
Copy link

It would be nice if commands like compute-envs list returned python objects instead of strings that need to be parsed to get the data. e.g.

from seqerakit import seqeraplatform
tw = seqeraplatform.SeqeraPlatform()
out = tw.compute_envs("list")

"""
here `out` could be a list of dicts like 
out = [
    {
        "id": ...,
        "status": ...,
        "platform": ...,
        "name": ...,
        "last_activity": ...,
    },
     {
        "id": ...,
        "status": ...,
        "platform": ...,
        "name": ...,
        "last_activity": ...,
    },
    ...
]
"""  
@sstrong99
Copy link
Author

It appears that this is already an option with to_json=True, although if this is documented somewhere i haven't found it.

@ejseqera
Copy link
Member

Using to_json=True in tw.compute_envs("list") is probably the closest to what you are looking for to return a dict. We might potentially refactor this to avoid using kwargs, see draft implementation here: #146

We will make a note to document this option better once implemented.

@sstrong99
Copy link
Author

Thanks! it would be nice to maintain that sort of functionality for the python API if that refactor happens.

@ejseqera
Copy link
Member

ejseqera commented Dec 3, 2024

I agree. FWIW, see @andrew-dawson-seqera's comment here: #167 (comment)

@ejseqera
Copy link
Member

We've implemented #146 in the latest version which should make working with JSON objects much easier. We appreciate the feedback for a future Python SDK. Closing this out but don't hesitate to share any additional feedback you might have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants