1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Closes #7731: Require Python 3.8 or later

This commit is contained in:
jeremystretch
2021-12-09 15:35:40 -05:00
parent de698154cd
commit 62e5680eaf
8 changed files with 26 additions and 25 deletions

View File

@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: [3.8, 3.9, 3.10]
node-version: [14.x]
services:
redis:

View File

@ -54,7 +54,7 @@ NetBox is built on the [Django](https://djangoproject.com/) Python framework and
## Supported Python Versions
NetBox supports Python 3.7, 3.8, and 3.9 environments currently. (Support for Python 3.6 was removed in NetBox v3.0.)
NetBox supports Python 3.8, 3.9, and 3.10 environments.
## Getting Started

View File

@ -6,8 +6,8 @@ This section of the documentation discusses installing and configuring the NetBo
Begin by installing all system packages required by NetBox and its dependencies.
!!! warning "Python 3.7 or later required"
NetBox v3.0 and v3.1 require Python 3.7, 3.8, or 3.9. It is recommended to install at least Python v3.8, as this will become the minimum supported Python version in NetBox v3.2.
!!! warning "Python 3.8 or later required"
NetBox v3.2 requires Python 3.8, 3.9, or 3.10.
=== "Ubuntu"
@ -17,16 +17,11 @@ Begin by installing all system packages required by NetBox and its dependencies.
=== "CentOS"
!!! warning
CentOS 8 does not provide Python 3.7 or later via its native package manager. You will need to install it via some other means. [Here is an example](https://tecadmin.net/install-python-3-7-on-centos-8/) of installing Python 3.7 from source.
Once you have Python 3.7 or later installed, install the remaining system packages:
```no-highlight
sudo yum install -y gcc libxml2-devel libxslt-devel libffi-devel libpq-devel openssl-devel redhat-rpm-config
```
Before continuing, check that your installed Python version is at least 3.7:
Before continuing, check that your installed Python version is at least 3.8:
```no-highlight
python3 -V
@ -234,10 +229,10 @@ Once NetBox has been configured, we're ready to proceed with the actual installa
sudo /opt/netbox/upgrade.sh
```
Note that **Python 3.7 or later is required** for NetBox v3.0 and later releases. If the default Python installation on your server is set to a lesser version, pass the path to the supported installation as an environment variable named `PYTHON`. (Note that the environment variable must be passed _after_ the `sudo` command.)
Note that **Python 3.8 or later is required** for NetBox v3.2 and later releases. If the default Python installation on your server is set to a lesser version, pass the path to the supported installation as an environment variable named `PYTHON`. (Note that the environment variable must be passed _after_ the `sudo` command.)
```no-highlight
sudo PYTHON=/usr/bin/python3.7 /opt/netbox/upgrade.sh
sudo PYTHON=/usr/bin/python3.8 /opt/netbox/upgrade.sh
```
!!! note

View File

@ -19,7 +19,7 @@ The video below demonstrates the installation of NetBox v3.0 on Ubuntu 20.04 for
| Dependency | Minimum Version |
|------------|-----------------|
| Python | 3.7 |
| Python | 3.8 |
| PostgreSQL | 10 |
| Redis | 4.0 |

View File

@ -10,7 +10,7 @@ NetBox v3.0 and later requires the following:
| Dependency | Minimum Version |
|------------|-----------------|
| Python | 3.7 |
| Python | 3.8 |
| PostgreSQL | 10 |
| Redis | 4.0 |
@ -76,10 +76,10 @@ sudo ./upgrade.sh
```
!!! warning
If the default version of Python is not at least 3.7, you'll need to pass the path to a supported Python version as an environment variable when calling the upgrade script. For example:
If the default version of Python is not at least 3.8, you'll need to pass the path to a supported Python version as an environment variable when calling the upgrade script. For example:
```no-highlight
sudo PYTHON=/usr/bin/python3.7 ./upgrade.sh
sudo PYTHON=/usr/bin/python3.8 ./upgrade.sh
```
This script performs the following actions:

View File

@ -48,7 +48,7 @@ The plugin source directory contains all the actual Python code and other resour
### Create setup.py
`setup.py` is the [setup script](https://docs.python.org/3.7/distutils/setupscript.html) we'll use to install our plugin once it's finished. The primary function of this script is to call the setuptools library's `setup()` function to create a Python distribution package. We can pass a number of keyword arguments to inform the package creation as well as to provide metadata about the plugin. An example `setup.py` is below:
`setup.py` is the [setup script](https://docs.python.org/3.8/distutils/setupscript.html) we'll use to install our plugin once it's finished. The primary function of this script is to call the setuptools library's `setup()` function to create a Python distribution package. We can pass a number of keyword arguments to inform the package creation as well as to provide metadata about the plugin. An example `setup.py` is below:
```python
from setuptools import find_packages, setup
@ -129,7 +129,7 @@ python3 -m venv /path/to/my/venv
You can make NetBox available within this environment by creating a path file pointing to its location. This will add NetBox to the Python path upon activation. (Be sure to adjust the command below to specify your actual virtual environment path, Python version, and NetBox installation.)
```shell
cd $VENV/lib/python3.7/site-packages/
cd $VENV/lib/python3.8/site-packages/
echo /opt/netbox/netbox > netbox.pth
```

View File

@ -0,0 +1,10 @@
# NetBox v3.2
## v3.2.0 (FUTURE)
!!! warning "Python 3.8 or Later Required"
NetBox v3.2 requires Python 3.8 or later.
### Other Changes
* [#7731](https://github.com/netbox-community/netbox/issues/7731) - Require Python 3.8 or later

View File

@ -19,7 +19,7 @@ from netbox.config import PARAMS
# Environment setup
#
VERSION = '3.1.1-dev'
VERSION = '3.2.0-dev'
# Hostname
HOSTNAME = platform.node()
@ -28,13 +28,9 @@ HOSTNAME = platform.node()
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Validate Python version
if sys.version_info < (3, 7):
raise RuntimeError(
f"NetBox requires Python 3.7 or later. (Currently installed: Python {platform.python_version()})"
)
if sys.version_info < (3, 8):
warnings.warn(
f"NetBox v3.2 will require Python 3.8 or later. (Currently installed: Python {platform.python_version()})"
raise RuntimeError(
f"NetBox requires Python 3.8 or later. (Currently installed: Python {platform.python_version()})"
)