Skip to content

Commit

Permalink
Make some dependency changes, support Python 3.10 and 3.11 (#5611)
Browse files Browse the repository at this point in the history
Co-authored-by: jack1142 <[email protected]>
  • Loading branch information
Jackenmen and Jackenmen authored Dec 30, 2022
1 parent d3308af commit 519aced
Show file tree
Hide file tree
Showing 59 changed files with 322 additions and 371 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ jobs:
python_version: "3.9"
friendly_name: Python 3.9 - Tests
- tox_env: py310
python_version: "3.10-dev"
friendly_name: Python 3.10-dev - Tests
python_version: "3.10"
friendly_name: Python 3.10 - Tests
- tox_env: py311
python_version: "3.11"
friendly_name: Python 3.11 - Tests
- tox_env: style
friendly_name: Style
- tox_env: docs
Expand All @@ -46,7 +49,7 @@ jobs:
- name: Install tox
run: |
python -m pip install --upgrade pip
pip install 'tox<4'
pip install tox
- name: Tox test
env:
TOXENV: ${{ matrix.tox_env }}
Expand All @@ -59,7 +62,8 @@ jobs:
python_version:
- "3.8"
- "3.9"
- "3.10-dev"
- "3.10"
- "3.11"
fail-fast: false
name: Tox - Postgres
services:
Expand All @@ -82,7 +86,7 @@ jobs:
- name: Install tox
run: |
python -m pip install --upgrade pip
pip install 'tox<4'
pip install tox
- name: Tox test
env:
TOXENV: postgres
Expand Down
2 changes: 1 addition & 1 deletion docs/cog_guides/customcommands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ customcom search

Searches through custom commands, according to the query.

Uses fuzzywuzzy searching to find close matches.
Uses fuzzy searching to find close matches.

**Arguments:**

Expand Down
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = "en"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down Expand Up @@ -246,8 +246,8 @@
# :dpy_docs:`link text <site_name.html>`
extlinks = {
"dpy_docs": (f"{dpy_docs_url}/%s", None),
"issue": ("https://github.com/Cog-Creators/Red-DiscordBot/issues/%s", "#"),
"ghuser": ("https://github.com/%s", "@"),
"issue": ("https://github.com/Cog-Creators/Red-DiscordBot/issues/%s", "#%s"),
"ghuser": ("https://github.com/%s", "@%s"),
}

# Doctest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,3 @@ to keep it in a location which is easy to type out the path to. From now, we'll
``redenv`` and it will be located in your home directory.

Create your virtual environment with the following command:

.. prompt:: bash

python3.9 -m venv ~/redenv

And activate it with the following command:

.. prompt:: bash

source ~/redenv/bin/activate

.. important::

You must activate the virtual environment with the above command every time you open a new
shell to run, install or update Red.
10 changes: 10 additions & 0 deletions docs/install_guides/_includes/_create-env-with-venv-outro.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
And activate it with the following command:

.. prompt:: bash

source ~/redenv/bin/activate

.. important::

You must activate the virtual environment with the above command every time you open a new
shell to run, install or update Red.
7 changes: 7 additions & 0 deletions docs/install_guides/_includes/create-env-with-venv3.10.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.. include:: _includes/_create-env-with-venv-intro.rst

.. prompt:: bash

python3.10 -m venv ~/redenv

.. include:: _includes/_create-env-with-venv-outro.rst
7 changes: 7 additions & 0 deletions docs/install_guides/_includes/create-env-with-venv3.11.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.. include:: _includes/_create-env-with-venv-intro.rst

.. prompt:: bash

python3.11 -m venv ~/redenv

.. include:: _includes/_create-env-with-venv-outro.rst
7 changes: 7 additions & 0 deletions docs/install_guides/_includes/create-env-with-venv3.9.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.. include:: _includes/_create-env-with-venv-intro.rst

.. prompt:: bash

python3.9 -m venv ~/redenv

.. include:: _includes/_create-env-with-venv-outro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Install them with dnf:

sudo dnf -y update
sudo dnf -y group install development
sudo dnf -y install python39 python39-pip python39-devel java-11-openjdk-headless nano git
sudo dnf -y install python39 python39-devel java-11-openjdk-headless nano git

Set ``java`` executable to point to Java 11:

Expand All @@ -23,6 +23,6 @@ Set ``java`` executable to point to Java 11:

.. Include common instructions:
.. include:: _includes/create-env-with-venv.rst
.. include:: _includes/create-env-with-venv3.9.rst

.. include:: _includes/install-and-setup-red-unix.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ Install them with dnf:

.. prompt:: bash

sudo dnf -y install python39 git java-11-openjdk-headless @development nano
sudo dnf -y install python39 python3-devel git java-11-openjdk-headless @development nano

.. Include common instructions:
.. include:: _includes/create-env-with-venv.rst
.. include:: _includes/create-env-with-venv3.9.rst

.. include:: _includes/install-and-setup-red-unix.rst
8 changes: 4 additions & 4 deletions docs/install_guides/_includes/install-python-pyenv.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
Installing Python with pyenv
----------------------------

On distributions where Python 3.9 needs to be compiled from source, we recommend the use of pyenv.
On distributions where Python 3.11 needs to be compiled from source, we recommend the use of pyenv.
This simplifies the compilation process and has the added bonus of simplifying setting up Red in a
virtual environment.

.. include:: _includes/_install-pyenv-and-setup-path.rst

.. prompt:: bash

CONFIGURE_OPTS=--enable-optimizations pyenv install 3.9.9 -v
CONFIGURE_OPTS=--enable-optimizations pyenv install 3.11.1 -v

This may take a long time to complete, depending on your hardware. For some machines (such as
Raspberry Pis and micro-tier VPSes), it may take over an hour; in this case, you may wish to remove
Expand All @@ -22,6 +22,6 @@ After that is finished, run:

.. prompt:: bash

pyenv global 3.9.9
pyenv global 3.11.1

Pyenv is now installed and your system should be configured to run Python 3.9.
Pyenv is now installed and your system should be configured to run Python 3.11.
27 changes: 27 additions & 0 deletions docs/install_guides/_includes/install-python310-pyenv.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
----------------------------
Installing Python with pyenv
----------------------------

On distributions where Python 3.10 needs to be compiled from source, we recommend the use of pyenv.
This simplifies the compilation process and has the added bonus of simplifying setting up Red in a
virtual environment.

.. include:: _includes/_install-pyenv-and-setup-path.rst

.. prompt:: bash

CONFIGURE_OPTS=--enable-optimizations pyenv install 3.10.9 -v

This may take a long time to complete, depending on your hardware. For some machines (such as
Raspberry Pis and micro-tier VPSes), it may take over an hour; in this case, you may wish to remove
the ``CONFIGURE_OPTS=--enable-optimizations`` part from the front of the command, which will
drastically reduce the install time. However, be aware that this will make Python run about 10%
slower.

After that is finished, run:

.. prompt:: bash

pyenv global 3.10.9

Pyenv is now installed and your system should be configured to run Python 3.10.
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
Installing Python with pyenv
----------------------------

On distributions where Python 3.8 needs to be compiled from source, we recommend the use of pyenv.
On distributions where Python 3.9 needs to be compiled from source, we recommend the use of pyenv.
This simplifies the compilation process and has the added bonus of simplifying setting up Red in a
virtual environment.

.. include:: _includes/_install-pyenv-and-setup-path.rst

.. prompt:: bash

CONFIGURE_OPTS=--enable-optimizations pyenv install 3.8.12 -v
CONFIGURE_OPTS=--enable-optimizations pyenv install 3.9.16 -v

This may take a long time to complete, depending on your hardware. For some machines (such as
Raspberry Pis and micro-tier VPSes), it may take over an hour; in this case, you may wish to remove
Expand All @@ -22,6 +22,6 @@ After that is finished, run:

.. prompt:: bash

pyenv global 3.8.12
pyenv global 3.9.16

Pyenv is now installed and your system should be configured to run Python 3.8.
Pyenv is now installed and your system should be configured to run Python 3.9.
16 changes: 14 additions & 2 deletions docs/install_guides/arch.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,22 @@ Install the pre-requirements with pacman:

.. prompt:: bash

sudo pacman -Syu python python-pip git jre11-openjdk-headless base-devel nano
sudo pacman -Syu git jre11-openjdk-headless base-devel nano

On Arch Linux, Python 3.9 can be installed from the Arch User Repository (AUR) from the ``python39`` package.

The manual build process is the Arch-supported install method for AUR packages. You can install ``python39`` package with the following commands:

.. prompt:: bash

git clone https://aur.archlinux.org/python39.git /tmp/python39
cd /tmp/python39
makepkg -sicL
cd -
rm -rf /tmp/python39

.. Include common instructions:
.. include:: _includes/create-env-with-venv.rst
.. include:: _includes/create-env-with-venv3.9.rst

.. include:: _includes/install-and-setup-red-unix.rst
4 changes: 3 additions & 1 deletion docs/install_guides/centos-7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ In order to install Git 2.11 or greater, we recommend adding the IUS repository:

.. Include common instructions:
.. include:: _includes/install-python-pyenv.rst
.. Python 3.10 requires OpenSSL 1.1.1 which CentOS 7 doesn't provide in base repository.
.. include:: _includes/install-python39-pyenv.rst

.. include:: _includes/create-env-with-pyenv-virtualenv.rst

Expand Down
2 changes: 1 addition & 1 deletion docs/install_guides/debian-10.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Debian Buster. This guide will tell you how. First, run the following commands:
.. prompt:: bash

sudo apt update
sudo apt -y install make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev libgdbm-dev uuid-dev python3-openssl git openjdk-11-jre-headless nano
sudo apt -y install make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev libgdbm-dev uuid-dev python3-openssl git openjdk-11-jre-headless nano
CXX=/usr/bin/g++

.. Include common instructions:
Expand Down
4 changes: 2 additions & 2 deletions docs/install_guides/debian-11.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ with apt:
.. prompt:: bash

sudo apt update
sudo apt -y install python3 python3-dev python3-venv python3-pip git openjdk-11-jre-headless build-essential nano
sudo apt -y install python3 python3-dev python3-venv git openjdk-11-jre-headless build-essential nano

.. Include common instructions:
.. include:: _includes/create-env-with-venv.rst
.. include:: _includes/create-env-with-venv3.9.rst

.. include:: _includes/install-and-setup-red-unix.rst
4 changes: 2 additions & 2 deletions docs/install_guides/fedora.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ them with dnf:

.. prompt:: bash

sudo dnf -y install python39 git java-11-openjdk-headless @development-tools nano
sudo dnf -y install python3.10 python3.10-devel git java-11-openjdk-headless @development-tools nano

.. Include common instructions:
.. include:: _includes/create-env-with-venv.rst
.. include:: _includes/create-env-with-venv3.10.rst

.. include:: _includes/install-and-setup-red-unix.rst
6 changes: 3 additions & 3 deletions docs/install_guides/mac.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ one-by-one:

.. prompt:: bash

brew install python@3.9
brew install python@3.11
brew install git
brew tap homebrew/cask-versions
brew install --cask temurin11
Expand All @@ -34,11 +34,11 @@ To fix this, you should run these commands:
.. prompt:: bash

profile=$([ -n "$ZSH_VERSION" ] && echo ~/.zprofile || ([ -f ~/.bash_profile ] && echo ~/.bash_profile || echo ~/.profile))
echo 'export PATH="$(brew --prefix)/opt/python@3.9/bin:$PATH"' >> "$profile"
echo 'export PATH="$(brew --prefix)/opt/python@3.11/bin:$PATH"' >> "$profile"
source "$profile"

.. Include common instructions:
.. include:: _includes/create-env-with-venv.rst
.. include:: _includes/create-env-with-venv3.11.rst

.. include:: _includes/install-and-setup-red-unix.rst
8 changes: 4 additions & 4 deletions docs/install_guides/opensuse-leap-15.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _install-opensuse-leap-15:

=====================================
Installing Red on openSUSE Leap 15.3+
Installing Red on openSUSE Leap 15.4+
=====================================

.. include:: _includes/supported-arch-x64+aarch64.rst
Expand All @@ -12,16 +12,16 @@ Installing Red on openSUSE Leap 15.3+
Installing the pre-requirements
-------------------------------

openSUSE Leap 15.3+ has all required dependencies available in official repositories. Install them
openSUSE Leap 15.4+ has all required dependencies available in official repositories. Install them
with zypper:

.. prompt:: bash

sudo zypper -n install python39-base python39-pip git-core java-11-openjdk-headless nano
sudo zypper -n install python310 python310-devel git-core java-11-openjdk-headless nano
sudo zypper -n install -t pattern devel_basis

.. Include common instructions:
.. include:: _includes/create-env-with-venv.rst
.. include:: _includes/create-env-with-venv3.10.rst

.. include:: _includes/install-and-setup-red-unix.rst
4 changes: 2 additions & 2 deletions docs/install_guides/opensuse-tumbleweed.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ with zypper:

.. prompt:: bash

sudo zypper -n install python39-base python39-pip git-core java-11-openjdk-headless nano
sudo zypper -n install python311 python311-devel git-core java-11-openjdk-headless nano
sudo zypper -n install -t pattern devel_basis

.. Include common instructions:
.. include:: _includes/create-env-with-venv.rst
.. include:: _includes/create-env-with-venv3.11.rst

.. include:: _includes/install-and-setup-red-unix.rst
9 changes: 7 additions & 2 deletions docs/install_guides/raspberry-pi-os-10.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,20 @@ Installing the pre-requirements
We recommend installing pyenv as a method of installing non-native versions of Python on
Raspberry Pi OS. This guide will tell you how. First, run the following commands:

.. cmake is necessary to be able to successfuly build rapidfuzz.
.. prompt:: bash

sudo apt update
sudo apt -y install make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev libgdbm-dev uuid-dev python3-openssl git openjdk-11-jre-headless nano
sudo apt -y install cmake make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev libgdbm-dev uuid-dev python3-openssl git openjdk-11-jre-headless nano
CXX=/usr/bin/g++

.. Include common instructions:
.. include:: _includes/install-python38-pyenv.rst
.. We should only build and install even versions of Python on Raspberry Pi OS as odd
.. versions are part of piwheels and can cause installs of pip packages that won't work.
.. include:: _includes/install-python310-pyenv.rst

.. include:: _includes/create-env-with-pyenv-virtualenv.rst

Expand Down
Loading

0 comments on commit 519aced

Please sign in to comment.