mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
Add uvloop as Posix+CPython dependency and tweak new Make recipes (#2819)
- uvloop is now a dependency on non-Windows CPython systems - `make setupenv` renamed to `make newenv` - `make syncenv` added to sync local venv to current dependencies - `dev-requirements.txt` moved into `tools` directory
This commit is contained in:
parent
7323e8eb67
commit
55e309125e
9
.github/CONTRIBUTING.md
vendored
9
.github/CONTRIBUTING.md
vendored
@ -62,7 +62,7 @@ If you're not on Windows, you should also have GNU make installed, and you can o
|
|||||||
1. Fork and clone the repository to a directory on your local machine.
|
1. Fork and clone the repository to a directory on your local machine.
|
||||||
2. Open a command line in that directory and execute the following command:
|
2. Open a command line in that directory and execute the following command:
|
||||||
```bash
|
```bash
|
||||||
make setupenv
|
make newenv
|
||||||
```
|
```
|
||||||
Red, its dependencies, and all required development tools, are now installed to a virtual environment located in the `.venv` subdirectory. Red is installed in editable mode, meaning that edits you make to the source code in the repository will be reflected when you run Red.
|
Red, its dependencies, and all required development tools, are now installed to a virtual environment located in the `.venv` subdirectory. Red is installed in editable mode, meaning that edits you make to the source code in the repository will be reflected when you run Red.
|
||||||
3. Activate the new virtual environment with one of the following commands:
|
3. Activate the new virtual environment with one of the following commands:
|
||||||
@ -76,7 +76,7 @@ If you're not on Windows, you should also have GNU make installed, and you can o
|
|||||||
```
|
```
|
||||||
Each time you open a new command line, you should execute this command first. From here onwards, we will assume you are executing commands from within this activated virtual environment.
|
Each time you open a new command line, you should execute this command first. From here onwards, we will assume you are executing commands from within this activated virtual environment.
|
||||||
|
|
||||||
**Note:** If you're comfortable with setting up virtual environments yourself and would rather do it manually, just run `pip install -r dev-requirements.txt` after setting it up.
|
**Note:** If you're comfortable with setting up virtual environments yourself and would rather do it manually, just run `pip install -Ur tools/dev-requirements.txt` after setting it up.
|
||||||
|
|
||||||
### 4.2 Testing
|
### 4.2 Testing
|
||||||
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.
|
||||||
@ -101,10 +101,11 @@ Use the command `black --help` to see how to use this tool. The full style guide
|
|||||||
You may have noticed we have a `Makefile` and a `make.bat` in the top-level directory. For now, you can do three things with them:
|
You may have noticed we have a `Makefile` and a `make.bat` in the top-level directory. For now, you can do three things with them:
|
||||||
1. `make reformat`: Reformat all python files in the project with Black
|
1. `make reformat`: Reformat all python files in the project with Black
|
||||||
2. `make stylecheck`: Check if any `.py` files in the project need reformatting
|
2. `make stylecheck`: Check if any `.py` files in the project need reformatting
|
||||||
3. `make setupenv`: Set up a new virtual environment in the `.venv` subdirectory, and install Red and its dependencies. If one already exists, it is cleared out and replaced.
|
3. `make newenv`: Set up a new virtual environment in the `.venv` subdirectory, and install Red and its dependencies. If one already exists, it is cleared out and replaced.
|
||||||
|
4. `make syncenv`: Sync your environment with Red's latest dependencies.
|
||||||
|
|
||||||
### 4.5 Keeping your dependencies up to date
|
### 4.5 Keeping your dependencies up to date
|
||||||
Whenever you pull from upstream (V3/develop on the main repository) and you notice either of the files `setup.cfg` or `dev-requirements.txt` have been changed, it can often mean some package dependencies have been updated, added or removed. To make sure you're testing and formatting with the most up-to-date versions of our dependencies, run `make setupenv` to recreate your virtual environment. You could also simply do `pip install -Ur dev-requirements.txt`, but you will still have any dependencies which may have been removed previously.
|
Whenever you pull from upstream (V3/develop on the main repository) and you notice either of the files `setup.cfg` or `tools/dev-requirements.txt` have been changed, it can often mean some package dependencies have been updated, added or removed. To make sure you're testing and formatting with the most up-to-date versions of our dependencies, run `make syncenv`. You could also simply do `make newenv` to install them to a clean new virtual environment.
|
||||||
|
|
||||||
### 4.6 To contribute changes
|
### 4.6 To contribute changes
|
||||||
|
|
||||||
|
|||||||
6
Makefile
6
Makefile
@ -18,7 +18,9 @@ bumpdeps:
|
|||||||
python tools/bumpdeps.py
|
python tools/bumpdeps.py
|
||||||
|
|
||||||
# Development environment
|
# Development environment
|
||||||
setupenv:
|
newenv:
|
||||||
python3.7 -m venv --clear .venv
|
python3.7 -m venv --clear .venv
|
||||||
.venv/bin/pip install -U pip setuptools
|
.venv/bin/pip install -U pip setuptools
|
||||||
.venv/bin/pip install -Ur dev-requirements.txt
|
$(MAKE) syncenv
|
||||||
|
syncenv:
|
||||||
|
.venv/bin/pip install -Ur ./tools/dev-requirements.txt
|
||||||
|
|||||||
11
make.bat
11
make.bat
@ -21,10 +21,13 @@ exit /B %ERRORLEVEL%
|
|||||||
black -l 99 --check !PYFILES!
|
black -l 99 --check !PYFILES!
|
||||||
exit /B %ERRORLEVEL%
|
exit /B %ERRORLEVEL%
|
||||||
|
|
||||||
:setupenv
|
:newenv
|
||||||
py -3.7 -m venv --clear .venv
|
py -3.7 -m venv --clear .venv
|
||||||
.\.venv\Scripts\python -m pip install -U pip setuptools
|
.\.venv\Scripts\python -m pip install -U pip setuptools
|
||||||
.\.venv\Scripts\python -m pip install -Ur dev-requirements.txt
|
goto syncenv
|
||||||
|
|
||||||
|
:syncenv
|
||||||
|
.\.venv\Scripts\python -m pip install -Ur .\tools\dev-requirements.txt
|
||||||
exit /B %ERRORLEVEL%
|
exit /B %ERRORLEVEL%
|
||||||
|
|
||||||
:help
|
:help
|
||||||
@ -34,4 +37,6 @@ echo.
|
|||||||
echo Commands:
|
echo Commands:
|
||||||
echo reformat Reformat all .py files being tracked by git.
|
echo reformat Reformat all .py files being tracked by git.
|
||||||
echo stylecheck Check which tracked .py files need reformatting.
|
echo stylecheck Check which tracked .py files need reformatting.
|
||||||
echo setupenv Create or replace a virtual environment for development.
|
echo newenv Create or replace this project's virtual environment.
|
||||||
|
echo syncenv Sync this project's virtual environment to Red's latest
|
||||||
|
echo dependencies.
|
||||||
|
|||||||
@ -45,6 +45,7 @@ install_requires =
|
|||||||
Red-Lavalink==0.3.0
|
Red-Lavalink==0.3.0
|
||||||
schema==0.7.0
|
schema==0.7.0
|
||||||
tqdm==4.32.2
|
tqdm==4.32.2
|
||||||
|
uvloop==0.12.2; sys_platform != "win32" and platform_python_implementation == "CPython"
|
||||||
websockets==6.0
|
websockets==6.0
|
||||||
yarl==1.3.0
|
yarl==1.3.0
|
||||||
|
|
||||||
@ -63,7 +64,7 @@ docs =
|
|||||||
pytz==2019.1
|
pytz==2019.1
|
||||||
requests==2.22.0
|
requests==2.22.0
|
||||||
six==1.12.0
|
six==1.12.0
|
||||||
snowballstemmer==1.2.1
|
snowballstemmer==1.9.0
|
||||||
Sphinx==2.1.2
|
Sphinx==2.1.2
|
||||||
sphinx-rtd-theme==0.4.3
|
sphinx-rtd-theme==0.4.3
|
||||||
sphinxcontrib-applehelp==1.0.1
|
sphinxcontrib-applehelp==1.0.1
|
||||||
@ -88,13 +89,13 @@ test =
|
|||||||
isort==4.3.21
|
isort==4.3.21
|
||||||
lazy-object-proxy==1.4.1
|
lazy-object-proxy==1.4.1
|
||||||
mccabe==0.6.1
|
mccabe==0.6.1
|
||||||
more-itertools==7.0.0
|
more-itertools==7.1.0
|
||||||
packaging==19.0
|
packaging==19.0
|
||||||
pluggy==0.12.0
|
pluggy==0.12.0
|
||||||
py==1.8.0
|
py==1.8.0
|
||||||
pylint==2.3.1
|
pylint==2.3.1
|
||||||
pyparsing==2.4.0
|
pyparsing==2.4.0
|
||||||
pytest==4.6.3
|
pytest==5.0.0
|
||||||
pytest-asyncio==0.10.0
|
pytest-asyncio==0.10.0
|
||||||
six==1.12.0
|
six==1.12.0
|
||||||
typed-ast==1.4.0
|
typed-ast==1.4.0
|
||||||
|
|||||||
@ -19,6 +19,7 @@ install_requires =
|
|||||||
Red-Lavalink
|
Red-Lavalink
|
||||||
schema
|
schema
|
||||||
tqdm
|
tqdm
|
||||||
|
uvloop; sys_platform != "win32" and platform_python_implementation == "CPython"
|
||||||
# Websockets is a secondary dependency, but until pip has a complete dependency resolver, we
|
# Websockets is a secondary dependency, but until pip has a complete dependency resolver, we
|
||||||
# need to list it here to avoid an incompatible version being installed.
|
# need to list it here to avoid an incompatible version being installed.
|
||||||
# See under point 2 here: https://pip.pypa.io/en/stable/user_guide/#requirements-files
|
# See under point 2 here: https://pip.pypa.io/en/stable/user_guide/#requirements-files
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user