-
Notifications
You must be signed in to change notification settings - Fork 43
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
Update to python 3.7 #52
Conversation
Versions prior to 3.7 are EoL, and the lack of access to `from __future__ import annotations` in <=3.6 make it not worth working around. Pypi stats shows there is still some 3.6 utilization, but as breaking 2.7 support is typically handled by a major version bump, and going from 3.6 -> 3.7 is trivial, the regular maintaince of "a major bump happened" should be enough for them to push to 3.7.
This would resolve #48 |
@@ -1,15 +1,16 @@ | |||
language: python | |||
dist: jammy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Defaults to 16.04 (whatever dist that is) which doesn't have beyond 3.9
- nightly | ||
- pypy3 | ||
install: | ||
- travis_retry pip install --upgrade pip setuptools wheel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required to work around default setuptools being broken in 3.9 image
__website__ = 'https://github.com/stefankoegl/python-json-pointer' | ||
__license__ = 'Modified BSD License' | ||
__author__ = "Stefan Kögl <[email protected]>" | ||
__version__ = "3.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Major version bump
except ImportError: # Python 3 | ||
from collections import Mapping, Sequence | ||
T = TypeVar("T") | ||
TJsonPointer = TypeVar("TJsonPointer", bound="JsonPointer") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used in places like @classmethod
, where def foo(cls: Type[TJsonPointer]) -> TJsonPointer
is dependent on the subclass. It's a small detail, but typing it correctly is really nice to people downstream.
In 3.11, PEP 673 makes this even easier, but since this was supporting every python version not EOL I didn't leverage it https://peps.python.org/pep-0673/
|
||
class _Singleton(type): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may be overkill, but it made typing the Nothing
object hints way easier to have a class it's an instance of. It could have been an empty class _Nothing: pass
, but with ~5 lines more of code it gets the really nice property that every instance of _Nothing
is the same instance.
Without that, checking default is _nothing
would fail, as is
checks id(lhs) == id(rhs)
(aka "are they the same instance"? You can work around that by instead checking isinstance(x, _Nothing)
, but I prefer the syntax you had of is _nothing
pointer = JsonPointer(pointer) | ||
return pointer.set(doc, value, inplace) | ||
_pointer = JsonPointer(pointer) | ||
return _pointer.set(doc, value, inplace) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some type engines (e.g. pylance) get confused when you reuse names in place like this
was fun fighting Travis. Anyhow, sorry for the mangled work, I applied |
Thanks for the great work! If we drop <= 3.7 here, this will break stefankoegl/python-json-patch. Would you be up for looking into that as well? |
Yes, I am all for it! I'll link it when done.
…On Mon, Dec 12, 2022, 14:59 Stefan Kögl ***@***.***> wrote:
Thanks for the great work! If we drop <= 3.7 here, this will break
stefankoegl/python-json-patch. Would you be up for looking into that as
well?
—
Reply to this email directly, view it on GitHub
<#52 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACDQ7E6MIMSISZRQNABQ7BLWM573BANCNFSM6AAAAAASQBNZAA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Versions prior to 3.7 are EoL, and the lack of access to
from __future__ import annotations
in <=3.6 make it not worth working around.Pypi stats shows there is still some 3.6 utilization, but as breaking 2.7 support is typically handled by a major version bump, and going from 3.6 -> 3.7 is trivial, the regular maintaince of "a major bump happened" should be enough for them to push to 3.7.