-
Notifications
You must be signed in to change notification settings - Fork 5
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
What should python2
be for faculty.clients.environment.Specification
now that Python 2 is not supported?
#198
Comments
Looking inside the code and dumping some debug entries, it seems like that the spec above results internally in the library in this schema _EnvironmentCreateUpdate(name='hello', description='testing issue', specification=(Specification(apt=Apt(packages=[]), bash=[Script(script='echo hello')], python=PythonSpecification(python2=None, python3=PythonEnvironment(pip=Pip(extra_index_urls=[], packages=[]), conda=Conda(channels=[], packages=[])))),)) (I added some description and name to be able to call the environment client's {'name': 'hello', 'description': 'testing issue', 'specification': {}} that is a missing spec. Just a hunch, but I wonder if this is because a parsing failure on those Python environments and thus being filled in as |
@sbalian okay, issue is 2 fold Part 1: your Part 2: The workaround now is to send in a valid, empty Python environment for Python 2 and then both the API accepts it, and it can be parsed back by the SDK as well (until it's updated to reflect the changes). E.g. this works, combining Part 1 and Part 2: # can reuse this as needed
empty_python_environment = environment.PythonEnvironment(
pip=environment.Pip(extra_index_urls=[], packages=[]),
conda=environment.Conda(channels=[], packages=[]),
)
spec = environment.Specification(
apt=environment.Apt(packages=[]),
bash=[environment.Script(script=script)],
python=environment.PythonSpecification(
python2=empty_python_environment,
python3=environment.PythonEnvironment(
pip=environment.Pip(extra_index_urls=[], packages=[]),
conda=environment.Conda(channels=[], packages=[]),
),
),
) |
@imrehg Thanks! Sorry - the tuple bit was a result of bad copy and pasting here. [] works! So does setting it to the same value as the one for Python 3. None does not work. |
And @imrehg that comma, black on save! careful! |
@sbalian I would probably still keep the issue open, as it's complicated, and you did stumble upon a real issue with it, even if there's a workaround. Interestingly, my code is also after |
Thanks @imrehg. 1 I checked black again and it does the correct job. The original post was just a bad copy/paste job. 2 I opened the issue again, but changed the title. |
python2
value for faculty.clients.environment.Specification
python2
value for faculty.clients.environment.Specification
python2
be for faculty.clients.environment.Specification
now that Python 2 is not supported?
Another finding @imrehg Consider this for creating a new environment and then trying to list the environments. import os
import uuid
import faculty
from faculty.clients import environment
PROJECT_ID = uuid.UUID(os.environ["FACULTY_PROJECT_ID"])
empty_python_spec = environment.PythonEnvironment(
pip=environment.Pip(extra_index_urls=[], packages=[]),
conda=environment.Conda(channels=[], packages=[]),
)
spec = environment.Specification(
apt=environment.Apt(packages=[]),
bash=[environment.Script(script="")],
python=environment.PythonSpecification(
python2=[], python3=empty_python_spec,
),
)
environment_client = faculty.client("environment")
environment_client.create(
PROJECT_ID, "test", spec,
)
environment_client.list(PROJECT_ID) I have used
Now changing the So in summary, we should use an empty spec rather than |
I am getting
faculty.clients.base.BadRequest: (<Response [400]>, None, None)
when trying to create a new environment. Here is the spec ...I think it may be due to the
python2
value. I pulled the schema from what I get fromclient.get
. In the tests for this library though, this is not set to None as far as I can see. I also tried just setting it to the same value as for Python 3 and still got the same error. Perhaps this is because the Platform no longer supports Python 2 and this library has not been updated? I cannot see the Python 2 options on the UI btw.The text was updated successfully, but these errors were encountered: