-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit cc16e43
Showing
28 changed files
with
890 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"template": "https://github.com/hypothesis/cookiecutters", | ||
"directory": "pypackage", | ||
"dont_update": ["INSTALL.md"], | ||
"extra_context": { | ||
"name": "tox-faster", | ||
"package_name": "tox_faster", | ||
"slug": "tox-faster", | ||
"short_description": "A tox plugin that speeds up tox a little.", | ||
"python_versions": "3.10.4, 3.9.12, 3.8.13", | ||
"github_owner": "hypothesis", | ||
"copyright_holder": "Hypothesis", | ||
"public": "yes", | ||
"__entry_point": "tox-faster", | ||
"__github_url": "https://github.com/hypothesis/tox-faster", | ||
"__pypi_url": "https://pypi.org/project/tox-faster" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
|
||
Speedups | ||
-------- | ||
|
||
tox-faster implements these tox speedups: | ||
|
||
### Disables tox's dependency listing (the "env report") | ||
|
||
Every single time you run tox it runs `pip freeze` to print out a list of all | ||
the packages installed in the testenv being run: | ||
|
||
<pre><code>tox -e lint | ||
<b>lint installed: aiohttp==3.8.1,aioresponses==0.7.3,aiosignal==1.2.0, | ||
alembic==1.8.0,amqp==5.1.1,astroid==2.11.6,async-timeout==4.0.1,attrs==20.2.0, | ||
beautifulsoup4==4.9.3,behave==1.2.6,billiard==3.6.4.0,cachetools==4.2.2, | ||
celery==5.2.7,certifi==2020.6.20,cffi==1.15.0,charset-normalizer==2.0.1, | ||
click==8.1.3,click-didyoumean==0.3.0,click-plugins==1.1.1,click-repl==0.2.0, | ||
coverage==6.4.1,cryptography==36.0.2,dill==0.3.4,ecdsa==0.17.0, | ||
factory-boy==3.2.1,Faker==8.1.2,freezegun==1.2.1,frozenlist==1.2.0, | ||
google-auth==1.30.0,google-auth-oauthlib==0.4.4,greenlet==1.0.0, | ||
gunicorn==20.1.0,h-api==1.0.1,h-assets==1.0.4,h-matchers==1.2.14, | ||
h-pyramid-sentry==1.2.3,h-vialib==1.0.19,httpretty==1.1.4,hupper==1.10.2, | ||
idna==2.10,importlib-metadata==4.8.1,importlib-resources==5.8.0, | ||
iniconfig==1.1.1,isort==5.10.1,Jinja2==2.11.3,jsonschema==3.2.0,kombu==5.2.4, | ||
lazy-object-proxy==1.6.0,Mako==1.1.3,MarkupSafe==1.1.1,marshmallow==3.17.0, | ||
mccabe==0.6.1,multidict==5.2.0,newrelic==7.12.0.176,oauthlib==3.2.0, | ||
packaging==21.3,parse==1.19.0,parse-type==0.5.2,PasteDeploy==2.1.0,plaster==1.0, | ||
plaster-pastedeploy==0.7,platformdirs==2.2.0,pluggy==0.13.1, | ||
prompt-toolkit==3.0.29,psycopg2==2.9.3,py==1.10.0,pyasn1==0.4.8, | ||
pyasn1-modules==0.2.8,pycodestyle==2.8.0,pycparser==2.21,pycryptodomex==3.15.0, | ||
pydocstyle==6.1.1,PyJWT==2.4.0,pylint==2.14.4,pyparsing==3.0.6,pyramid==2.0, | ||
pyramid-exclog==1.1,pyramid-googleauth==1.0.2,pyramid-jinja2==2.10, | ||
pyramid-retry==2.1.1,pyramid-services==2.2,pyramid-tm==2.5,pyrsistent==0.17.3, | ||
pytest==7.1.2,python-dateutil==2.8.1,python-jose==3.3.0,pytz==2022.1, | ||
requests==2.28.1,requests-oauthlib==1.3.1,rsa==4.7.2,sentry-sdk==0.17.6, | ||
six==1.15.0,snowballstemmer==2.1.0,soupsieve==2.2.1,SQLAlchemy==1.4.39, | ||
text-unidecode==1.3,tomli==2.0.0,tomlkit==0.11.0,transaction==2.4.0, | ||
translationstring==1.4,typing_extensions==4.0.0,urllib3==1.26.5,venusian==3.0.0, | ||
vine==5.0.0,waitress==2.1.2,wcwidth==0.2.5,webargs==8.1.0,WebOb==1.8.6, | ||
WebTest==3.0.0,wired==0.2.2,wrapt==1.12.1,xmltodict==0.13.0,yarl==1.7.2, | ||
zipp==3.4.1,zope.deprecation==4.3.0,zope.interface==5.1.0,zope.sqlalchemy==1.6</b> | ||
lint run-test-pre: PYTHONHASHSEED='2115099637' | ||
lint run-test: commands[0] | pylint lms bin | ||
...</code></pre> | ||
|
||
You don't need to see that in your terminal every time you run tox and if your | ||
venv contains a lot of packages it's quite annoying because it prints | ||
screenfulls of text. Running `pip freeze` also introduces a noticeable delay in | ||
the startup time of every tox command: on my machine with my venv it adds about | ||
250ms. | ||
|
||
tox-faster removes this so your tox output will be shorter and your tox | ||
commands will start faster: | ||
|
||
```terminal | ||
$ tox -e lint | ||
lint run-test-pre: PYTHONHASHSEED='3084948731' | ||
lint run-test: commands[0] | pylint lms bin | ||
... | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
tox = | ||
tox-faster = tox_faster |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pluggy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "pip" | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" | ||
day: "sunday" | ||
time: "00:00" | ||
timezone: "Europe/London" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
name: CI | ||
on: | ||
push: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 1 * * *' | ||
jobs: | ||
Format: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('setup.cfg', 'tox.ini') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- run: python -m pip install tox | ||
- run: tox -e checkformatting | ||
Lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('setup.cfg', 'tox.ini') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- run: python -m pip install tox | ||
- run: tox -e lint | ||
Tests: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.10', '3.9', '3.8'] | ||
name: Unit tests with Python ${{ matrix.python-version }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('setup.cfg', 'tox.ini') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- run: python -m pip install tox | ||
- run: tox -e tests | ||
- name: Upload coverage file | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: coverage | ||
path: .coverage.* | ||
Coverage: | ||
needs: tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('setup.cfg', 'tox.ini') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Download coverage files | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: coverage | ||
- run: python -m pip install tox | ||
- run: tox -e coverage | ||
Functests: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.10', '3.9', '3.8'] | ||
name: Functional tests with Python ${{ matrix.python-version }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('setup.cfg', 'tox.ini') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- run: python -m pip install tox | ||
- run: tox -e functests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: PyPI | ||
on: | ||
release: | ||
types: [published] | ||
jobs: | ||
PyPI: | ||
uses: hypothesis/workflows/.github/workflows/pypi.yml@main | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
build | ||
coverage | ||
node_modules | ||
yarn-error.log | ||
.coverage* | ||
.tox | ||
*.egg-info | ||
*.pyc | ||
supervisord.log | ||
supervisord.pid | ||
.DS_Store | ||
.devdata.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
3.10.4 | ||
3.9.12 | ||
3.8.13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
# Setting up Your tox-faster Development Environment | ||
|
||
First you'll need to install: | ||
|
||
* [Git](https://git-scm.com/). | ||
On Ubuntu: `sudo apt install git`, on macOS: `brew install git`. | ||
* [GNU Make](https://www.gnu.org/software/make/). | ||
This is probably already installed, run `make --version` to check. | ||
* [pyenv](https://github.com/pyenv/pyenv). | ||
Follow the instructions in pyenv's README to install it. | ||
The **Homebrew** method works best on macOS. | ||
The **Basic GitHub Checkout** method works best on Ubuntu. | ||
You _don't_ need to set up pyenv's shell integration ("shims"), you can | ||
[use pyenv without shims](https://github.com/pyenv/pyenv#using-pyenv-without-shims). | ||
|
||
Then to set up your development environment: | ||
|
||
```terminal | ||
git clone https://github.com/hypothesis/tox-faster.git | ||
cd tox_faster | ||
make help | ||
``` | ||
|
||
Releasing a New Version of the Project | ||
-------------------------------------- | ||
|
||
1. First, to get PyPI publishing working you need to go to: | ||
<https://github.com/organizations/hypothesis/settings/secrets/actions/PYPI_TOKEN> | ||
and add tox-faster to the `PYPI_TOKEN` secret's selected | ||
repositories. | ||
|
||
2. Now that the tox-faster project has access to the `PYPI_TOKEN` secret | ||
you can release a new version by just [creating a new GitHub release](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository). | ||
Publishing a new GitHub release will automatically trigger | ||
[a GitHub Actions workflow](.github/workflows/pypi.yml) | ||
that will build the new version of your Python package and upload it to | ||
<https://pypi.org/project/tox-faster>. | ||
|
||
Changing the Project's Python Versions | ||
-------------------------------------- | ||
|
||
To change what versions of Python the project uses: | ||
|
||
1. Change the Python versions in the | ||
[cookiecutter.json](.cookiecutter/cookiecutter.json) file. For example: | ||
|
||
```json | ||
"python_versions": "3.10.4, 3.9.12", | ||
``` | ||
|
||
2. Re-run the cookiecutter template: | ||
|
||
```terminal | ||
make template | ||
``` | ||
|
||
3. Commit everything to git and send a pull request | ||
|
||
Changing the Project's Python Dependencies | ||
------------------------------------------ | ||
|
||
To change the production dependencies in the `setup.cfg` file: | ||
|
||
1. Change the dependencies in the [`.cookiecutter/includes/setuptools/install_requires`](.cookiecutter/includes/setuptools/install_requires) file. | ||
If this file doesn't exist yet create it and add some dependencies to it. | ||
For example: | ||
|
||
``` | ||
pyramid | ||
sqlalchemy | ||
celery | ||
``` | ||
|
||
2. Re-run the cookiecutter template: | ||
|
||
```terminal | ||
make template | ||
``` | ||
|
||
3. Commit everything to git and send a pull request | ||
|
||
To change the project's formatting, linting and test dependencies: | ||
|
||
1. Change the dependencies in the [`.cookiecutter/includes/tox/deps`](.cookiecutter/includes/tox/deps) file. | ||
If this file doesn't exist yet create it and add some dependencies to it. | ||
Use tox's [factor-conditional settings](https://tox.wiki/en/latest/config.html#factors-and-factor-conditional-settings) | ||
to limit which environment(s) each dependency is used in. | ||
For example: | ||
|
||
``` | ||
lint: flake8, | ||
format: autopep8, | ||
lint,tests: pytest-faker, | ||
``` | ||
|
||
2. Re-run the cookiecutter template: | ||
|
||
```terminal | ||
make template | ||
``` | ||
|
||
3. Commit everything to git and send a pull request |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Installing tox-faster | ||
|
||
Just add `tox-faster` to the `requires` setting in the `[tox]` section of your `tox.ini` file: | ||
|
||
```ini | ||
[tox] | ||
requires = | ||
tox-faster | ||
``` | ||
|
||
See [`requires` in tox's docs](https://tox.wiki/en/latest/config.html#conf-requires). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
BSD 2-Clause License | ||
|
||
Copyright (c) 2022, Hypothesis | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Oops, something went wrong.