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.
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.
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 <stefan@skoegl.net>" | ||
| __version__ = "3.0" |
| except ImportError: # Python 3 | ||
| from collections import Mapping, Sequence | ||
| T = TypeVar("T") | ||
| TJsonPointer = TypeVar("TJsonPointer", bound="JsonPointer") |
There was a problem hiding this comment.
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/
| import re | ||
| import copy | ||
|
|
||
| class _Singleton(type): |
There was a problem hiding this comment.
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.
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 annotationsin <=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.