فهرست منبع

Closes #23732: Deprecate support for Python 3.12 and 3.13 (#23846)

* Closes #23732: Deprecate support for Python 3.12 and 3.13

NetBox v5.0 will require Python 3.14 or later. Starting NetBox under
Python 3.12 or 3.13 now raises a FutureWarning, and the installation
and upgrade docs note the coming requirement.

* Recommend Python 3.14 in the install guide and name the deprecating release

* Recommend Python 3.14 when running the upgrade script
bctiemann 1 روز پیش
والد
کامیت
fb48a465c3
4فایلهای تغییر یافته به همراه20 افزوده شده و 6 حذف شده
  1. 4 4
      docs/installation/3-netbox.md
  2. 3 0
      docs/installation/index.md
  3. 5 2
      docs/installation/upgrading.md
  4. 8 0
      netbox/netbox/settings.py

+ 4 - 4
docs/installation/3-netbox.md

@@ -29,8 +29,8 @@ The instance root defaults to `/opt/netbox` and may be changed with the `NETBOX_
 
 
 Begin by installing all system packages required by NetBox and its dependencies.
 Begin by installing all system packages required by NetBox and its dependencies.
 
 
-!!! warning "Python 3.12 or later required"
-    NetBox supports only Python 3.12 or later.
+!!! warning "Python 3.14 recommended"
+    NetBox requires Python 3.12 or later, and Python 3.14 is recommended. Support for Python 3.12 and 3.13 is deprecated as of NetBox v4.8 and will be removed in NetBox v5.0, which will require Python 3.14 or later.
 
 
 ```no-highlight
 ```no-highlight
 sudo apt install -y python3 python3-pip python3-venv python3-dev \
 sudo apt install -y python3 python3-pip python3-venv python3-dev \
@@ -38,7 +38,7 @@ build-essential libxml2-dev libxslt1-dev libffi-dev libpq-dev \
 libssl-dev zlib1g-dev
 libssl-dev zlib1g-dev
 ```
 ```
 
 
-Before continuing, check that your installed Python version is at least 3.12:
+Before continuing, check your installed Python version. It must be at least 3.12, and should be 3.14 or later:
 
 
 ```no-highlight
 ```no-highlight
 python3 -V
 python3 -V
@@ -64,7 +64,7 @@ sudo python3 -m venv /opt/netbox/venv
 sudo /opt/netbox/venv/bin/python -m pip install --upgrade pip
 sudo /opt/netbox/venv/bin/python -m pip install --upgrade pip
 ```
 ```
 
 
-If the default `python3` executable is older than Python 3.12, create the virtual environment with a supported interpreter instead (for example, `sudo python3.12 -m venv /opt/netbox/venv`). That interpreter also needs its own `venv` and `dev` packages (for example, `python3.12-venv` and `python3.12-dev`), which are not covered by the system packages above.
+If the default `python3` executable is older than Python 3.14, create the virtual environment with Python 3.14 instead (for example, `sudo python3.14 -m venv /opt/netbox/venv`). If your distribution doesn't package Python 3.14, install it from another source first. That interpreter also needs its own `venv` and `dev` packages (for example, `python3.14-venv` and `python3.14-dev`), which are not covered by the system packages above.
 
 
 Install the desired NetBox release. Replace `X.Y.Z` with the exact version to install. (Available releases are listed on [PyPI](https://pypi.org/project/netbox/#history).)
 Install the desired NetBox release. Replace `X.Y.Z` with the exact version to install. (Available releases are listed on [PyPI](https://pypi.org/project/netbox/#history).)
 
 

+ 3 - 0
docs/installation/index.md

@@ -31,6 +31,9 @@ The following sections detail how to set up a new instance of NetBox:
 | PostgreSQL | 15+                |
 | PostgreSQL | 15+                |
 | Redis      | 6.0+               |
 | Redis      | 6.0+               |
 
 
+!!! warning "Python 3.12 and 3.13 are deprecated"
+    Support for Python 3.12 and 3.13 is deprecated as of NetBox v4.8 and will be removed in NetBox v5.0, which will require Python 3.14 or later. New deployments should use Python 3.14.
+
 Below is a simplified overview of the NetBox application stack for reference:
 Below is a simplified overview of the NetBox application stack for reference:
 
 
 ```mermaid
 ```mermaid

+ 5 - 2
docs/installation/upgrading.md

@@ -38,6 +38,9 @@ NetBox requires the following dependencies:
 | PostgreSQL | 15+                |
 | PostgreSQL | 15+                |
 | Redis      | 6.0+               |
 | Redis      | 6.0+               |
 
 
+!!! warning "Python 3.12 and 3.13 are deprecated"
+    Support for Python 3.12 and 3.13 is deprecated as of NetBox v4.8 and will be removed in NetBox v5.0, which will require Python 3.14 or later. Installations running Python 3.12 or 3.13 must move to Python 3.14 before upgrading to NetBox v5.0.
+
 ### Version History
 ### Version History
 
 
 | NetBox Version | Python min | Python max | PostgreSQL min | Redis min |                                       Documentation                                       |
 | NetBox Version | Python min | Python max | PostgreSQL min | Redis min |                                       Documentation                                       |
@@ -254,10 +257,10 @@ sudo ./upgrade.sh
 ```
 ```
 
 
 !!! warning
 !!! warning
-    If the default version of Python is not **at least 3.12**, you'll need to pass the path to a supported Python version as an environment variable when calling the upgrade script. For example:
+    NetBox requires **at least Python 3.12**, but Python 3.14 is recommended: support for Python 3.12 and 3.13 is deprecated and will be removed in NetBox v5.0. If the default version of Python on your server is older than 3.14, pass the path to a Python 3.14 installation as an environment variable when calling the upgrade script. For example:
 
 
     ```no-highlight
     ```no-highlight
-    sudo PYTHON=/usr/bin/python3.12 ./upgrade.sh
+    sudo PYTHON=/usr/bin/python3.14 ./upgrade.sh
     ```
     ```
 
 
 !!! note
 !!! note

+ 8 - 0
netbox/netbox/settings.py

@@ -57,6 +57,14 @@ if sys.version_info < (3, 12):  # noqa: UP036
     raise RuntimeError(
     raise RuntimeError(
         f"NetBox requires Python 3.12 or later. (Currently installed: Python {platform.python_version()})"
         f"NetBox requires Python 3.12 or later. (Currently installed: Python {platform.python_version()})"
     )
     )
+# TODO: Remove in NetBox v5.0
+if sys.version_info < (3, 14):
+    warnings.warn(
+        f"Support for Python 3.12 and 3.13 is deprecated and will be removed in NetBox v5.0. Please upgrade to "
+        f"Python 3.14 or later before upgrading to NetBox v5.0. (Currently installed: Python "
+        f"{platform.python_version()})",
+        FutureWarning,
+    )
 
 
 #
 #
 # Configuration import
 # Configuration import