-
Notifications
You must be signed in to change notification settings - Fork 310
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
Add support for python3.11, drop support for python 3.7 #475
Conversation
@@ -31,7 +31,7 @@ | |||
"maxLength": 20 | |||
}, | |||
"modem": { | |||
"$ref": "#definitions/ModemType" | |||
"$ref": "#/definitions/ModemType" |
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.
Change required do to jsonschema-specifications
dependency.
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.
Can you elaborate on why this change is required? What problem does this change solves?
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.
I was wrong that the cause was jsonschema-specifications
, I think it is another incompatibility with newer versions of jsonschema
.
When removing support for Python 3.7, some libraries versions are bumped:
Fixing the ImportError
and running tests, 3 fails with error jsonschema.exceptions._WrappedReferencingError: InvalidAnchor: '#definitions/ChargingStationType' is not a valid anchor, neither as a plain name anchor nor as a JSON Pointer. You may have intended to use '#/definitions/ChargingStationType', as the slash is required *before each segment* of a JSON pointer.
So this change only apply the suggestion from the error.
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.
Interesting find, thanks for sharing.
When removing support for Python 3.7, some libraries versions are bumped.
That doesn't have to happen. After changing the pyproject.toml
you can run poetry lock --no-update
to avoid updating any packages
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.
I was wrong about poetry lock --no-update
. Please ignore that comment.
I'm able to reproduce the issue shown in the screenshot using Python 3.10.
This assumes a clean clone from current master branch.
- Modify
pyproject.toml
to update to set minimal python version to 3.8.
diff --git a/pyproject.toml b/pyproject.toml
index f48fbcd..052272a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -30,7 +30,7 @@ classifiers = [
]
[tool.poetry.dependencies]
-python = "^3.7"
+python = "^3.8"
jsonschema = "^4.4.0"
[tool.poetry.dev-dependencies]
- Run
poetry update
- Run
poetry run pytest
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.
I've created an issue to track this specific issue: #480.
I'm not sure what the best way to fix is to fix this error. We could modify all schemas. However, this project contains a lot of schemas. It's easy to forget to an incorrect reference.
Do you know if it's possible to use jsonschema
in a way it ignores these invalid references?
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.
Sorry, I don't 😞
@@ -375,83 +393,115 @@ i18n = ["Babel (>=2.7)"] | |||
|
|||
[[package]] | |||
name = "jsonschema" | |||
version = "4.17.3" |
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.
Dev dependency asynctest
for [email protected]
was setting version 4.17.3
of this library, so no ImportError
is triggered when running tests or in development environment.
However, when installing ocpp
in a project, asynctest
is not installed, so jsonschema
is set to 4.19.1
, causing the ImportError
in production environment.
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.
I don't understand the relation between asynctest
and jsonschema
. Can you elaborate?
When dropping support for Python 3.7, the dependency asynctest
becomes obsolete and can be dropped.
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.
Sorry, I was wrong that the cause was asynctest
and I didn't elaborate enough.
In [email protected] they dropped support for Python 3.7, so any project using 3.7 will receive v4.17.3 when installing the library.
In development/test environment of ocpp
library, the poetry.lock file requires dependencies to support Python 3.7 (so jsonschema is fixed to v4.17.3). But in production environment, if any version of Python > 3.7 is being used, then jsonschema
will bump to the latest version, that is v4.19.1 with the renamed variable, generating the ImportError.
Bottom line: if we want ocpp
to be tested with the latest version of jsonschema
, we need to drop support for Python 3.7.
Thanks for your PR. It contains some useful changes. I've some feedback though:
|
@@ -52,4 +51,4 @@ profile = "black" | |||
|
|||
[build-system] | |||
requires = ["poetry>=1.1.11"] | |||
build-backend = "poetry.masonry.api" | |||
build-backend = "poetry.core.masonry.api" |
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.
What's the reason for this change?
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.
To be up to date with the latest documentation of Poetry, but I think both notations have the same result.
Hi @rasaffie nice PR! Edit: Nevermind, you already did.
in
should do the trick I believe. Maybe it is a good idea to immediately check for Python 3.12, since it has been released? The changes should be minimal, I believe the only problem is a linting issue in |
Fix issues #471 and #447