Bump minimum python version to 3.7.0 (#2394)

This is in anticipation of #2246, although I've written that PR to not break on 3.6, the feature itself is not usable on 3.6. So I think the best way forward is to simply require python 3.7. This also allows devs and cog creators to utilise all of the new features in 3.7, and it also updates the docs so all operating systems will have 3.7 installed.

Signed-off-by: Toby <tobyharradine@gmail.com>
This commit is contained in:
Toby Harradine 2019-01-30 14:07:53 +11:00 committed by GitHub
parent c7d98f88e8
commit 016a6d3aa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 99 additions and 82 deletions

View File

@ -31,7 +31,7 @@ We love receiving contributions from our community. Any assistance you can provi
# 2. Ground Rules # 2. Ground Rules
We've made a point to use [ZenHub](https://www.zenhub.com/) (a plugin for GitHub) as our main source of collaboration and coordination. Your experience contributing to Red will be greatly improved if you go get that plugin. We've made a point to use [ZenHub](https://www.zenhub.com/) (a plugin for GitHub) as our main source of collaboration and coordination. Your experience contributing to Red will be greatly improved if you go get that plugin.
1. Ensure cross compatibility for Windows, Mac OS and Linux. 1. Ensure cross compatibility for Windows, Mac OS and Linux.
2. Ensure all Python features used in contributions exist and work in Python 3.6 and above. 2. Ensure all Python features used in contributions exist and work in Python 3.7 and above.
3. Create new tests for code you add or bugs you fix. It helps us help you by making sure we don't accidentally break anything :grinning: 3. Create new tests for code you add or bugs you fix. It helps us help you by making sure we don't accidentally break anything :grinning:
4. Create any issues for new features you'd like to implement and explain why this feature is useful to everyone and not just you personally. 4. Create any issues for new features you'd like to implement and explain why this feature is useful to everyone and not just you personally.
5. Don't add new cogs unless specifically given approval in an issue discussing said cog idea. 5. Don't add new cogs unless specifically given approval in an issue discussing said cog idea.
@ -53,7 +53,7 @@ Red's repository is configured to follow a particular development workflow, usin
### 4.1 Setting up your development environment ### 4.1 Setting up your development environment
The following requirements must be installed prior to setting up: The following requirements must be installed prior to setting up:
- Python 3.6.2 or greater (3.6.6 or greater on Windows) - Python 3.7.0 or greater
- git - git
- pip - pip
- pipenv - pipenv
@ -79,7 +79,7 @@ Note: If you haven't used `pipenv` before but are comfortable with virtualenvs,
We've recently started using [tox](https://github.com/tox-dev/tox) to run all of our tests. It's extremely simple to use, and if you followed the previous section correctly, it is already installed to your virtual environment. We've recently started using [tox](https://github.com/tox-dev/tox) to run all of our tests. It's extremely simple to use, and if you followed the previous section correctly, it is already installed to your virtual environment.
Currently, tox does the following, creating its own virtual environments for each stage: Currently, tox does the following, creating its own virtual environments for each stage:
- Runs all of our unit tests with [pytest](https://github.com/pytest-dev/pytest) on python 3.6 and 3.7 (test environments `py36` and `py37`) - Runs all of our unit tests with [pytest](https://github.com/pytest-dev/pytest) on python 3.7 (test environment `py37`)
- Ensures documentation builds without warnings, and all hyperlinks have a valid destination (test environment `docs`) - Ensures documentation builds without warnings, and all hyperlinks have a valid destination (test environment `docs`)
- Ensures that the code meets our style guide with [black](https://github.com/ambv/black) (test environment `style`) - Ensures that the code meets our style guide with [black](https://github.com/ambv/black) (test environment `style`)

View File

@ -5,7 +5,7 @@ build:
image: latest image: latest
python: python:
version: 3.6 version: 3.7
pip_install: true pip_install: true
extra_requirements: extra_requirements:
- docs - docs

View File

@ -3,16 +3,16 @@ language: python
cache: pip cache: pip
notifications: notifications:
email: false email: false
sudo: true
python: python:
- 3.6.6 - 3.7.2
- 3.7
env: env:
global: global:
PIPENV_IGNORE_VIRTUALENVS=1 - PIPENV_IGNORE_VIRTUALENVS=1
matrix: matrix:
TOXENV=py - TOXENV=py
- TOXENV=docs
- TOXENV=style
install: install:
- pip install --upgrade pip tox - pip install --upgrade pip tox
@ -22,16 +22,10 @@ script:
jobs: jobs:
include: include:
- python: 3.6.6
env: TOXENV=docs
- python: 3.6.6
env: TOXENV=style
# These jobs only occur on tag creation if the prior ones succeed # These jobs only occur on tag creation if the prior ones succeed
- stage: PyPi Deployment - stage: PyPi Deployment
if: tag IS present if: tag IS present
python: 3.6.6 python: 3.7.2
env: env:
- DEPLOYING=true - DEPLOYING=true
- TOXENV=py36 - TOXENV=py36
@ -43,11 +37,10 @@ jobs:
skip_cleanup: true skip_cleanup: true
on: on:
repo: Cog-Creators/Red-DiscordBot repo: Cog-Creators/Red-DiscordBot
python: 3.6.6
tags: true tags: true
- stage: Crowdin Deployment - stage: Crowdin Deployment
if: tag IS present if: tag IS present
python: 3.6.6 python: 3.7.2
env: env:
- DEPLOYING=true - DEPLOYING=true
- TOXENV=py36 - TOXENV=py36
@ -63,5 +56,4 @@ jobs:
skip_cleanup: true skip_cleanup: true
on: on:
repo: Cog-Creators/Red-DiscordBot repo: Cog-Creators/Red-DiscordBot
python: 3.6.6
tags: true tags: true

View File

@ -16,7 +16,7 @@
<img src="https://img.shields.io/badge/Support-Red!-yellow.svg" alt="Support Red on Patreon!"> <img src="https://img.shields.io/badge/Support-Red!-yellow.svg" alt="Support Red on Patreon!">
</a> </a>
<a href="https://www.python.org/downloads/"> <a href="https://www.python.org/downloads/">
<img src="https://img.shields.io/badge/Made%20With-Python%203-blue.svg?style=for-the-badge" alt="Made with Python 3"> <img src="https://img.shields.io/badge/Made%20With-Python%203.7-blue.svg?style=for-the-badge" alt="Made with Python 3.7">
</a> </a>
<a href="https://crowdin.com/project/red-discordbot"> <a href="https://crowdin.com/project/red-discordbot">
<img src="https://d322cqt584bo4o.cloudfront.net/red-discordbot/localized.svg" alt="Localized with Crowdin"> <img src="https://d322cqt584bo4o.cloudfront.net/red-discordbot/localized.svg" alt="Localized with Crowdin">

View File

@ -202,7 +202,7 @@ linkcheck_ignore = [r"https://java.com*", r"https://chocolatey.org*"]
# Intersphinx # Intersphinx
intersphinx_mapping = { intersphinx_mapping = {
"python": ("https://docs.python.org/3.6", None), "python": ("https://docs.python.org/3", None),
"dpy": ("https://discordpy.readthedocs.io/en/rewrite/", None), "dpy": ("https://discordpy.readthedocs.io/en/rewrite/", None),
"motor": ("https://motor.readthedocs.io/en/stable/", None), "motor": ("https://motor.readthedocs.io/en/stable/", None),
} }

View File

@ -17,7 +17,7 @@ you in the process.
Getting started Getting started
--------------- ---------------
To start off, be sure that you have installed Python 3.6.2 or higher (3.6.6 or higher on Windows). To start off, be sure that you have installed Python 3.7.
Open a terminal or command prompt and type :code:`pip install -U git+https://github.com/Cog-Creators/Red-DiscordBot@V3/develop#egg=redbot[test]` Open a terminal or command prompt and type :code:`pip install -U git+https://github.com/Cog-Creators/Red-DiscordBot@V3/develop#egg=redbot[test]`
(note that if you get an error with this, try again but put :code:`python -m` in front of the command (note that if you get an error with this, try again but put :code:`python -m` in front of the command
This will install the latest version of V3. This will install the latest version of V3.

View File

@ -16,11 +16,13 @@ Installing the pre-requirements
Please install the pre-requirements using the commands listed for your operating system. Please install the pre-requirements using the commands listed for your operating system.
The pre-requirements are: The pre-requirements are:
- Python 3.6.2 or greater - Python 3.7.0 or greater
- pip 9.0 or greater - pip 9.0 or greater
- git - git
- Java Runtime Environment 8 or later (for audio support) - Java Runtime Environment 8 or later (for audio support)
.. _install-arch:
~~~~~~~~~~ ~~~~~~~~~~
Arch Linux Arch Linux
~~~~~~~~~~ ~~~~~~~~~~
@ -29,15 +31,25 @@ Arch Linux
sudo pacman -Syu python-pip git base-devel jre8-openjdk sudo pacman -Syu python-pip git base-devel jre8-openjdk
~~~~~~~~ .. _install-centos:
CentOS 7 .. _install-fedora:
~~~~~~~~ .. _install-rhel:
~~~~~~~~~~~~~~~~~~~~~~~~~~
CentOS 7, Fedora, and RHEL
~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: none .. code-block:: none
yum -y groupinstall development yum -y groupinstall development
yum -y install https://centos7.iuscommunity.org/ius-release.rpm yum -y install https://centos7.iuscommunity.org/ius-release.rpm
yum -y install yum-utils wget which python36u python36u-pip python36u-devel openssl-devel libffi-devel git2u java-1.8.0-openjdk sudo yum install zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel \
openssl-devel xz xz-devel libffi-devel git2u java-1.8.0-openjdk
Complete the rest of the installation by `installing Python 3.7 with pyenv <install-python-pyenv>`.
.. _install-debian:
.. _install-raspbian:
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Debian and Raspbian Stretch Debian and Raspbian Stretch
@ -53,27 +65,14 @@ Debian/Raspbian Stretch. This guide will tell you how. First, run the following
.. code-block:: none .. code-block:: none
sudo apt install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev git unzip default-jre sudo apt install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev python-openssl python3-openssl git unzip \
default-jre
After that last command, you may see a warning about 'pyenv' not being in the load path. Follow the Complete the rest of the installation by `installing Python 3.7 with pyenv <install-python-pyenv>`.
instructions given to fix that, then close and reopen your shell.
Then run the following command: .. _install-mac:
.. code-block:: none
CONFIGURE_OPTS=--enable-optimizations pyenv install 3.7.0 -v
This may take a long time to complete.
After that is finished, run:
.. code-block:: none
pyenv global 3.7.0
Pyenv is now installed and your system should be configured to run Python 3.7.
~~~ ~~~
Mac Mac
@ -91,24 +90,31 @@ one-by-one:
.. code-block:: none .. code-block:: none
brew install python3 --with-brewed-openssl brew install python --with-brewed-openssl
brew install git brew install git
brew tap caskroom/versions brew tap caskroom/versions
brew cask install java8 brew cask install java8
~~~~~~~~~~~~~~~~~~~~~~~~~~ .. _install-ubuntu:
Ubuntu 18.04 Bionic Beaver .. _install-ubuntu-bionic:
~~~~~~~~~~~~~~~~~~~~~~~~~~ .. _install-ubuntu-cosmic:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ubuntu 18.04 Bionic Beaver and 18.10 Cosmic Cuttlefish
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: none .. code-block:: none
sudo apt install python3.6-dev python3-pip build-essential libssl-dev libffi-dev git unzip default-jre -y sudo apt install python3.7 python3.7-dev python3.7-venv python3-pip build-essential \
libssl-dev libffi-dev git unzip default-jre -y
.. _install-ubuntu-xenial:
~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~
Ubuntu 16.04 Xenial Xerus Ubuntu 16.04 Xenial Xerus
~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~
We recommend adding the ``deadsnakes`` apt repository to install Python 3.6.2 or greater: We recommend adding the ``deadsnakes`` apt repository to install Python 3.7 or greater:
.. code-block:: none .. code-block:: none
@ -120,9 +126,43 @@ Now, install python, pip, git and java with the following commands:
.. code-block:: none .. code-block:: none
sudo apt install python3.6-dev build-essential libssl-dev libffi-dev git unzip default-jre wget -y sudo apt install python3.7 python3.7-dev build-essential libssl-dev libffi-dev git \
unzip default-jre wget -y
wget https://bootstrap.pypa.io/get-pip.py wget https://bootstrap.pypa.io/get-pip.py
sudo python3.6 get-pip.py sudo python3.7 get-pip.py
.. _install-python-pyenv:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Installing Python with pyenv
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
On distributions where Python 3.7 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.
.. code-block:: none
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
After this command, you may see a warning about 'pyenv' not being in the load path. Follow the
instructions given to fix that, then close and reopen your shell.
Then run the following command:
.. code-block:: none
CONFIGURE_OPTS=--enable-optimizations pyenv install 3.7.2 -v
This may take a long time to complete.
After that is finished, run:
.. code-block:: none
pyenv global 3.7.2
Pyenv is now installed and your system should be configured to run Python 3.7.
------------------------------ ------------------------------
Creating a Virtual Environment Creating a Virtual Environment
@ -142,25 +182,25 @@ Choose one of the following commands to install Red.
.. note:: .. note::
If you're not inside an activated virtual environment, include the ``--user`` flag with all If you're not inside an activated virtual environment, include the ``--user`` flag with all
``pip3`` commands. ``python3.7 -m pip`` commands.
To install without audio support: To install without audio support:
.. code-block:: none .. code-block:: none
pip3 install -U Red-DiscordBot python3.7 -m pip install -U Red-DiscordBot
Or, to install with audio support: Or, to install with audio support:
.. code-block:: none .. code-block:: none
pip3 install -U Red-DiscordBot[voice] python3.7 -m pip install -U Red-DiscordBot[voice]
Or, install with audio and MongoDB support: Or, install with audio and MongoDB support:
.. code-block:: none .. code-block:: none
pip3 install -U Red-DiscordBot[voice,mongo] python3.7 -m pip install -U Red-DiscordBot[voice,mongo]
.. note:: .. note::

View File

@ -34,7 +34,7 @@ Then run each of the following commands:
Manually installing dependencies Manually installing dependencies
******************************** ********************************
* `Python <https://www.python.org/downloads/>`_ - Red needs Python 3.6.6 or greater on Windows * `Python <https://www.python.org/downloads/>`_ - Red needs Python 3.7.0 or greater
.. note:: Please make sure that the box to add Python to PATH is CHECKED, otherwise .. note:: Please make sure that the box to add Python to PATH is CHECKED, otherwise
you may run into issues when trying to run Red you may run into issues when trying to run Red

View File

@ -68,7 +68,7 @@ Using ``pyenv virtualenv``
Using ``pyenv virtualenv`` saves you the headache of remembering where you installed your virtual Using ``pyenv virtualenv`` saves you the headache of remembering where you installed your virtual
environments. If you haven't already, install pyenv with `pyenv-installer`_. environments. If you haven't already, install pyenv with `pyenv-installer`_.
First, ensure your pyenv interpreter is set to python 3.6.2 or greater with the following command:: First, ensure your pyenv interpreter is set to python 3.7.0 or greater with the following command::
pyenv version pyenv version

View File

@ -3,12 +3,7 @@ import warnings
import discord import discord
import colorama import colorama
# Let's do all the dumb version checking in one place. MIN_PYTHON_VERSION = (3, 7, 0)
if sys.platform == "win32":
# Due to issues with ProactorEventLoop prior to 3.6.6 (bpo-26819)
MIN_PYTHON_VERSION = (3, 6, 6)
else:
MIN_PYTHON_VERSION = (3, 6, 2)
if sys.version_info < MIN_PYTHON_VERSION: if sys.version_info < MIN_PYTHON_VERSION:
print( print(

View File

@ -8,6 +8,7 @@ import asyncio
import aiohttp import aiohttp
import pkg_resources import pkg_resources
from redbot import MIN_PYTHON_VERSION
from redbot.setup import ( from redbot.setup import (
basic_setup, basic_setup,
load_existing_config, load_existing_config,
@ -28,12 +29,6 @@ INTRO = "==========================\nRed Discord Bot - Launcher\n===============
IS_WINDOWS = os.name == "nt" IS_WINDOWS = os.name == "nt"
IS_MAC = sys.platform == "darwin" IS_MAC = sys.platform == "darwin"
if IS_WINDOWS:
# Due to issues with ProactorEventLoop prior to 3.6.6 (bpo-26819)
MIN_PYTHON_VERSION = (3, 6, 6)
else:
MIN_PYTHON_VERSION = (3, 6, 2)
PYTHON_OK = sys.version_info >= MIN_PYTHON_VERSION PYTHON_OK = sys.version_info >= MIN_PYTHON_VERSION

View File

@ -64,10 +64,7 @@ extras_require = {
"style": ["black==18.9b0", "click==7.0", "toml==0.10.0"], "style": ["black==18.9b0", "click==7.0", "toml==0.10.0"],
} }
python_requires = ">=3.6.2,<3.8" python_requires = ">=3.7,<3.8"
if os.name == "nt":
# Due to issues with ProactorEventLoop prior to 3.6.6 (bpo-26819)
python_requires = ">=3.6.6,<3.8"
def check_compiler_available(): def check_compiler_available():
@ -116,7 +113,6 @@ if __name__ == "__main__":
"Intended Audience :: Developers", "Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Operating System :: OS Independent", "Operating System :: OS Independent",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.7",
"Topic :: Communications :: Chat", "Topic :: Communications :: Chat",
"Topic :: Documentation :: Sphinx", "Topic :: Documentation :: Sphinx",

View File

@ -5,7 +5,6 @@
[tox] [tox]
envlist = envlist =
py36
py37 py37
docs docs
style style
@ -24,7 +23,7 @@ commands =
description = Attempt to build docs with sphinx-build description = Attempt to build docs with sphinx-build
whitelist_externals = whitelist_externals =
sphinx-build sphinx-build
basepython = python3.6 basepython = python3.7
extras = docs, mongo extras = docs, mongo
commands = commands =
sphinx-build -d "{toxworkdir}/docs_doctree" docs "{toxworkdir}/docs_out/html" -W -bhtml sphinx-build -d "{toxworkdir}/docs_doctree" docs "{toxworkdir}/docs_out/html" -W -bhtml
@ -39,7 +38,7 @@ setenv =
# This is just for Windows # This is just for Windows
# Prioritise make.bat over any make.exe which might be on PATH # Prioritise make.bat over any make.exe which might be on PATH
PATHEXT=.BAT;.EXE PATHEXT=.BAT;.EXE
basepython = python3.6 basepython = python3.7
extras = style extras = style
commands = commands =
make stylecheck make stylecheck