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

Python 3.8 incompatible typehints in components/harvester.py #1414

Open
marcus-oscarsson opened this issue Sep 23, 2024 · 9 comments
Open

Python 3.8 incompatible typehints in components/harvester.py #1414

marcus-oscarsson opened this issue Sep 23, 2024 · 9 comments

Comments

@marcus-oscarsson
Copy link
Member

marcus-oscarsson commented Sep 23, 2024

@woutdenolf noticed that the there are some Python 3.8 incompatible type-hints used.

Originally reported in issue #1383

mxcubeweb-server -r $(pwd)/mxcubeweb/demo/ --static-folder $(pwd)/mxcubeweb/ui/build/ -L debug

Traceback (most recent call last):
  File "/home/denolf/.local/wdnbashutils/virtualenvs/mxcubeweb/bin/mxcubeweb-server", line 3, in <module>
    from mxcubeweb import main
  File "/home/denolf/projects/sb/mxcubeweb/mxcubeweb/__init__.py", line 14, in <module>
    from mxcubeweb.app import MXCUBEApplication as mxcube  # noqa: E402
  File "/home/denolf/projects/sb/mxcubeweb/mxcubeweb/app.py", line 36, in <module>
    from mxcubeweb.core.components.harvester import Harvester
  File "/home/denolf/projects/sb/mxcubeweb/mxcubeweb/core/components/harvester.py", line 14, in <module>
    class Harvester(ComponentBase):
  File "/home/denolf/projects/sb/mxcubeweb/mxcubeweb/core/components/harvester.py", line 189, in Harvester
    def get_sample_info(self, sampleID: str) -> dict[str]:
TypeError: 'type' object is not subscriptable
@marcus-oscarsson
Copy link
Member Author

Can be solved but using from __future__ import annotations or from typing import Dict

@marcus-oscarsson
Copy link
Member Author

Perhaps @jbflo can have a look when he is back :) ?

@marcus-oscarsson
Copy link
Member Author

:), I'm wondering if this however is a development that we only have on our internal GitLab. @woutdenolf, you checked out the GitLab code right. Because the GitHub test action should have caught this issue, however we are not testing against Python 3.8 on GitLab ?

@marcus-oscarsson
Copy link
Member Author

Actually just double checking and the code is pretty much identical, so this line is the same here on GitHub:

def get_sample_info(self, sampleID: str) -> dict[str]:

So its strange that this passes the tests, or am I overlooking something ?

@jbflo
Copy link
Member

jbflo commented Sep 23, 2024

did not have python 3.8 en in place
just Setup a python 3.8 env and had the issue that @woutdenolf raised.

@marcus-oscarsson
Copy link
Member Author

Yes, I found the issue. I'm not sure how this was meant to work:

environment-file: conda-environment.yml

As far as I can see this never uses the interpreter specified in the matrix :

python-version: ["3.8"]

I guess we could perhaps add something here:

@marcus-oscarsson
Copy link
Member Author

@jbflo, thanks If you run pytest the tests are still failing because there is the same issue in mxcubecore. Do you think you can make a PR for mxcubecore as well

@jbflo
Copy link
Member

jbflo commented Sep 26, 2024

@jbflo, thanks If you run pytest the tests are still failing because there is the same issue in mxcubecore. Do you think you can make a PR for mxcubecore as well

yes, i did it as well mxcube/mxcubecore#1031

@marcus-oscarsson
Copy link
Member Author

Oh, yes I got lost in the issue "cross-over" Thanks alot @jbflo 👍

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