├── .python-version ├── src └── django_pyrepl │ ├── py.typed │ ├── __init__.py │ └── management │ └── commands │ ├── __init__.py │ └── shell.py ├── .gitignore ├── pyproject.toml ├── README.md ├── LICENCE └── .github └── workflows └── python-publish.yml /.python-version: -------------------------------------------------------------------------------- 1 | 3.13 2 | -------------------------------------------------------------------------------- /src/django_pyrepl/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/django_pyrepl/__init__.py: -------------------------------------------------------------------------------- 1 | VERSION = (1, 0, 0) 2 | -------------------------------------------------------------------------------- /src/django_pyrepl/management/commands/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Python-generated files 2 | __pycache__/ 3 | *.py[oc] 4 | build/ 5 | dist/ 6 | wheels/ 7 | *.egg-info 8 | 9 | # Virtual environments 10 | .venv 11 | -------------------------------------------------------------------------------- /src/django_pyrepl/management/commands/shell.py: -------------------------------------------------------------------------------- 1 | """Python 3.13 REPL support using the unsupported _pyrepl module.""" 2 | 3 | from django.core.management.commands.shell import Command as BaseShellCommand 4 | 5 | 6 | class Command(BaseShellCommand): 7 | shells = ["pyrepl", "python"] 8 | 9 | def pyrepl(self, options): 10 | from _pyrepl.main import interactive_console 11 | 12 | interactive_console() 13 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "django-pyrepl" 3 | version = "1.0.0" 4 | description = "Use Python 3.13 REPL with Django shell" 5 | readme = "README.md" 6 | authors = [ 7 | { name = "Sasha Matijasic", email = "sasha@selectnull.com" } 8 | ] 9 | requires-python = ">=3.13" 10 | dependencies = [] 11 | classifiers = [ 12 | "Programming Language :: Python :: 3.13", 13 | "Framework :: Django" 14 | ] 15 | 16 | [build-system] 17 | requires = ["hatchling"] 18 | build-backend = "hatchling.build" 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | django-pyrepl 2 | ============= 3 | 4 | You've upgraded your Django project to Python 3.13 and want to try out the 5 | new REPL. Unfortunately, it's a no go. But thankfully, Trey Hunner wrote 6 | [Django and the Python 3.13 REPL](https://treyhunner.com/2024/10/django-and-the-new-python-3-dot-13-repl/) 7 | article in which he shows how to enable it. 8 | 9 | This is just his idea packaged into a installable django app. 10 | Full credits go to Trey. 11 | 12 | Warning: This app uses unsupported `_pyrepl` module. Hopefully, 13 | the future versions of Python will be supported and this app 14 | becomes deprecated. 15 | 16 | ## Installation 17 | 18 | ```bash 19 | uv add django_pyrepl 20 | ``` 21 | 22 | Or if you really need to: 23 | 24 | ```bash 25 | pip install django_pyrepl 26 | ``` 27 | 28 | After that, simply add it to `INSTALLED_APPS` in your project `settings.py` 29 | 30 | ```python 31 | INSTALLED_APPS = [ 32 | ... 33 | "django_pyrepl", 34 | ... 35 | ] 36 | ``` 37 | 38 | ## Licence 39 | 40 | MIT. 41 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2024 Sasha Matijasic 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /.github/workflows/python-publish.yml: -------------------------------------------------------------------------------- 1 | # This workflow will upload a Python Package using Twine when a release is created 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries 3 | 4 | # This workflow uses actions that are not certified by GitHub. 5 | # They are provided by a third-party and are governed by 6 | # separate terms of service, privacy policy, and support 7 | # documentation. 8 | 9 | name: Upload Python Package 10 | 11 | on: 12 | release: 13 | types: [published] 14 | 15 | permissions: 16 | contents: read 17 | 18 | jobs: 19 | deploy: 20 | 21 | runs-on: ubuntu-latest 22 | 23 | steps: 24 | - uses: actions/checkout@v4 25 | - name: Set up Python 26 | uses: actions/setup-python@v3 27 | with: 28 | python-version: '3.x' 29 | - name: Install dependencies 30 | run: | 31 | python -m pip install --upgrade pip 32 | pip install build 33 | - name: Build package 34 | run: python -m build 35 | - name: Publish package 36 | uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 37 | with: 38 | user: __token__ 39 | password: ${{ secrets.PYPI_API_TOKEN }} 40 | - name: pypi-publish 41 | uses: pypa/gh-action-pypi-publish@v1.12.2 42 | --------------------------------------------------------------------------------