Skip to content

Conversation

alexanderroidl
Copy link

By default a Python version which is not compatible to currently used syntax is being installed:

❯ pipenv install
(...) ✅
❯ pipenv run python --version
Python 3.9.18
❯ pipenv run python flathunt.py
Traceback (most recent call last):
File "/Users/alexander.roidl/Private/flathunter/flathunt.py", line 13, in <module>
from flathunter.hunter import Hunter
File "/Users/alexander.roidl/Private/flathunter/flathunter/hunter.py", line 13, in <module>
class Hunter:
File "/Users/alexander.roidl/Private/flathunter/flathunter/hunter.py", line 39, in Hunter
def hunt_flats(self, max_pages: None|int = None):
TypeError: unsupported operand type(s) for |: 'NoneType' and 'type'

hunter.py:39:
def hunt_flats(self, max_pages: None|int = None):

def hunt_flats(self, max_pages: None|int = None):

This so called "union-type operator" was only introduced in Python 3.10:
https://docs.python.org/3/whatsnew/3.10.html#pep-604-new-type-union-operator

Therefore I changed the Pipfile accordingly. 😊


Look who's back!

@codders
Copy link

codders commented Jun 18, 2024

I guess this is a bit more complicated. I set the version at 3 so that I could test with both 3.9 and 3.10 (and 3.11). The CI tests are running 3.10 and 3.11, which is why we don't see failures for this in CI.

As far as I know, Pipfile does not have support for saying Python version >= 3.x - we either pin to a specific point version, or we let the system install whatever python 3 it can find.

So you think we should just force 3.10 and not support any other version (until we bump to 3.11)? I don't know what the best practice here is.

@alexanderroidl
Copy link
Author

I guess this is a bit more complicated. I set the version at 3 so that I could test with both 3.9 and 3.10 (and 3.11). The CI tests are running 3.10 and 3.11, which is why we don't see failures for this in CI.

As far as I know, Pipfile does not have support for saying Python version >= 3.x - we either pin to a specific point version, or we let the system install whatever python 3 it can find.

So you think we should just force 3.10 and not support any other version (until we bump to 3.11)? I don't know what the best practice here is.

As far as I'm concerned we stopped supporting versions before 3.10 in September:
1409897

So we do not need to run tests on 3.9 anyways.

The source code is literally incompatible with anything before 3.10, therefore it needs to be forced. The Pipfile supports this as well!

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

Successfully merging this pull request may close these issues.

2 participants