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

Feature: Migrate to PyYAML for yaml generator. #845

Merged
merged 2 commits into from
May 16, 2023

Conversation

onegreyonewhite
Copy link
Contributor

Changelog:

  • Feature: Migrate to PyYAML for yaml generator.
  • Chore: Update swagger ui and redoc dependencies.

Closes #833
Closes #827

Results (on some project with 180Kb schema generate_swagger and libyaml installed):

  • ruamel.yaml -> from 1,582s to 1,828s
  • pyyaml -> from 1,231s to 1,499s

@onegreyonewhite
Copy link
Contributor Author

@JoelLefkowitz As far as I can see it hasn't been released yet. Perhaps these changes will be useful for the next release. By the way, we are waiting for it.

@Quatters
Copy link

@JoelLefkowitz ping

@onegreyonewhite
Copy link
Contributor Author

@JoelLefkowitz are u still support this project? Should I fork this?

@JoelLefkowitz
Copy link
Collaborator

Yup, I'll have a look at merging this today

@JoelLefkowitz JoelLefkowitz merged commit afea1bc into axnsan12:1.21.x May 16, 2023
@JoelLefkowitz
Copy link
Collaborator

Thanks @onegreyonewhite

@onegreyonewhite
Copy link
Contributor Author

Thanks @onegreyonewhite

@JoelLefkowitz you're welcome) When are you going to release it?

@JoelLefkowitz
Copy link
Collaborator

Thanks @onegreyonewhite

@JoelLefkowitz you're welcome) When are you going to release it?

Will cut a new release in the next couple of days after a little more testing

JoelLefkowitz pushed a commit that referenced this pull request Jul 20, 2023
* Add sample code to handle Base64 fields in drf-extra-fields project

* Fix format for .rst

* Update answer to the easier version as suggested in Hipo/drf-extra-fields#66 (comment)

* update readme.rst

`permission_classes` expects tuple but list was provided

* url from DEFAULT_API_URL now works

fix a bug: url from swagger_settings.DEFAULT_API_URL is not working

* Check for allow_null attribute

* Add utf-8 support for generated formats

* Added `many` support to example code.

* serialize pytz object as a string

* simplify if condition

* handle errors rendering with TemplateHTMLRenderer

This change fixes an `OPTIONS` request to the API page which will return
a successful response, but the `TemplateHTMLRender` will not be prepared
to render it since there is no template name provided in either the view
or response [1].

[1]: https://github.com/encode/django-rest-framework/blob/f0a5b958a134e8cd94e3ef3263e8fa623ac9b82f/rest_framework/renderers.py#L178-L189

* Allow specifying response as a reference

* [readme] Fix missing re_path import

* fix map source mapping

* Remove universal wheel, python 2 is unsupported

* Inline allow_unicode parameter

* Update changelog

* Update changelog typos

* Add cspell

* Fix old spelling errors

* Add ref_name to UserSerializer after removing suffix typo

* Set permission classes to a tuple

* Update chagnelog

* Add prepublish twine check

* Fix action version syntax

* Fix indentation in README.rst code blocks

* Add twine to publish dependencies

* Specify toxenv explicitly

* Specify all tox targets

* Add py prefix to toxenvs

* Update changelog

* Update changelog

* Declare Django 3.2 support in README, classifiers

This commit will make sure that `Django :: 3.2` will show up in the
classifiers list on PyPI: https://pypi.org/project/drf-yasg/

(The magic happens because we parse the README to get supported Django):
https://github.com/DavidCain/drf-yasg/blob/ee29412d3cdb311/setup.py#L36

3.2 support should already exist
================================
A closed pull request, #735,
noted support for Django 3.2 in both `tox.ini`, and the README.

That PR was closed in favor of
#741, which edited `tox.ini`
and switched to GitHub Actions.

#735 (comment)

This project has been testing on Django 3.2 for a long time (about a
year). I think we can declare it supported it the README!

* Fix `pip install` command for contributors on zsh

On `zsh` (a popular shell, and the default for macOS), install fails:

    $ pip install -U -e .[validation]
    zsh: no matches found: .[validation]

Quote the arguments so that `bash` or `zsh` will succeed.

* Dont use NullBooleanField if drf version >= 3.14.0

* Swap back BooleanField and NullBooleanField

* Update changelog

* Update README to use path instead of re_path in example

* Run tests with latest dependencies

- Django 4.0 & 4.1
- DRF 3.13 & 3.14
- Python 3.10

* Add python 3.10 in GH actions matrix

* Fix RecursiveField

* Change github actions runner from ubuntu-latest to ubuntu-20.04

