-
Notifications
You must be signed in to change notification settings - Fork 3
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
Explore adopting autogenerated python SDK #244
Comments
The SDK seems broken. Hyphens are not allowed in Python package names, so it can't be imported. Is there a documentation somewhere about how to use it? The interface looks quite low level. |
We should address this issue and brainstorm with @Junjiequan. He is the scicat SDK guru |
(you may need to run Then import the package: import scicat-sdk-py SetuptoolsInstall via Setuptools. python setup.py install --user (or Then import the package: import scicat-sdk-py TestsExecute Getting StartedPlease follow the installation procedure and then run the following: import scicat-sdk-py
from scicat-sdk-py.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = scicat-sdk-py.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with scicat-sdk-py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = scicat-sdk-py.AdminApi(api_client)
try:
api_response = api_instance.admin_controller_get_config()
print("The response of AdminApi->admin_controller_get_config:\n")
pprint(api_response)
except ApiException as e:
print("Exception when calling AdminApi->admin_controller_get_config: %s\n" % e) |
Documentation for API EndpointsAll URIs are relative to http://localhost
|
@nitrosx @jl-wynen |
@Junjiequan either scicat_sdk_py or scicatSdkPy works for me. |
One more question: do we need the long names, like users_controller_find_all? |
@nitrosx |
@Junjiequan OK. Let's not worry about that. Thank you both |
The package has to be renamed. It is possible to keep the name on pypi.org with kebab case and only rename the actual folder in the project. The name that is used on PyPI and when pip installing comes from As to the convention, Python packages names normally use snake_case. CamelCase is only used for class names in Python. |
Thanks for the feedback @jl-wynen. |
@jl-wynen New SDK package is uploaded with underscore, and now you should be able to import the package. |
It doesn't work: import scicat_sdk_pydantic
cfg = scicat_sdk_pydantic.Configuration(
host="https://staging.scicat.ess.eu"
)
with scicat_sdk_pydantic.ApiClient(cfg) as client:
inst = scicat_sdk_pydantic.DatasetsApi(client)
response = inst.datasets_controller_find_by_id("20.500.12269/a76901e4-7e3a-4bd1-be09-6845f1f29b83")
print(response) raises
This seems to come down to the schema being broken (SciCatProject/scicat-backend-next#1474). So maybe once the schema is fixed, this SDK will work. Do you test it in any way? The API location is hard coded in the package to |
@jl-wynen |
Can you clarify and elaborate on this:
Thanks |
In scitacean, yes. It falls back to loading only known fields. Although some fields may have an unexpected type because they were not parsed correctly. In the generated SDK, this is a hard failure and you cannot (to my knowledge) get the data from the API.
In the SDK, all APi calls are made to |
If you are asking is it a new thing with SDK then the answer is no. It's a global prefix for all the routers within the application. |
SciCat backend has a matching python SDK autogenerated for each new release:
which are also published on Pypi
I wonder if we could adopt one of this new SDK in Scitacean
The text was updated successfully, but these errors were encountered: