-
Notifications
You must be signed in to change notification settings - Fork 433
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
Use PyYAML instead of ruamel.yaml #833
Comments
I'd also recommend moving away from ruamel-yaml ASAP as it requires ruamel-yaml-clib which does not support Python 3.11 and this stops this project working with Python 3.11. The project does work in Python 3.10 as I've been running it on that for a while including Django 3.2, 4.0 and 4.1 :) |
Very strange because I just generated a schema in Python 3.11 without problems. |
Interesting. I'll have to try again if it works then great. update I found my issue. my requirements file was last generated by piptools running on Python 3.10 which makes the 3.11 venv I then tested with fail as it includes the requirement to install ruamel-yaml-clib==0.2.6 via ruamel-yaml whereas when you run it on Python 3.11 it no longer requires that. I'll update my test pipelines for that |
@sevdog thanks for raising this. I agree that PyYAML is the way to go. This repo's release 1.21.5 introduced support for python 3.10 and in release 1.21.6 I would like to add support for python 3.11. It's worth pointing out that there is an open PR #806 that advances the ruamel.yaml interfaces to use their version 0.17 methods, however in the long term it is in our interest to be consistent with the rest of the Django tooling and make the switch to PyYAML. I'll have a look at updating the codecs and fields. |
I don't remember the reason why we moved away from FYI these were the representer changes we had to make to have a consistent and clean schema: |
* Feature: Migrate to PyYAML for yaml generator. Closes #833 * Chore: Update swagger ui and redoc dependencies.
* Feature: Migrate to PyYAML for yaml generator. Closes #833 * Chore: Update swagger ui and redoc dependencies. * Fix: Remove required coreapi dependency.
Description
PyYAML is the default YAML serializer used in Django and also the suggested DRF YAML renderer uses it.
If someone uses these library with drf-yasg he is going to have two different YAML parsers, which is quite useless.
Also the concurrent library drf-spectacular uses pyyaml.
Proposal
If there is no particular reason in using
ruamel.yaml
(whcih as of now means "to support YAML 1.2") it will be better to replace it withpyyaml
(for uniformity) or move it as an optional dependency (since YAML relies on a third party library which is not mandatory to generate a schema).The text was updated successfully, but these errors were encountered: