|
9 | 9 |
|
10 | 10 | Load env files in your tox envs. |
11 | 11 |
|
12 | | -For installation instructions see [INSTALL.md](https://github.com/hypothesis/tox-envfile/blob/main/INSTALL.md). |
13 | | - |
14 | | -For how to set up a tox-envfile development environment see |
15 | | -[HACKING.md](https://github.com/hypothesis/tox-envfile/blob/main/HACKING.md). |
16 | | - |
17 | 12 | tox-envfile reads environment variables from a file named `.devdata.env` in the |
18 | 13 | same directory as your `tox.ini` file and adds them to the environment that tox |
19 | 14 | runs your commands in. |
@@ -54,3 +49,143 @@ CONFIG_PATH=${HOME}/.config/foo |
54 | 49 | DOMAIN=example.org |
55 | 50 | EMAIL=admin@${DOMAIN} |
56 | 51 | ``` |
| 52 | + |
| 53 | +## Setting up Your tox-envfile Development Environment |
| 54 | + |
| 55 | +First you'll need to install: |
| 56 | + |
| 57 | +* [Git](https://git-scm.com/). |
| 58 | + On Ubuntu: `sudo apt install git`, on macOS: `brew install git`. |
| 59 | +* [GNU Make](https://www.gnu.org/software/make/). |
| 60 | + This is probably already installed, run `make --version` to check. |
| 61 | +* [pyenv](https://github.com/pyenv/pyenv). |
| 62 | + Follow the instructions in pyenv's README to install it. |
| 63 | + The **Homebrew** method works best on macOS. |
| 64 | + The **Basic GitHub Checkout** method works best on Ubuntu. |
| 65 | + You _don't_ need to set up pyenv's shell integration ("shims"), you can |
| 66 | + [use pyenv without shims](https://github.com/pyenv/pyenv#using-pyenv-without-shims). |
| 67 | + |
| 68 | +Then to set up your development environment: |
| 69 | + |
| 70 | +```terminal |
| 71 | +git clone https://github.com/hypothesis/tox-envfile.git |
| 72 | +cd tox_envfile |
| 73 | +make help |
| 74 | +``` |
| 75 | + |
| 76 | +## Releasing a New Version of the Project |
| 77 | + |
| 78 | +1. First, to get PyPI publishing working you need to go to: |
| 79 | + <https://github.com/organizations/hypothesis/settings/secrets/actions/PYPI_TOKEN> |
| 80 | + and add tox-envfile to the `PYPI_TOKEN` secret's selected |
| 81 | + repositories. |
| 82 | + |
| 83 | +2. Now that the tox-envfile project has access to the `PYPI_TOKEN` secret |
| 84 | + 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). |
| 85 | + Publishing a new GitHub release will automatically trigger |
| 86 | + [a GitHub Actions workflow](.github/workflows/pypi.yml) |
| 87 | + that will build the new version of your Python package and upload it to |
| 88 | + <https://pypi.org/project/tox-envfile>. |
| 89 | + |
| 90 | +## Changing the Project's Python Versions |
| 91 | + |
| 92 | +To change what versions of Python the project uses: |
| 93 | + |
| 94 | +1. Change the Python versions in the |
| 95 | + [cookiecutter.json](.cookiecutter/cookiecutter.json) file. For example: |
| 96 | + |
| 97 | + ```json |
| 98 | + "python_versions": "3.10.4, 3.9.12", |
| 99 | + ``` |
| 100 | + |
| 101 | +2. Re-run the cookiecutter template: |
| 102 | + |
| 103 | + ```terminal |
| 104 | + make template |
| 105 | + ``` |
| 106 | + |
| 107 | +3. Commit everything to git and send a pull request |
| 108 | + |
| 109 | +## Changing the Project's Python Dependencies |
| 110 | + |
| 111 | +To change the production dependencies in the `setup.cfg` file: |
| 112 | + |
| 113 | +1. Change the dependencies in the [`.cookiecutter/includes/setuptools/install_requires`](.cookiecutter/includes/setuptools/install_requires) file. |
| 114 | + If this file doesn't exist yet create it and add some dependencies to it. |
| 115 | + For example: |
| 116 | + |
| 117 | + ``` |
| 118 | + pyramid |
| 119 | + sqlalchemy |
| 120 | + celery |
| 121 | + ``` |
| 122 | + |
| 123 | +2. Re-run the cookiecutter template: |
| 124 | + |
| 125 | + ```terminal |
| 126 | + make template |
| 127 | + ``` |
| 128 | + |
| 129 | +3. Commit everything to git and send a pull request |
| 130 | + |
| 131 | +To change the project's formatting, linting and test dependencies: |
| 132 | + |
| 133 | +1. Change the dependencies in the [`.cookiecutter/includes/tox/deps`](.cookiecutter/includes/tox/deps) file. |
| 134 | + If this file doesn't exist yet create it and add some dependencies to it. |
| 135 | + Use tox's [factor-conditional settings](https://tox.wiki/en/latest/config.html#factors-and-factor-conditional-settings) |
| 136 | + to limit which environment(s) each dependency is used in. |
| 137 | + For example: |
| 138 | + |
| 139 | + ``` |
| 140 | + lint: flake8, |
| 141 | + format: autopep8, |
| 142 | + lint,tests: pytest-faker, |
| 143 | + ``` |
| 144 | + |
| 145 | +2. Re-run the cookiecutter template: |
| 146 | + |
| 147 | + ```terminal |
| 148 | + make template |
| 149 | + ``` |
| 150 | + |
| 151 | +3. Commit everything to git and send a pull request |
| 152 | + |
| 153 | +Testing Manually |
| 154 | +---------------- |
| 155 | + |
| 156 | +To test it manually you can install your local development copy of |
| 157 | +`tox-envfile` into the local development environment of another tox-using |
| 158 | +project such as |
| 159 | +[cookiecutter-pypackage-test](https://github.com/hypothesis/cookiecutter-pypackage-test): |
| 160 | + |
| 161 | +1. Install a local development copy of `cookiecutter-pypackage-test` in a temporary directory: |
| 162 | + |
| 163 | + ```terminal |
| 164 | + git clone https://github.com/hypothesis/cookiecutter-pypackage-test.git /tmp/cookiecutter-pypackage-test |
| 165 | + ``` |
| 166 | + |
| 167 | +2. Run `cookiecutter-pypackage-test`'s `make sure` command to make sure that |
| 168 | + everything is working and to trigger tox to create its `.tox/.tox` |
| 169 | + venv: |
| 170 | + |
| 171 | + ```terminal |
| 172 | + make --directory "/tmp/cookiecutter-pypackage-test" sure |
| 173 | + ``` |
| 174 | + |
| 175 | +3. Uninstall the production copy of `tox-envfile` from `cookiecutter-pypackage-test`'s `.tox/.tox` venv: |
| 176 | + |
| 177 | + ```terminal |
| 178 | + /tmp/cookiecutter-pypackage-test/.tox/.tox/bin/pip uninstall tox-envfile |
| 179 | + ``` |
| 180 | + |
| 181 | +4. Install your local development copy of `tox-envfile` into `cookiecutter-pypackage-test`'s `.tox/.tox` venv: |
| 182 | + |
| 183 | + ```terminal |
| 184 | + /tmp/cookiecutter-pypackage-test/.tox/.tox/bin/pip install -e . |
| 185 | + ``` |
| 186 | + |
| 187 | +5. Now `cookiecutter-pypackage-test` commands will use your local development copy of `tox-envfile`: |
| 188 | + |
| 189 | + ```terminal |
| 190 | + make --directory "/tmp/cookiecutter-pypackage-test" test |
| 191 | + ``` |
0 commit comments