Skip to content

Releases: pmdevita/django-shinobi

1.4.2

10 Mar 15:26
e11ccac

Choose a tag to compare

Shinobi 1.4.2 fixes a few minor bugs that our tests didn't cover before the 1.4.1 release.

  • In Python 3.13 or older, empty/blank Schemas (useful for sharing config between Schemas) no longer crash trying to import annotationlib.
  • In Python 3.14, ModelSchema now correctly constructs types for private attributes (fields starting with _) again.

Full Changelog

Bug Fixes

CI/Build

Full Changelog: v1.4.1...v1.4.2

1.4.1

07 Mar 21:53
68bde3c

Choose a tag to compare

Shinobi 1.4.1 is a maintenance release, it adds support for Python 3.14 and Pydantic 2.12.

This release drops Python 3.8 support as it is EOL. Python 3.9 is also EOL now and will be dropped in 1.5.0.

Special thanks to @jwnwilson who contributed hybrid async auth! We unfortunately found additional issues after it was merged and had to pull it for this release, hopefully we'll be able to bring this back again sometime soon.

For contributors, there have been a number of improvements made to the CI and build that should help you. Using pull_request_target, tests should now run automatically for you when you open a PR, should be very helpful testing against the many different supported installations. The Pydantic version has also been pinned in the pre-commit mypy, which should make for less surprises when Pydantic inevitably updates and breaks a few things.

Full Changelog

Features

Docs

Refactoring

Build/CI

New Contributors

Full Changelog: v1.4.0...v1.4.1

1.4.0

26 Aug 21:20
a85534a

Choose a tag to compare

Shinobi 1.4.0 is based on Ninja 1.4.3. You can read the changes for Ninja here.

You can find more info about the differences with Ninja in the docs.

Highlights

Schema performance improvements

It's taken a lot of work over the past few months but the performance improvements for Schema are now complete! When enabled, you should see a significant speed up in Schema validation. One particularly heavy response that was tested saw a 15x improvement in speed.

Before (~512ms):

image

After (~34ms):

image

Using the benchmarks from https://github.com/oscarychen/building-efficient-api, it looks like Shinobi scores about 20% faster in median time. Shinobi is still almost twice as slow as FastAPI, so there remains much more to do in optimization.

image

Choices support

ModelSchema now supports including a Field's choices in validation and the OpenAPI spec. You can also use TextChoices or
IntegerChoices to declare reusable Enum Schema, helpful for auto-generated API clients.

Auto-generated aliases now work with ForeignKey Fields

Previously, if you were using auto-generated aliases (to convert to camelCase, for example), any ForeignKey Fields you might
pull in with ModelSchema did not have their names aliased correctly. This is now fixed.

Primary keys and blanks are now opt-in nullable

Ninja 1.3.0 silently introduced a breaking change where any primary key or blank Model Fields would get marked as nullable by ModelSchema. This change broke the data contract you might make through your OpenAPI schema, as a primary key should never be null, and blank is a setting used for form validation. This has been reverted to the previous behavior.

I have little information about how this change affects users. If this breaks your use case, feel free to open an issue on Shinobi.

More robust testing and version support

Ninja's CI testing only checked coverage against one specific version of Python, Django, and Pydantic, meaning our visibility into how well Ninja supported your particular combination of installs was limited. This also meant version specific code had to be excluded from coverage, turning PR merging into a game of whack-a-mole.

Shinobi now checks all currently supported versions of Django, and their compatible Python and Pydantic versions, and
combines the coverage from them. From here, we can start removing coverage exclusions and find more blind spots in the tests.

Full Changelog

These are the full changes, including those released in 1.4.0a.

Features

  • Improve performance by removing DjangoGetter by @pmdevita in #28
  • ModelSchema: Add support for choices by @pmdevita in #23

Bug Fixes

  • Use property to alias ForeignKey fields instead of Pydantic alias by @pmdevita in #7
  • Fix tests on Pydantic 2.11 and sync Ruff version by @pmdevita in #11
  • Fix primary key always being marked as nullable in schema by @pmdevita in #8

Docs

  • Docs: Update dependencies, fix building by @pmdevita in #4
  • Docs: Update contact links, more renames, link fixes by @pmdevita in #18
  • Docs: Add Ninja migration guide by @pmdevita in #24
  • Update docs and version for 1.4.0 by @pmdevita in #41

Build/CI

  • CI: Set full_test runner to use Ubuntu 22 for Python 3.7 by @pmdevita in #10
  • Build docs CI by @pmdevita in #13
  • Increment version to 1.4.0a, use trusted publisher by @pmdevita in #14
  • Combine coverage from all test runs by @pmdevita in #34
  • Update support to only currently supported versions of Django and Python by @pmdevita in #37
  • Merge Ninja 1.4.3 by @pmdevita in #40

Full Changelog: v1.4.0a...v1.4.0

v1.4.0a

13 Feb 16:23
e86e7b7

Choose a tag to compare

v1.4.0a Pre-release
Pre-release

Django Shinobi 1.4.0a

This is the first preliminary release for Shinobi, testing to make sure everything is in order. It contains a number of new features from upstream, as well as the foreign key alias fix and the fix for primary key and blank fields always being marked as nullable.

There was a miss where this release's tag marked a commit where the library still reports itself as 1.3.0. This will be fixed in the next release.

What's changed in Ninja

GitHub didn't generate release notes for this so I'm looking here, apologies if I miss anything. Not linking to avoid noise on the Ninja project from GitHub's backlinks.

Features

  • Nested URL Parameters by vitalik
  • Better error and explanation if schema used as default instead of annotation by vitalik
  • Pydantic 2.9 compatibility by vitalik
  • Made NinjaTestClient accept COOKIES by c4ffein
  • Add pattern support to param by sunfkny
  • Distinguish between AuthenticationError and AuthorizationError by c4ffein and vitalik
  • Add IP4/6Network and Url serialisation by grigi
  • add register_type public function by vitalik
  • Support multi-period intervals in throttling by robhudson
  • Add a method for customizing validation errors by jceipek

Bug Fixes

  • Fix Router default options by Ksauder
  • Fixed coverage on Python >= 3.11 by c4ffein

Docs

  • Update pagination.md by syre
  • Better csrf doc by c4ffein
  • fix small type in throttling docs by noahgorstein
  • Small typo fixes and doc mention router import by michaelg100
  • document how to use an optional file input by toudi
  • fix typos in docs by ahmetveburak
  • Adding docs how to add a user in a test by pinguin999
  • Updated docs for url parameters in nested routers by kentrh
  • Replace update_forward_refs with model_rebuild in docs by Danie-1

What's Changed in Shinobi

CI

Bug Fixes

  • Use property to alias ForeignKey fields instead of Pydantic alias by @pmdevita in #7
  • Fix tests on Pydantic 2.11 and sync Ruff version by @pmdevita in #11
  • Fix primary key always being marked as nullable in schema by @pmdevita in #8

Other

New Contributors

Full Changelog: v1.3.0...v1.4.0a