Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add uvloop as Posix+CPython dependency and tweak new Make recipes #2819

Merged
merged 2 commits into from
Jul 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2. Open a command line in that directory and execute the following command:
```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.
3. Activate the new virtual environment with one of the following commands:
Expand All @@ -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.

**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
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.
Expand All @@ -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:
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
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
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

Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ bumpdeps:
python tools/bumpdeps.py

# Development environment
setupenv:
newenv:
python3.7 -m venv --clear .venv
.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 changes: 8 additions & 3 deletions make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ exit /B %ERRORLEVEL%
black -l 99 --check !PYFILES!
exit /B %ERRORLEVEL%

:setupenv
:newenv
py -3.7 -m venv --clear .venv
.\.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%

:help
Expand All @@ -34,4 +37,6 @@ echo.
echo Commands:
echo reformat Reformat all .py files being tracked by git.
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.
7 changes: 4 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ install_requires =
Red-Lavalink==0.3.0
schema==0.7.0
tqdm==4.32.2
uvloop==0.12.2; sys_platform != "win32" and platform_python_implementation == "CPython"
websockets==6.0
yarl==1.3.0

Expand All @@ -63,7 +64,7 @@ docs =
pytz==2019.1
requests==2.22.0
six==1.12.0
snowballstemmer==1.2.1
snowballstemmer==1.9.0
Sphinx==2.1.2
sphinx-rtd-theme==0.4.3
sphinxcontrib-applehelp==1.0.1
Expand All @@ -88,13 +89,13 @@ test =
isort==4.3.21
lazy-object-proxy==1.4.1
mccabe==0.6.1
more-itertools==7.0.0
more-itertools==7.1.0
packaging==19.0
pluggy==0.12.0
py==1.8.0
pylint==2.3.1
pyparsing==2.4.0
pytest==4.6.3
pytest==5.0.0
pytest-asyncio==0.10.0
six==1.12.0
typed-ast==1.4.0
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions tools/primary_deps.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ install_requires =
Red-Lavalink
schema
tqdm
uvloop; sys_platform != "win32" and platform_python_implementation == "CPython"
# 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.
# See under point 2 here: https://pip.pypa.io/en/stable/user_guide/#requirements-files
Expand Down