Skip to content

Commit

Permalink
Merge branch 'master' into maintenance/checkout-sdist-action
Browse files Browse the repository at this point in the history
  • Loading branch information
richardsheridan authored Mar 11, 2023
2 parents b94bb9d + e45c9d5 commit 81ec287
Show file tree
Hide file tree
Showing 29 changed files with 333 additions and 176 deletions.
90 changes: 64 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,16 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ['3.7', '3.8', '3.9', '3.10']
python: ['3.7', '3.8', '3.9', '3.10', 'pypy-3.8-nightly', 'pypy-3.9-nightly']
arch: ['x86', 'x64']
lsp: ['']
lsp_extract_file: ['']
extra_name: ['']
exclude:
- python: 'pypy-3.8-nightly'
arch: 'x86'
- python: 'pypy-3.9-nightly'
arch: 'x86'
include:
- python: '3.8'
arch: 'x64'
Expand All @@ -104,19 +109,23 @@ jobs:
# lsp: 'http://download.pctools.com/mirror/updates/9.0.0.2308-SDavfree-lite_en.exe'
# lsp_extract_file: ''
# extra_name: ', with non-IFS LSP'
- python: '3.8' # <- not actually used
arch: 'x64'
pypy_nightly_branch: 'py3.8'
extra_name: ', pypy 3.8 nightly'

continue-on-error: >-
${{
(
endsWith(matrix.python, '-dev')
|| endsWith(matrix.python, '-nightly')
)
&& true
|| false
}}
steps:
- name: Retrieve the project source from an sdist inside the GHA artifact
uses: re-actors/checkout-python-sdist@release/v1
with:
source-tarball-name: ${{ needs.build.outputs.sdist-artifact-name }}
workflow-artifact-name: ${{ env.dists-artifact-name }}
- name: Setup python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
# This allows the matrix to specify just the major.minor version while still
# expanding it to get the latest patch version including alpha releases.
Expand Down Expand Up @@ -149,26 +158,19 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ['pypy-3.7', 'pypy-3.8', '3.7', '3.8', '3.9', '3.10', '3.11-dev']
python: ['pypy-3.7', 'pypy-3.8', 'pypy-3.9', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12-dev', 'pypy-3.8-nightly', 'pypy-3.9-nightly']
check_formatting: ['0']
pypy_nightly_branch: ['']
extra_name: ['']
include:
- python: '3.8'
check_formatting: '1'
extra_name: ', check formatting'
- python: '3.7' # <- not actually used
pypy_nightly_branch: 'py3.7'
extra_name: ', pypy 3.7 nightly'
- python: '3.8' # <- not actually used
pypy_nightly_branch: 'py3.8'
extra_name: ', pypy 3.8 nightly'
continue-on-error: >-
${{
(
matrix.check_formatting == '1'
|| matrix.pypy_nightly_branch == 'py3.7'
|| endsWith(matrix.python, '-dev')
|| endsWith(matrix.python, '-nightly')
)
&& true
|| false
Expand All @@ -180,7 +182,7 @@ jobs:
source-tarball-name: ${{ needs.build.outputs.sdist-artifact-name }}
workflow-artifact-name: ${{ env.dists-artifact-name }}
- name: Setup python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
if: "!endsWith(matrix.python, '-dev')"
with:
python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python), matrix.python))[startsWith(matrix.python, 'pypy')] }}
Expand All @@ -194,35 +196,71 @@ jobs:
- name: Run tests
run: ./ci.sh
env:
PYPY_NIGHTLY_BRANCH: '${{ matrix.pypy_nightly_branch }}'
CHECK_FORMATTING: '${{ matrix.check_formatting }}'
# Should match 'name:' up above
JOB_NAME: 'Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})'

autofmt:
name: Autoformat dependabot PR
timeout-minutes: 10
if: github.actor == 'dependabot[bot]'
runs-on: 'ubuntu-latest'
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#changing-github_token-permissions
permissions:
pull-requests: write
issues: write
repository-projects: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Check formatting
run: |
python -m pip install -r test-requirements.txt
./check.sh
- name: Commit autoformatter changes
if: failure()
run: |
black setup.py trio
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
git commit -am "Autoformatter changes"
git push
macOS:
name: 'macOS (${{ matrix.python }})'
needs:
- build

