Skip to content

Commit

Permalink
Merge pull request #124 from stuartmaxwell:django-shell
Browse files Browse the repository at this point in the history
Django-shell
  • Loading branch information
stuartmaxwell authored Oct 14, 2024
2 parents fc4036b + dea6b35 commit 7341cde
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
default_language_version:
python: python3.11
python: python3.13

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand All @@ -16,7 +16,7 @@ repos:
rev: "1.22.1" # replace with latest tag on GitHub
hooks:
- id: django-upgrade
args: [--target-version, "4.2"] # Replace with Django version
args: [--target-version, "5.1"] # Replace with Django version
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.6.9
Expand Down
1 change: 1 addition & 0 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"djpress.apps.DjpressConfig",
"timezone_converter",
"markdown_editor",
"shell",
]

if DEBUG:
Expand Down
1 change: 1 addition & 0 deletions shell/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Shell application package."""
10 changes: 10 additions & 0 deletions shell/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""This file contains the configuration of the shell app."""

from django.apps import AppConfig


class ShellConfig(AppConfig):
"""Configuration for the shell app."""

default_auto_field = "django.db.models.BigAutoField"
name = "shell"
1 change: 1 addition & 0 deletions shell/management/commands/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Overrides the default Django management command to add a custom command."""
17 changes: 17 additions & 0 deletions shell/management/commands/shell.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Python 3.13 REPL support using the unsupported _pyrepl module."""

from typing import ClassVar

from django.core.management.commands.shell import Command as BaseShellCommand


class Command(BaseShellCommand):
"""Custom shell command to support the pyrepl shell."""

shells: ClassVar = ["ipython", "bpython", "pyrepl", "python"]

def pyrepl(self, _) -> None: # noqa: ANN001
"""Start a Python 3.13 REPL using the _pyrepl module."""
from _pyrepl.main import interactive_console

interactive_console()
Empty file added shell/migrations/__init__.py
Empty file.

0 comments on commit 7341cde

Please sign in to comment.