* Change github actions runner from ubuntu-latest to ubuntu-20.04

* Remove python 3.6 tests since swagger-spec-validator no longer supports it

* Use a string literal for python versions such as "3.10"

* Add python 3.10 compatibility to README.md

* Update changelog

* Fix: Provide enums support for schema.

* Fix: Tests for Python 3.11.

* Refactoring: Removed old version code.

* Fix: Linting is now working.

* Fix: Provide usage of Enums as dict keys.

* Fix: Docs build with latest sphinx versions.

* keep path parameters in their given order

* Fix: Action build docs with latest tox version.

* Fix: Update python version for dj-master branch.

Django master branch bumped minimal python version
to Python 3.10. In latest version was added check for uniq basename.

* Feature: Migrate to PyYAML for yaml generator. (#845)

* Feature: Migrate to PyYAML for yaml generator.

Closes #833

* Chore: Update swagger ui and redoc dependencies.

* Fix: Remove required coreapi dependency. (#854)

* Feature: Migrate to PyYAML for yaml generator.

Closes #833

* Chore: Update swagger ui and redoc dependencies.

* Fix: Remove required coreapi dependency.

* Update Changelog

* Feature: Add ``drf_yasg.inspectors.query.DrfAPICompatInspector``. (#857)

* Feature: Provide to override default renderers via settings.

* Feature: Enable tests for django 4.2.

* Docs: Add information how to override ``DEFAULT_SPEC_RENDERERS``.

* Feature: Add ``drf_yasg.inspectors.query.DrfAPICompatInspector``.

This inspector should be main and replace ``CoreAPICompatInspector`` in the future.

* [fix] Fixed map source mapping (#859)

* Tests: Improve test coverage 95.91% -> 98.30%. (#862)

* Update Changelog

* Add python3.6 to the actions matrix but exclude it from tests

---------

Co-authored-by: Terry <[email protected]>
Co-authored-by: Sumit Singh <[email protected]>
Co-authored-by: Core-Chan <[email protected]>
Co-authored-by: Krista Mae Rectra <[email protected]>
Co-authored-by: mmurashov <[email protected]>
Co-authored-by: Christoph Beckmann <[email protected]>
Co-authored-by: MilanPecov <[email protected]>
Co-authored-by: Terence D. Honles <[email protected]>
Co-authored-by: Cristi Vîjdea <[email protected]>
Co-authored-by: Max Vorobev <[email protected]>
Co-authored-by: Damien Ramelet <[email protected]>
Co-authored-by: Petr Dlouhý <[email protected]>
Co-authored-by: gopackgo90 <[email protected]>
Co-authored-by: David Cain <[email protected]>
Co-authored-by: Amir Andohkosh <[email protected]>
Co-authored-by: Nikolaos Michas <[email protected]>
Co-authored-by: Ignacio Orlandini <[email protected]>
Co-authored-by: Sergey Klyuykov <[email protected]>
Co-authored-by: Gagan Deep <[email protected]>
JoelLefkowitz added a commit that referenced this pull request Oct 17, 2024
* Add sample code to handle Base64 fields in drf-extra-fields project

* Fix format for .rst

* Update answer to the easier version as suggested in Hipo/drf-extra-fields#66 (comment)

* update readme.rst

`permission_classes` expects tuple but list was provided

* url from DEFAULT_API_URL now works

fix a bug: url from swagger_settings.DEFAULT_API_URL is not working

* Check for allow_null attribute

* Add utf-8 support for generated formats

* Added `many` support to example code.

* serialize pytz object as a string

* simplify if condition

* handle errors rendering with TemplateHTMLRenderer

This change fixes an `OPTIONS` request to the API page which will return
a successful response, but the `TemplateHTMLRender` will not be prepared
to render it since there is no template name provided in either the view
or response [1].

[1]: https://github.com/encode/django-rest-framework/blob/f0a5b958a134e8cd94e3ef3263e8fa623ac9b82f/rest_framework/renderers.py#L178-L189

* Allow specifying response as a reference

* [readme] Fix missing re_path import

* fix map source mapping

* Remove universal wheel, python 2 is unsupported

* Inline allow_unicode parameter

* Update changelog

* Update changelog typos

* Add cspell

* Fix old spelling errors

* Add ref_name to UserSerializer after removing suffix typo

* Set permission classes to a tuple

* Update chagnelog

* Add prepublish twine check

* Fix action version syntax

* Fix indentation in README.rst code blocks

* Add twine to publish dependencies

* Specify toxenv explicitly

* Specify all tox targets

* Add py prefix to toxenvs

* Update changelog

* Update changelog

* Declare Django 3.2 support in README, classifiers

This commit will make sure that `Django :: 3.2` will show up in the
classifiers list on PyPI: https://pypi.org/project/drf-yasg/

(The magic happens because we parse the README to get supported Django):
https://github.com/DavidCain/drf-yasg/blob/ee29412d3cdb311/setup.py#L36

3.2 support should already exist
================================
A closed pull request, #735,
noted support for Django 3.2 in both `tox.ini`, and the README.

That PR was closed in favor of
#741, which edited `tox.ini`
and switched to GitHub Actions.

#735 (comment)

This project has been testing on Django 3.2 for a long time (about a
year). I think we can declare it supported it the README!

* Fix `pip install` command for contributors on zsh

On `zsh` (a popular shell, and the default for macOS), install fails:

    $ pip install -U -e .[validation]
    zsh: no matches found: .[validation]

Quote the arguments so that `bash` or `zsh` will succeed.

* Dont use NullBooleanField if drf version >= 3.14.0

* Swap back BooleanField and NullBooleanField

* Update changelog

* Update README to use path instead of re_path in example

* Run tests with latest dependencies

- Django 4.0 & 4.1
- DRF 3.13 & 3.14
- Python 3.10

* Add python 3.10 in GH actions matrix

* Fix RecursiveField

* Change github actions runner from ubuntu-latest to ubuntu-20.04

* Change github actions runner from ubuntu-latest to ubuntu-20.04

* Remove python 3.6 tests since swagger-spec-validator no longer supports it

* Use a string literal for python versions such as "3.10"

* Add python 3.10 compatibility to README.md

* Update changelog

* Fix: Provide enums support for schema.

* Fix: Tests for Python 3.11.

* Refactoring: Removed old version code.

* Fix: Linting is now working.

* Fix: Provide usage of Enums as dict keys.

* Fix: Docs build with latest sphinx versions.

* keep path parameters in their given order

* Fix: Action build docs with latest tox version.

* Fix: Update python version for dj-master branch.

Django master branch bumped minimal python version
to Python 3.10. In latest version was added check for uniq basename.

* Feature: Migrate to PyYAML for yaml generator. (#845)

* Feature: Migrate to PyYAML for yaml generator.

Closes #833

* Chore: Update swagger ui and redoc dependencies.

* Fix: Remove required coreapi dependency. (#854)

* Feature: Migrate to PyYAML for yaml generator.

Closes #833

* Chore: Update swagger ui and redoc dependencies.

* Fix: Remove required coreapi dependency.

* Update Changelog

* Feature: Add ``drf_yasg.inspectors.query.DrfAPICompatInspector``. (#857)

* Feature: Provide to override default renderers via settings.

* Feature: Enable tests for django 4.2.

* Docs: Add information how to override ``DEFAULT_SPEC_RENDERERS``.

* Feature: Add ``drf_yasg.inspectors.query.DrfAPICompatInspector``.

This inspector should be main and replace ``CoreAPICompatInspector`` in the future.

* [fix] Fixed map source mapping (#859)

* Tests: Improve test coverage 95.91% -> 98.30%. (#862)

* Update Changelog

* Add python3.6 to the actions matrix but exclude it from tests

* Allow swagger to use custom CSRF settings and read the CSRF cookie (#660)

* Update README.rst to fix import error (#889)

---------

Co-authored-by: Terry <[email protected]>
Co-authored-by: Sumit Singh <[email protected]>
Co-authored-by: Core-Chan <[email protected]>
Co-authored-by: Krista Mae Rectra <[email protected]>
Co-authored-by: mmurashov <[email protected]>
Co-authored-by: Christoph Beckmann <[email protected]>
Co-authored-by: MilanPecov <[email protected]>
Co-authored-by: Terence D. Honles <[email protected]>
Co-authored-by: Cristi Vîjdea <[email protected]>
Co-authored-by: Max Vorobev <[email protected]>
Co-authored-by: Damien Ramelet <[email protected]>
Co-authored-by: Petr Dlouhý <[email protected]>
Co-authored-by: gopackgo90 <[email protected]>
Co-authored-by: David Cain <[email protected]>
Co-authored-by: Amir Andohkosh <[email protected]>
Co-authored-by: Nikolaos Michas <[email protected]>
Co-authored-by: Ignacio Orlandini <[email protected]>
Co-authored-by: Sergey Klyuykov <[email protected]>
Co-authored-by: Joel Lefkowitz <[email protected]>
Co-authored-by: Gagan Deep <[email protected]>
Co-authored-by: Ummer Farooq <[email protected]>
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.

3 participants