timeout-minutes: 10
timeout-minutes: 15
runs-on: 'macos-latest'
strategy:
fail-fast: false
matrix:
python: ['3.7', '3.8', '3.9', '3.10']
include:
- python: '3.8' # <- not actually used
arch: 'x64'
pypy_nightly_branch: 'py3.8'
extra_name: ', pypy 3.8 nightly'
python: ['3.7', '3.8', '3.9', '3.10', 'pypy-3.8-nightly', 'pypy-3.9-nightly']
continue-on-error: >-
${{
(
endsWith(matrix.python, '-dev')
|| endsWith(matrix.python, '-nightly')
)
&& true
|| false
}}
steps:
- name: Retrieve the project source from an sdist inside the GHA artifact
uses: re-actors/checkout-python-sdist@release/v1
with:
source-tarball-name: ${{ needs.build.outputs.sdist-artifact-name }}
workflow-artifact-name: ${{ env.dists-artifact-name }}
- name: Setup python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python), matrix.python))[startsWith(matrix.python, 'pypy')] }}
cache: pip
Expand Down
6 changes: 5 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ formats:
- htmlzip
- epub

build:
os: "ubuntu-22.04"
tools:
python: "3.11"

python:
version: 3.7
install:
- requirements: docs-requirements.txt

Expand Down
9 changes: 9 additions & 0 deletions check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ mypy -m trio -m trio.testing --platform linux || EXIT_STATUS=$?
mypy -m trio -m trio.testing --platform darwin || EXIT_STATUS=$? # tests FreeBSD too
mypy -m trio -m trio.testing --platform win32 || EXIT_STATUS=$?

# Check pip compile is consistent
pip-compile test-requirements.in
pip-compile docs-requirements.in

if git status --porcelain | grep -q "requirements.txt"; then
git status --porcelain
EXIT_STATUS=1
fi

# Finally, leave a really clear warning of any issues and exit
if [ $EXIT_STATUS -ne 0 ]; then
cat <<EOF
Expand Down
34 changes: 0 additions & 34 deletions ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,40 +26,6 @@ function curl-harder() {
return 1
}

################################################################
# Bootstrap python environment, if necessary
################################################################

### PyPy nightly ###

if [ "$PYPY_NIGHTLY_BRANCH" != "" ]; then
JOB_NAME="pypy_nightly_${PYPY_NIGHTLY_BRANCH}"
curl-harder -o pypy.tar.bz2 http://buildbot.pypy.org/nightly/${PYPY_NIGHTLY_BRANCH}/pypy-c-jit-latest-linux64.tar.bz2
if [ ! -s pypy.tar.bz2 ]; then
# We know:
# - curl succeeded (200 response code)
# - nonetheless, pypy.tar.bz2 does not exist, or contains no data
# This isn't going to work, and the failure is not informative of
# anything involving Trio.
ls -l
echo "PyPy3 nightly build failed to download – something is wrong on their end."
echo "Skipping testing against the nightly build for right now."
exit 0
fi
tar xaf pypy.tar.bz2
# something like "pypy-c-jit-89963-748aa3022295-linux64"
PYPY_DIR=$(echo pypy-c-jit-*)
PYTHON_EXE=$PYPY_DIR/bin/pypy3

if ! ($PYTHON_EXE -m ensurepip \
&& $PYTHON_EXE -m pip install virtualenv \
&& $PYTHON_EXE -m virtualenv testenv); then
echo "pypy nightly is broken; skipping tests"
exit 0
fi
source testenv/bin/activate
fi

################################################################
# We have a Python environment!
################################################################
Expand Down
2 changes: 1 addition & 1 deletion docs-requirements.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# RTD is currently installing 1.5.3, which has a bug in :lineno-match:
# sphinx-3.4 causes warnings about some trio._abc classes: GH#2338
sphinx >= 1.7.0, < 3.4
sphinx >= 1.7.0, < 6.2
# jinja2-3.1 causes importerror with sphinx<4.0
jinja2 < 3.1
sphinx_rtd_theme
Expand Down
26 changes: 16 additions & 10 deletions docs-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# This file is autogenerated by pip-compile with python 3.7
# To update, run:
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile docs-requirements.in
#
Expand All @@ -12,19 +12,19 @@ attrs==22.2.0
# via
# -r docs-requirements.in
# outcome
babel==2.11.0
babel==2.12.1
# via sphinx
certifi==2022.12.7
# via requests
charset-normalizer==3.0.1
charset-normalizer==3.1.0
# via requests
click==8.1.3
# via
# click-default-group
# towncrier
click-default-group==1.2.2
# via towncrier
docutils==0.17.1
docutils==0.18.1
# via
# sphinx
# sphinx-rtd-theme
Expand All @@ -38,6 +38,8 @@ imagesize==1.4.1
# via sphinx
immutables==0.19
# via -r docs-requirements.in
importlib-metadata==6.0.0
# via sphinx
incremental==22.10.0
# via towncrier
jinja2==3.0.3
Expand All @@ -63,19 +65,21 @@ snowballstemmer==2.2.0
# via sphinx
sortedcontainers==2.4.0
# via -r docs-requirements.in
sphinx==3.3.1
sphinx==6.1.3
# via
# -r docs-requirements.in
# sphinx-rtd-theme
# sphinxcontrib-trio
sphinx-rtd-theme==1.1.1
sphinx-rtd-theme==1.2.0
# via -r docs-requirements.in
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-applehelp==1.0.4
# via sphinx
sphinxcontrib-devhelp==1.0.2
# via sphinx
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-htmlhelp==2.0.1
# via sphinx
sphinxcontrib-jquery==2.0.0
# via sphinx-rtd-theme
sphinxcontrib-jsmath==1.0.1
# via sphinx
sphinxcontrib-qthelp==1.0.3
Expand All @@ -86,10 +90,12 @@ sphinxcontrib-trio==1.1.2
# via -r docs-requirements.in
tomli==2.0.1
# via towncrier
towncrier==22.8.0
towncrier==22.12.0
# via -r docs-requirements.in
urllib3==1.26.14
# via requests
zipp==3.15.0
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# setuptools
9 changes: 7 additions & 2 deletions docs/source/_templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@
{% extends "!layout.html" %}

