|
| 1 | +--- |
| 2 | +layout: reports |
| 3 | +title: "April 2020" |
| 4 | +--- |
| 5 | + |
| 6 | +# Django REST framework |
| 7 | + |
| 8 | +While there has been a bunch of triage and minor fixes, our 3.12 release is still pending. I'll be looking at resolving this as a priority for May. |
| 9 | + |
| 10 | +# HTTPX |
| 11 | + |
| 12 | +We've now issued a 0.13 pre-release for `httpx`. You can install this release using `pip install httpx --pre`. |
| 13 | + |
| 14 | +The 0.13 release is a big milestone since it drops `urllib3` for the sync client, and instead uses `httpcore` for both the async and the sync clients. |
| 15 | + |
| 16 | +This means that: |
| 17 | + |
| 18 | +* Our networking behaviour between both the sync and async clients should now be identical. |
| 19 | +* We have HTTP/2 support for the sync client. |
| 20 | +* The low level HTTP transport interface is really tightly defined by the `httpcore` API, with a strict separation of concerns between the component that makes the HTTP requests, and the component that adds extra client smarts on top of that. (`httpcore` and `httpx`, respectively.) |
| 21 | + |
| 22 | +In order to make this possible, we've dropped support for a lesser-used feature of being able to make requests directly to a Unix domain socket. |
| 23 | + |
| 24 | +We'll give our pre-release a while to get bedded-in, before promoting it to a full 0.13 release. At that point we're ready to start reviewing any final API points that need addressing prior to a 1.0 release. |
| 25 | + |
| 26 | +# Dashboard |
| 27 | + |
| 28 | +The `dashboard` package is the first-pass of an admin-like interface for Starlette and other ASGI frameworks. |
| 29 | + |
| 30 | +Dashboard is designed to be able to plug directly into the ORM package, but may also to be used with alternate datasources too. A `DataSource` interface provides the contract that is required for alternate implementations. |
| 31 | + |
| 32 | +The package currently depends on pre-release versions of `orm` and `typesystem`, and is still very much in a design stage, but you'll be able to get a bit of an idea of how the API looks from the README. |
| 33 | + |
| 34 | +# Project management improvements |
| 35 | + |
| 36 | +The scope of the async web stack has been growing over the last few months, so that we're now maintaining several projects in this space, including `uvicorn`, `starlette`, `databases`, `orm`, `typesystem`, `broadcaster`, `httpcore`, and `httpx`. |
| 37 | + |
| 38 | +In order to keep scaling the maintenance work on those projects we've made some changes to the project management approach: |
| 39 | + |
| 40 | +* We're now inviting any contributor who authors a successful pull request onto the maintainers team. |
| 41 | +* Our GitHub settings enforce that all changes have to come via a pull request, and all pull requests require review. |
| 42 | +* We've setup GitHub Actions to deploy to PyPI and update the documentation whenever a release is created in the GitHub interface, allowing anyone on the maintenance team to issue releases. |
| 43 | + |
| 44 | +It's worth talking through our GitHub Action workflows a little, since they might be valuable for other teams working with PyPI and MkDocs. |
| 45 | + |
| 46 | +## Our workflow approach |
| 47 | + |
| 48 | +We follow [GitHub's "Scripts to Rule Them All" pattern](https://github.blog/2015-06-30-scripts-to-rule-them-all/) for install, deploy, and test scripts. |
| 49 | + |
| 50 | +Any complexity is kept out of the workflow steps, which just call into the scripts. For example, here's the "steps" configuration for our Test Suite workflow: |
| 51 | + |
| 52 | +```yaml |
| 53 | +steps: |
| 54 | + - uses: "actions/checkout@v2" |
| 55 | + - uses: "actions/setup-python@v1" |
| 56 | + with: |
| 57 | + python-version: "${{ matrix.python-version }}" |
| 58 | + - name: "Install dependencies" |
| 59 | + run: "scripts/install" |
| 60 | + - name: "Run linting checks" |
| 61 | + run: "scripts/check" |
| 62 | + - name: "Build package & docs" |
| 63 | + run: "scripts/build" |
| 64 | + - name: "Run tests" |
| 65 | + run: "scripts/test" |
| 66 | +``` |
| 67 | +
|
| 68 | +## Deploying to PyPI |
| 69 | +
|
| 70 | +We've created an API token for each PyPI package, and then stored that in the repo secrets as `PYPI_TOKEN`. |
| 71 | + |
| 72 | +The workflow file uses the API token to setup an appropriate environment for the publish script to run with... |
| 73 | + |
| 74 | +```yaml |
| 75 | +env: |
| 76 | + TWINE_USERNAME: __token__ |
| 77 | + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} |
| 78 | +``` |
| 79 | + |
| 80 | +Once we've done that we're able to either: |
| 81 | + |
| 82 | +* Run `scripts/publish` from within a GitHub action, where it will use a PyPI token as the auth credentials. |
| 83 | +* Run `scripts/publish` locally, where it will user whatever user PyPI credentials are currently setup. |
| 84 | + |
| 85 | +Our publish workflow is setup to run whenever a release is tagged in GitHub... |
| 86 | + |
| 87 | +```yaml |
| 88 | +on: |
| 89 | + push: |
| 90 | + tags: |
| 91 | + - '*' |
| 92 | +``` |
| 93 | + |
| 94 | +## Deploy the docs, using MkDocs |
| 95 | + |
| 96 | +Deploying the documentation from a GitHub action is simple enough. We can use `mkdocs gh-deploy` to push a documentation release to the `gh-pages` branch. |
| 97 | + |
| 98 | +There's two extra things we need to take care of... |
| 99 | + |
| 100 | +* Deploys need to use the `--force` flag, so `mkdocs gh-deploy --force`. |
| 101 | +* We need to set an appropriate user/email git configuration, when we're running within a GitHub action. |
| 102 | + |
| 103 | +To set the Git user when we're running the deploy script as a GitHub action we use the following... |
| 104 | + |
| 105 | +```shell |
| 106 | +if [ ! -z "$GITHUB_ACTIONS" ]; then |
| 107 | + git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 108 | + git config --local user.name "GitHub Action" |
| 109 | +
|
| 110 | + ... |
| 111 | +``` |
| 112 | + |
| 113 | +The email address there *happens* to be the GitHub Action bot's designated email, which ensures that commits to the `gh-pages` branch display the bot avatar properly in the GitHub interface. |
| 114 | + |
| 115 | +--- |
| 116 | + |
| 117 | + |
| 118 | +Thanks as ever to all our sponsors, contributors, and users, |
| 119 | + |
| 120 | +— Tom Christie, 1st May, 2020. |
0 commit comments