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

Django5plus #505

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Django5plus #505

wants to merge 13 commits into from

Conversation

kfields
Copy link

@kfields kfields commented Apr 2, 2024

This PR only affects project management/maintenance. The only real code changes were to make MyPy and Ruff happy. :)

Changes

Dependencies

"Django >=3.2,<6.0"

This is what Wagtail uses in their setup.py. It seems reasonable to me. I don't think there will be any breaking changes before the next major version.

Project Management

I replaced Poetry and the Makefile with Hatch.
I ended up doing this because I needed a way to use a test matrix locally and there wasn't a .tox file as mentioned in the CONTRIBUTING.md file. I started to write one but then it occured to me that if a test in a matrix did fail how could you easily shell into it to debug and fix the problem? With Hatch you can!
I started using Hatch a couple of years ago when I was working on a project that used Maturin as a build backend and discovered that Poetry was non-standard and was not going to work out. I've been using it for all of my Python libraries ever since.

Github Workflows

I updated all actions to the latest versions.

gh-pages.yml

See: Creating a custom GitHub Actions workflow to publish your site

This is just easier. You don't have to deal with having a gh-pages branch. You will have to change from 'use branch' to 'use actions' in you settings though.

Tested via a toy project I wrote: cowsay-django

release.yml

Replaced poetry with hatch.
Unable to test on my end. Should work.

release_check.yml

Replaced poetry with hatch.
Unable to test on my end. Should work.

tests.yml

Replaced poetry with hatch.
Tested locally using act
Also tested on GitHub with cowsay-django
Make sure you have the CODECOV_TOKEN in your Repository secrets under settings/secrets/actions.

mypy.yml

Integrated into tests.yml

dependabot.yml

Deleted. Doesn't belong there.

Documentation

_prebuild.py

Changed where it was copying the RELEASE.md to changelog.md, it should be copying CHANGELOG.md to changelog.md.
TODO: RELEASE.md needs to be appended to CHANGELOG.md and then copied to docs/changelog.md.

contributing.md

Updated to use Hatch commands instead of the Makefile.
Also added instructions on how to use the quickstart example.

Examples

Created an example directory and moved the quickstart example into it.
There should be more examples. Captcha comes to mind.
Test clients would be nice.

quickstart

Added a pyproject.toml file with hatch commands to bootstrap and serve the project.
I tested it through GraphiQl and it wasn't authenticating until I changed:
schema = strawberry.Schema(query=Query, mutation=Mutation, extensions=[SchemaDirectiveExtension])
to:
schema = JwtSchema(query=Query, mutation=Mutation)

Test Project

Created an index page with links to the different graphql endpoints. Looks better than a 404.
Moved manage.py up to the repo root to simplify things.
Deleted migrate.py from the repo root because it conflicts with using migrate via manage.py since they use different settings. Like this:

  File "/home/kurt/.local/share/hatch/env/virtual/strawberry-django-auth/BIfMEA9B/strawberry-django-auth/lib/python3.10/site-packages/django/db/migrations/loader.py", line 327, in check_consistent_history
    raise InconsistentMigrationHistory(
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency customuser.0001_initial on database 'default'.

This doesn't affect the tests since they create temporary databases for each pytest command.

So, settings_b is used to serve the testproject.

@nrbnlulu
Copy link
Owner

nrbnlulu commented Apr 2, 2024

Hey, thanks for the PR though I think I it is too intrusive and diffused for it's task which is just updating the django
version constraint 🙃

if you want you can spread this PR to few separated ones.
FYI:

  • although I have nothing against hatch it is not compatible with autopub which we use in our release CI. (OFC we can create our own release CI but...)
  • A friendly note, when you submit PR's try to make as less changes as you can because otherwise it would be hard for the maintainer to review.

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.

None yet

2 participants