Skip to content

Commit

Permalink
Merge branch 'master' into timeout_coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
CoolCat467 committed Nov 11, 2023
2 parents 01e978f + 315a0e8 commit ec87c56
Show file tree
Hide file tree
Showing 175 changed files with 2,334 additions and 1,642 deletions.
37 changes: 0 additions & 37 deletions .coveragerc

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/autodeps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
# The new dependencies may contain a new black version.
# Commit any changes immediately.
python -m pip install -r test-requirements.txt
black setup.py trio
black trio
- name: Commit changes and create automerge PR
env:
GH_TOKEN: ${{ github.token }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
strategy:
fail-fast: false
matrix:
# pypy-3.10 is failing, see https://github.com/python-trio/trio/issues/2678
python: ['3.8', '3.9', '3.10', 'pypy-3.9-nightly'] #, 'pypy-3.10-nightly']
# pypy 3.9 and 3.10 are failing, see https://github.com/python-trio/trio/issues/2678 and https://github.com/python-trio/trio/issues/2776 respectively
python: ['3.8', '3.9', '3.10'] #, 'pypy-3.9-nightly', 'pypy-3.10-nightly']
arch: ['x86', 'x64']
lsp: ['']
lsp_extract_file: ['']
Expand Down
21 changes: 12 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
ci:
autofix_commit_msg: "[pre-commit.ci] auto fixes from pre-commit.com hooks"
autofix_prs: false
autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate"
autoupdate_schedule: weekly
submodules: false

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
Expand All @@ -9,24 +16,20 @@ repos:
- id: check-merge-conflict
- id: mixed-line-ending
- id: check-case-conflict
- id: sort-simple-yaml
files: .pre-commit-config.yaml
- repo: https://github.com/psf/black
rev: 23.9.1
rev: 23.10.1
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.0
rev: v0.1.4
hooks:
- id: ruff
types: [file]
types_or: [python, pyi, toml]
args: ["--show-fixes"]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell

ci:
autofix_commit_msg: "[pre-commit.ci] auto fixes from pre-commit.com hooks"
autofix_prs: false
autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate"
autoupdate_schedule: weekly
submodules: false
67 changes: 1 addition & 66 deletions setup.py → LONG_DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
from setuptools import find_packages, setup

__version__ = "0.0.0" # Overwritten from _version.py below, needed for linter to identify that this variable is defined.

exec(open("trio/_version.py", encoding="utf-8").read())

LONG_DESC = """\
.. image:: https://raw.githubusercontent.com/python-trio/trio/9b0bec646a31e0d0f67b8b6ecc6939726faf3e17/logo/logo-with-background.svg
:width: 200px
:align: right
Expand Down Expand Up @@ -46,7 +39,7 @@
Vital statistics:

* Supported environments: Linux, macOS, or Windows running some kind of Python
3.8-or-better (either CPython or PyPy3 is fine). \\*BSD and illumos likely
3.8-or-better (either CPython or PyPy3 is fine). \*BSD and illumos likely
work too, but are not tested.

* Install: ``python3 -m pip install -U trio`` (or on Windows, maybe
Expand All @@ -70,61 +63,3 @@
conduct
<https://trio.readthedocs.io/en/latest/code-of-conduct.html>`_
in all project spaces.
"""

setup(
name="trio",
version=__version__,
description="A friendly Python library for async concurrency and I/O",
long_description=LONG_DESC,
long_description_content_type="text/x-rst",
author="Nathaniel J. Smith",
author_email="njs@pobox.com",
url="https://github.com/python-trio/trio",
license="MIT OR Apache-2.0",
packages=find_packages(),
install_requires=[
# attrs 19.2.0 adds `eq` option to decorators
# attrs 20.1.0 adds @frozen
"attrs >= 20.1.0",
"sortedcontainers",
"idna",
"outcome",
"sniffio >= 1.3.0",
# cffi 1.12 adds from_buffer(require_writable=True) and ffi.release()
# cffi 1.14 fixes memory leak inside ffi.getwinerror()
# cffi is required on Windows, except on PyPy where it is built-in
"cffi>=1.14; os_name == 'nt' and implementation_name != 'pypy'",
"exceptiongroup >= 1.0.0rc9; python_version < '3.11'",
],
# This means, just install *everything* you see under trio/, even if it
# doesn't look like a source file, so long as it appears in MANIFEST.in:
include_package_data=True,
python_requires=">=3.8",
keywords=["async", "io", "networking", "trio"],
classifiers=[
"Development Status :: 3 - Alpha",
"Framework :: Trio",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"License :: OSI Approved :: Apache Software License",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: BSD",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: System :: Networking",
"Typing :: Typed",
],
project_urls={
"Documentation": "https://trio.readthedocs.io/",
"Changelog": "https://trio.readthedocs.io/en/latest/history.html",
},
)
5 changes: 3 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
include LICENSE LICENSE.MIT LICENSE.APACHE2
include README.rst
include LONG_DESCRIPTION.rst
include CODE_OF_CONDUCT.md CONTRIBUTING.md
include test-requirements.txt
include trio/py.typed
recursive-include trio/_tests/test_ssl_certs *.pem
include src/trio/py.typed
recursive-include src/trio/_tests/test_ssl_certs *.pem
recursive-include docs *
prune docs/build
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ demonstration of implementing the "Happy Eyeballs" algorithm in an
older library versus Trio.

**Cool, but will it work on my system?** Probably! As long as you have
some kind of Python 3.8-or-better (CPython or [currently maintained versions of
PyPy3](https://doc.pypy.org/en/latest/faq.html#which-python-versions-does-pypy-implement)
some kind of Python 3.8-or-better (CPython or `currently maintained versions of
PyPy3 <https://doc.pypy.org/en/latest/faq.html#which-python-versions-does-pypy-implement>`__
are both fine), and are using Linux, macOS, Windows, or FreeBSD, then Trio
will work. Other environments might work too, but those
are the ones we test on. And all of our dependencies are pure Python,
Expand Down
26 changes: 13 additions & 13 deletions check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fi

# Test if the generated code is still up to date
echo "::group::Generate Exports"
python ./trio/_tools/gen_exports.py --test \
python ./src/trio/_tools/gen_exports.py --test \
|| EXIT_STATUS=$?
echo "::endgroup::"

Expand All @@ -23,10 +23,10 @@ echo "::endgroup::"
# autoflake --recursive --in-place .
# pyupgrade --py3-plus $(find . -name "*.py")
echo "::group::Black"
if ! black --check setup.py trio; then
if ! black --check src/trio; then
echo "* Black found issues" >> "$GITHUB_STEP_SUMMARY"
EXIT_STATUS=1
black --diff setup.py trio
black --diff src/trio
echo "::endgroup::"
echo "::error:: Black found issues"
else
Expand All @@ -39,7 +39,7 @@ if ! ruff check .; then
echo "* ruff found issues." >> "$GITHUB_STEP_SUMMARY"
EXIT_STATUS=1
if $ON_GITHUB_CI; then
ruff check --format github --diff .
ruff check --output-format github --diff .
else
ruff check --diff .
fi
Expand All @@ -57,16 +57,16 @@ echo "::group::Mypy"
rm -f mypy_annotate.dat
# Pipefail makes these pipelines fail if mypy does, even if mypy_annotate.py succeeds.
set -o pipefail
mypy trio --show-error-end --platform linux | python ./trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat --platform Linux \
mypy src/trio --show-error-end --platform linux | python ./src/trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat --platform Linux \
|| { echo "* Mypy (Linux) found type errors." >> "$GITHUB_STEP_SUMMARY"; MYPY=1; }
# Darwin tests FreeBSD too
mypy trio --show-error-end --platform darwin | python ./trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat --platform Mac \
mypy src/trio --show-error-end --platform darwin | python ./src/trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat --platform Mac \
|| { echo "* Mypy (Mac) found type errors." >> "$GITHUB_STEP_SUMMARY"; MYPY=1; }
mypy trio --show-error-end --platform win32 | python ./trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat --platform Windows \
mypy src/trio --show-error-end --platform win32 | python ./src/trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat --platform Windows \
|| { echo "* Mypy (Windows) found type errors." >> "$GITHUB_STEP_SUMMARY"; MYPY=1; }
set +o pipefail
# Re-display errors using Github's syntax, read out of mypy_annotate.dat
python ./trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat
python ./src/trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat
# Then discard.
rm -f mypy_annotate.dat
echo "::endgroup::"
Expand Down Expand Up @@ -97,11 +97,11 @@ fi
codespell || EXIT_STATUS=$?

echo "::group::Pyright interface tests"
python trio/_tests/check_type_completeness.py --overwrite-file || EXIT_STATUS=$?
if git status --porcelain trio/_tests/verify_types*.json | grep -q "M"; then
python src/trio/_tests/check_type_completeness.py --overwrite-file || EXIT_STATUS=$?
if git status --porcelain src/trio/_tests/verify_types*.json | grep -q "M"; then
echo "* Type completeness changed, please update!" >> "$GITHUB_STEP_SUMMARY"
echo "::error::Type completeness changed, please update!"
git --no-pager diff --color trio/_tests/verify_types*.json
git --no-pager diff --color src/trio/_tests/verify_types*.json
EXIT_STATUS=1
fi

Expand All @@ -118,8 +118,8 @@ Problems were found by static analysis (listed above).
To fix formatting and see remaining errors, run
pip install -r test-requirements.txt
black setup.py trio
isort setup.py trio
black src/trio
ruff check src/trio
./check.sh
in your local checkout.
Expand Down
18 changes: 9 additions & 9 deletions ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ python -c "import sys, struct, ssl; print('python:', sys.version); print('versio
echo "::endgroup::"

echo "::group::Install dependencies"
python -m pip install -U pip setuptools wheel
python -m pip install -U pip build
python -m pip --version

python setup.py sdist --formats=zip
python -m pip install dist/*.zip
python -m build
python -m pip install dist/*.whl

if [ "$CHECK_FORMATTING" = "1" ]; then
python -m pip install -r test-requirements.txt
Expand Down Expand Up @@ -96,7 +96,7 @@ else
# when installing, and then running 'certmgr.msc' and exporting the
# certificate. See:
# http://www.migee.com/2010/09/24/solution-for-unattendedsilent-installs-and-would-you-like-to-install-this-device-software/
certutil -addstore "TrustedPublisher" trio/_tests/astrill-codesigning-cert.cer
certutil -addstore "TrustedPublisher" src/trio/_tests/astrill-codesigning-cert.cer
# Double-slashes are how you tell windows-bash that you want a single
# slash, and don't treat this as a unix-style filename that needs to
# be replaced by a windows-style filename.
Expand Down Expand Up @@ -128,11 +128,11 @@ else
echo "import coverage; coverage.process_startup()" | tee -a "$INSTALLDIR/../sitecustomize.py"

# set the location of .coveragerc for multi-process coverage to work
COVERAGE_PROCESS_START=$(pwd)/../.coveragerc
COVERAGE_PROCESS_START=$(pwd)/../pyproject.toml

PYTEST_CMD="pytest -r a -p trio._tests.pytest_plugin --junitxml=../test-results.xml --run-slow --verbose --durations=10 $flags ${INSTALLDIR}"

RUN_TESTS="coverage run --rcfile=../.coveragerc -m $PYTEST_CMD"
RUN_TESTS="coverage run --rcfile=../pyproject.toml -m $PYTEST_CMD"

# timeout can be changed with an environment variable, but if empty or unset
# default to 9m to not hit 10m limit
Expand Down Expand Up @@ -162,9 +162,9 @@ else
echo "::endgroup::"
echo "::group::Coverage"

coverage combine --rcfile ../.coveragerc
coverage report -m --rcfile ../.coveragerc
coverage xml --rcfile ../.coveragerc
coverage combine --rcfile ../pyproject.toml
coverage report -m --rcfile ../pyproject.toml
coverage xml --rcfile ../pyproject.toml

# Remove the LSP again; again we want to do this ASAP to avoid
# accidentally breaking other stuff.
Expand Down
16 changes: 6 additions & 10 deletions docs-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,17 @@ attrs==23.1.0
# via
# -r docs-requirements.in
# outcome
babel==2.13.0
babel==2.13.1
# via sphinx
certifi==2023.7.22
# via requests
cffi==1.16.0
# via cryptography
charset-normalizer==3.3.0
charset-normalizer==3.3.2
# via requests
click==8.1.7
# via
# click-default-group
# towncrier
click-default-group==1.2.4
# via towncrier
cryptography==41.0.4
cryptography==41.0.5
# via pyopenssl
docutils==0.18.1
# via
Expand Down Expand Up @@ -53,15 +49,15 @@ jinja2==3.1.2
# towncrier
markupsafe==2.1.3
# via jinja2
outcome==1.3.0
outcome==1.3.0.post0
# via -r docs-requirements.in
packaging==23.2
# via sphinx
pycparser==2.21
# via cffi
pygments==2.16.1
# via sphinx
pyopenssl==23.2.0
pyopenssl==23.3.0
# via -r docs-requirements.in
pytz==2023.3.post1
# via babel
Expand Down Expand Up @@ -101,7 +97,7 @@ sphinxcontrib-trio==1.1.2
# via -r docs-requirements.in
tomli==2.0.1
# via towncrier
towncrier==23.6.0
towncrier==23.10.0
# via -r docs-requirements.in
urllib3==2.0.7
# via requests
Expand Down

0 comments on commit ec87c56

Please sign in to comment.