{% block sidebartitle %}
<a class="logo" href="{{ pathto(master_doc) }}">
<img class="logo" src="{{ pathto('_static/' + logo, 1) }}" />

{# the logo helper function was removed in Sphinx 6 and deprecated since Sphinx 4 #}
{# the master_doc variable was renamed to root_doc in Sphinx 4 (master_doc still exists in later Sphinx versions) #}
{# check sphinx_rtd_theme/layout.html:sidebartitle if this snippet has become outdated #}

<a class="logo" href="{{ pathto(root_doc) }}">
<img class="logo" src="{{ logo_url }}" />
{%- set nav_version = version %}
{% if READTHEDOCS and current_version %}
{%- set nav_version = current_version %}
Expand Down
2 changes: 1 addition & 1 deletion docs/source/code-of-conduct.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ If you see a Code of Conduct violation, follow these steps:
them to stop and/or edit their message(s) or commits.
2. That person should immediately stop the behavior and correct the
issue.
3. If this doesnt happen, or if you're uncomfortable speaking up,
3. If this doesn't happen, or if you're uncomfortable speaking up,
:ref:`contact the maintainers <coc-contacting-maintainers>`.
4. As soon as possible, a maintainer will look into the issue, and take
:ref:`further action (see below) <coc-further-enforcement>`, starting with
Expand Down
13 changes: 10 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,14 @@
("py:class", "async function"),
("py:class", "sync function"),
# https://github.com/sphinx-doc/sphinx/issues/7722
("py:class", "SendType"),
("py:class", "ReceiveType"),
# TODO: why do these need to be spelled out?
("py:class", "trio._abc.ReceiveType"),
("py:class", "trio._abc.SendType"),
("py:class", "trio._abc.T"),
("py:obj", "trio._abc.ReceiveType"),
("py:obj", "trio._abc.SendType"),
("py:obj", "trio._abc.T"),
("py:obj", "trio._abc.T_resource"),
]
autodoc_inherit_docstrings = False
default_role = "obj"
Expand Down Expand Up @@ -91,6 +97,7 @@ def setup(app):
"python": ("https://docs.python.org/3", None),
"outcome": ("https://outcome.readthedocs.io/en/latest/", None),
"pyopenssl": ("https://www.pyopenssl.org/en/stable/", None),
"sniffio": ("https://sniffio.readthedocs.io/en/latest/", None),
}

autodoc_member_order = "bysource"
Expand Down Expand Up @@ -132,7 +139,7 @@ def setup(app):
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = "en"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down
3 changes: 2 additions & 1 deletion docs/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,8 @@ then we'll figure something out.
.. Possible references for future additions:
"""
Jumping into an unfamiliar codebase (or any for that matter) for the first time can be scary. Plus, if it’s your first time contributing to open source, it can even be scarier!
Jumping into an unfamiliar codebase (or any for that matter) for the first time can be scary.
Plus, if it's your first time contributing to open source, it can even be scarier!
But, we at webpack believe:
Expand Down
2 changes: 1 addition & 1 deletion newsfragments/2333.bugfix.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Python raises a `TypeError` if you try to (re-)install a C signal handler.
Fixed a crash that can occur when running Trio within an embedded Python interpreter, by handling the `TypeError` that is raised when trying to (re-)install a C signal handler.
Loading

0 comments on commit 81ec287

Please sign in to comment.