Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 3, 2025

This PR modernizes the tutorial example and improves Django 5.2 compatibility with several key enhancements:

  • Modernized tutorial setup: Added uv script configuration to manage.py for simplified dependency management
  • Enhanced CI/CD: Added GitHub Actions workflow to validate tutorial functionality
  • Django 5.2 compatibility: Added conditional --skip-checks argument support for newer Django versions
  • Improved documentation: Updated setup instructions with clear step-by-step guidance
  • Management command addition: Added create_client command for easier tenant creation
  • Configuration updates: Modernized settings for current Django practices

Key Changes

  • .github/workflows/validate-tutorial.yml: New GitHub Actions workflow that validates the tutorial by creating tenants and running migrations
  • examples/tenant_tutorial/manage.py: Added uv script configuration with proper dependencies and editable package reference
  • examples/tenant_tutorial/customers/management/commands/create_client.py: New management command for creating tenant clients with validation
  • docs/examples.rst: Comprehensive documentation update with modern setup instructions using uv
  • examples/tenant_tutorial/tenant_tutorial/settings.py: Updated for Django 5.2 compatibility including DEFAULT_AUTO_FIELD, modern STORAGES configuration, and relaxed ALLOWED_HOSTS for development
  • URL pattern modernization: Updated from deprecated django.conf.urls.url to modern django.urls.path
  • Migration regeneration: Updated to use Django 4.2 format with BigAutoField
  • src/tenant_schemas/management/commands/migrate_schemas.py: Added Django 5.2 compatibility for --skip-checks argument

Test Plan

  • GitHub Actions workflow validates tutorial setup automatically
  • Tutorial can be run using uv without additional setup
  • create_client command works correctly with validation
  • Migrations run successfully with migrate_schemas --shared
  • Compatible with Django 5.2 while maintaining backward compatibility

This comment was marked as off-topic.

Copilot AI changed the title [WIP] The basic tutorial does not work. Fix django-tenant-schemas tutorial to work with modern Django Sep 3, 2025
Copilot AI requested a review from goodtune September 3, 2025 21:18
Copilot finished work on behalf of goodtune September 3, 2025 21:18
@goodtune

This comment was marked as resolved.

This comment was marked as resolved.

Copilot AI changed the title Fix django-tenant-schemas tutorial to work with modern Django Fix django-tenant-schemas tutorial and add automated validation Sep 3, 2025
Copilot finished work on behalf of goodtune September 3, 2025 22:00
goodtune

This comment was marked as resolved.

This comment was marked as resolved.

Copilot AI changed the title Fix django-tenant-schemas tutorial and add automated validation Fix django-tenant-schemas tutorial and add automated validation with uv Sep 3, 2025
Copilot AI requested a review from goodtune September 3, 2025 22:30
Copilot finished work on behalf of goodtune September 3, 2025 22:30
goodtune

This comment was marked as resolved.

Copilot AI requested a review from goodtune September 4, 2025 12:14
Copilot finished work on behalf of goodtune September 4, 2025 12:14
@goodtune goodtune marked this pull request as ready for review September 26, 2025 13:29
This commit modernizes the tenant tutorial example to use uv for dependency
management and adds Django 5.2 compatibility improvements.

Key Changes:

Tutorial Modernization:
- Convert manage.py to uv script with inline dependencies using PEP 723
- Remove requirements.txt in favor of inline script dependencies
- Update migration files to use Django 4.2+ format (BigAutoField, modern syntax)
- Add DEFAULT_AUTO_FIELD setting for modern Django compatibility
- Remove deprecated DEFAULT_FILE_STORAGE setting (replaced by STORAGES)
- Update documentation to reflect uv-based workflow

CI/Testing Improvements:
- Simplify GitHub Actions workflow to use direct manage.py execution
- Remove complex server testing steps in favor of basic functionality validation
- Update all management command calls to use ./manage.py directly

Django 5.2 Compatibility:
- Add conditional --skip-checks argument support in migrate_schemas command
- Import django module for version checking compatibility

Infrastructure:
- Add build/ directory to .gitignore for cleaner development environment

These changes make the tutorial more accessible to new users by leveraging
modern Python tooling (uv) while maintaining backward compatibility and
adding support for the latest Django versions.
@goodtune goodtune changed the title Fix django-tenant-schemas tutorial and add automated validation with uv Fix tutorial and add automated validation Sep 26, 2025
@goodtune goodtune merged commit ae7b2cd into master Sep 26, 2025
27 checks passed
@goodtune goodtune deleted the copilot/fix-664 branch September 26, 2025 15:15
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.

2 participants