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

CI: remove Python 3.6 testing and add/fix Python 3.11 support #515

Merged
merged 6 commits into from
Dec 11, 2022

Conversation

klauer
Copy link
Contributor

@klauer klauer commented Dec 8, 2022

  • Python 3.6 is unavailable for Ubuntu 22.04.
  • Fixed a general test bug that assumed Harry Potter would be 41 forever
  • Adds in a CI job for Python 3.11
  • Fixes Python 3.11 support, at least to the point of a passing test suite:
    • Bumps pytest-asyncio version in test suite and sets "auto" mode to avoid pytest-asyncio's deprecation warning
    • Fixes string enum representation, primarily for the test suite (0df3dcf), otherwise the expected error messages change ([{'err': 'expected type JsonType.INTEGER, found JsonType.NULL', 'loc': ['bar']}] instead of [{'err': 'expected type integer, found null', 'loc': ['bar']}])
    • Follows change from the standard library typing._collect_type_vars -> _collect_parameters (closes Python 3.11 support #485)
    • Fixes a failing example due to a new check for mutable default values in frozen dataclass fields
    • In Python 3.11, typing.Any is now a type subclass (related to Allow subclassing Any at runtime python/cpython#91154). This broke serialization of JSON schemas in an unexpected (to me) way, resulting in test_schema_versions.py failing to use the correct converter for OPEN_API_3_0

@codecov-commenter
Copy link

Codecov Report

Merging #515 (9d718cf) into master (dac721e) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #515   +/-   ##
=======================================
  Coverage   87.86%   87.86%           
=======================================
  Files          62       62           
  Lines        5678     5678           
  Branches     1188     1093   -95     
=======================================
  Hits         4989     4989           
  Misses        477      477           
  Partials      212      212           
Impacted Files Coverage Δ
apischema/json_schema/types.py 93.02% <100.00%> (+0.34%) ⬆️
apischema/typing.py 85.58% <100.00%> (-0.26%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@klauer
Copy link
Contributor Author

klauer commented Dec 8, 2022

@wyfo, I understand you may be taking a (very well-deserved!) break from working on apischema. Thanks for your hard work so far - I hope you know that there are many happy users out there.

If you would be willing to take a look at this PR, all of those aiming to use apischema with Python 3.11 would be especially appreciative.

I'd be happy to do some follow-up maintenance as well if you would be okay with it.

@wyfo
Copy link
Owner

wyfo commented Dec 9, 2022

Sorry, I'm back!

Indeed, I've taken a long break since April, with a new job (100% Rust), quite demanding, and a second child, even more demanding.
I was planning to take apischema up again for Python 3.11 release in November, but I started at the same time a new project – in Rust, but unrelated to apischema, because apischema doesn't need Rust to have decent performance #pydantic ;) – , and was completely focused on it until now.
And I've realized I'm now sponsored! Thank you so much @stas-dubrovskyi, so now I've to get back to work!

Here is the plan:

  • remove 3.6 (there is some boilerplate to support the mess it was before PEP 560)
  • make it work with Python 3.11, first without all the additional language features
  • merge all dependabot PRs, and tune it to not have a PR for mkdocs-material every days.
  • fix reported bugs, like Fix UncheckedTuples not failing for wrong amount of arguments #513
  • release v0.18 as fast as possible
  • add serialization dynamic flltering (include/exclude with almost zero-cost) (in fact, it has been implemented since March, but I never pushed it)
  • support all new 3.11 features: PEP 646, 655, 673 and 681
  • don't know if GraphQL evolved , but in this case, support evolutions
  • release v0.19
  • tackle design issues like Order fields alphabetically in serialization #229
  • ... will see, maybe v1?

Also, now this library is a thing, with "many happy users out there", I should think about maintenance more seriously. That means two things: more comments (even for me, I haven't read the code for 8 months), and why not additional maintainers!

But first things first, v0.18 is urgent. My goal is to release it this weekend, or during the next week (and I've a lot of PR to help me, thank you all!). v0.19 will maybe wait the end of December.

(Also, I'm thinking about writing some Rust to compare performance with the current generated Cython, but more importantly to integrate a JSON, and why not MessagePack, (de)serializer. Actually, I had tried in Cython at the beginning of the year, but it was so tedious and slow that I gave up. It could improve performance over using a schema-less (de)serializer like orjson, and get closer of msgspec)

I hope I will be able to take apischema over as fast as I want, but at least I'm back on it.

@klauer
Copy link
Contributor Author

klauer commented Dec 9, 2022

Congratulations on the new job, the new child, and the sponsorship! That's all fantastic news. So glad to have you back. :)

The plan sounds good to me. Since removing Python 3.6 is top on your priority list, feel free to close this PR and fix it up in your own preferred way (or let me know what to fix - no hard feelings either way).

@wyfo wyfo merged commit 41f62d4 into wyfo:master Dec 11, 2022
wyfo added a commit that referenced this pull request Dec 11, 2022
wyfo added a commit that referenced this pull request Dec 11, 2022
@wyfo
Copy link
Owner

wyfo commented Dec 12, 2022

In Python 3.11, typing.Any is now a type subclass (related to python/cpython#91154). This broke serialization of JSON schemas in an unexpected (to me) way, resulting in test_schema_versions.py failing to use the correct converter for OPEN_API_3_0

The broken test was not trivial at all to debug, congratulation to have found the solution!

Actually, I wanted to do the exercise of adding supporting 3.11 myself (without reading your PR) to get back into the code, and I spent quite a lot of time to figure this one — my fix is a little bit different however, see #518.

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.

CI: GitHub Actions Python 3.6 job failing Python 3.11 support
3 participants