diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eff0b74..dd9c4d5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - python: ['3.7', '3.8', '3.9', '3.10'] + python: ['3.8', '3.9', '3.10', '3.11', '3.12'] steps: - name: Checkout @@ -34,7 +34,7 @@ jobs: strategy: fail-fast: false matrix: - python: ['3.7', '3.8', '3.9', '3.10', '3.11-dev'] + python: ['3.8', '3.9', '3.10', '3.11', '3.12'] check_formatting: ['0'] extra_name: [''] include: @@ -70,7 +70,7 @@ jobs: strategy: fail-fast: false matrix: - python: ['3.7', '3.8', '3.9', '3.10'] + python: ['3.8', '3.9', '3.10', '3.11', '3.12'] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/ci.sh b/ci.sh index 85d2a18..dee5ca2 100755 --- a/ci.sh +++ b/ci.sh @@ -1,21 +1,42 @@ #!/bin/bash -set -ex +set -ex -o pipefail -CHECK_FILES="setup.py src tests" +CHECK_FILES="src tests" YAPF_VERSION=0.20.1 -python -m pip install -U pip setuptools wheel +# Log some general info about the environment +echo "::group::Environment" +uname -a +env | sort +echo "::endgroup::" -python setup.py sdist --formats=zip -pip install dist/*.zip +################################################################ +# We have a Python environment! +################################################################ +echo "::group::Versions" +python -c "import sys, struct; print('python:', sys.version); print('version_info:', sys.version_info); print('bits:', struct.calcsize('P') * 8)" +echo "::endgroup::" + +echo "::group::Install dependencies" +python -m pip install -U pip build +python -m pip --version + +python -m build +python -m pip install dist/*.whl +echo "::endgroup::" + +echo "::group::Setup for tests" # Install dependencies. pip install -Ur test-requirements.txt +echo "::endgroup::" if [ "$CHECK_FORMATTING" = "1" ]; then + echo "::group::Yapf" pip install yapf==${YAPF_VERSION} "isort>=5" mypy pyright if ! yapf -rpd $CHECK_FILES; then + echo "::endgroup::" cat <= 64"] +build-backend = "setuptools.build_meta" + +[project] +name="outcome" +description="Capture the outcome of Python function calls." +authors = [{name = "Frazer McLean", email = "frazer@frazermclean.co.uk"}] +license = {text = "MIT OR Apache-2.0"} +keywords = [ + "result", +] +classifiers=[ + "Development Status :: 5 - Production/Stable", + "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 :: 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", + "Typing :: Typed", +] +requires-python = ">=3.8" +dependencies = [ + # attrs 19.2.0 adds `eq` option to decorators + "attrs>=19.2.0" +] +dynamic = ["version"] + +[project.readme] +file = "README.rst" +content-type = "text/x-rst" + +[project.urls] +Homepage = "https://github.com/python-trio/outcome" +Documentation = "https://outcome.readthedocs.io/en/latest/" +Changelog = "https://outcome.readthedocs.io/en/latest/history.html" +Chat = "https://gitter.im/python-trio/general" + +[tool.setuptools] +# This means, just install *everything* you see under outcome/, even if it +# doesn't look like a source file, so long as it appears in MANIFEST.in: +include-package-data = true + +[tool.setuptools.dynamic] +version = {attr = "outcome._version.__version__"} + [tool.towncrier] -package = "outcome" -filename = "docs/source/history.rst" directory = "newsfragments" -underlines = ["-", "~", "^"] +filename = "docs/source/history.rst" issue_format = "`#{issue} `__" +# Usage: +# - PRs should drop a file like "issuenumber.feature" in newsfragments +# (or "bugfix", "doc", "removal", "misc"; misc gets no text, we can +# customize this) +# - At release time after bumping version number, run: towncrier +# (or towncrier --draft) +package = "outcome" +package_dir = "src" +underlines = ["-", "~", "^"] + +[[tool.towncrier.type]] +directory = "feature" +name = "Features" +showcontent = true + +[[tool.towncrier.type]] +directory = "bugfix" +name = "Bugfixes" +showcontent = true + +[[tool.towncrier.type]] +directory = "doc" +name = "Improved documentation" +showcontent = true + +[[tool.towncrier.type]] +directory = "removal" +name = "Removals without deprecations" +showcontent = true + +[[tool.towncrier.type]] +directory = "misc" +name = "Miscellaneous internal changes" +showcontent = true + +[tool.coverage.run] +branch = true +source_pkgs = ["outcome", "tests"] +omit = [ + "tests/type_tests.py", +] + +[tool.coverage.report] +precision = 1 +exclude_lines = [ + "pragma: no cover", + "abc.abstractmethod", + "if TYPE_CHECKING.*:", + "@overload", + "raise NotImplementedError", +] +partial_branches = [ + "pragma: no branch", + "if not TYPE_CHECKING:", + "if .* or not TYPE_CHECKING:", +] [tool.isort] combine_as_imports = true profile = "black" skip_gitignore = true +skip = ["./build", "./docs"] +known_first_party = ["outcome"] [tool.mypy] +python_version = "3.8" + # Be strict about use of Mypy strict = true +local_partial_types = true warn_unused_ignores = true warn_unused_configs = true warn_redundant_casts = true @@ -34,3 +149,6 @@ disallow_untyped_decorators = true # DO NOT use `ignore_errors`; it doesn't apply # downstream and users have to deal with them. + +[tool.pytest.ini_options] +asyncio_mode = "strict" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 7e0298f..0000000 --- a/setup.cfg +++ /dev/null @@ -1,27 +0,0 @@ -[bdist_wheel] -universal = 1 - -[isort] -multi_line_output = 4 -skip = ./build, ./docs -# ci/travis.sh installs outcome normally, so isort assumes it's third party -known_first_party = outcome - -[coverage:run] -branch = True -source = - outcome - tests/ -omit = - tests/type_tests.py - -[coverage:report] -precision = 1 -exclude_lines = - pragma: no cover - abc.abstractmethod - if TYPE_CHECKING: - @overload - -[tool:pytest] -asyncio_mode = strict diff --git a/setup.py b/setup.py deleted file mode 100644 index 008d005..0000000 --- a/setup.py +++ /dev/null @@ -1,50 +0,0 @@ -from setuptools import find_packages, setup - -version = dict() - -with open('src/outcome/_version.py') as fp: - version_mod = fp.read() - -exec(version_mod, version) - -LONG_DESC = open('README.rst').read() - -setup( - name='outcome', - version=version['__version__'], - description='Capture the outcome of Python function calls.', - url='https://github.com/python-trio/outcome', - project_urls={ - "Documentation": "https://outcome.readthedocs.io/en/latest/", - "Chat": "https://gitter.im/python-trio/general", - "Changelog": "https://outcome.readthedocs.io/en/latest/history.html", - }, - long_description=LONG_DESC, - long_description_content_type='text/x-rst', - author='Frazer McLean', - author_email='frazer@frazermclean.co.uk', - license='MIT OR Apache-2.0', - packages=find_packages('src'), - package_dir={'': 'src'}, - include_package_data=True, - install_requires=['attrs>=19.2.0'], - python_requires='>=3.7', - keywords='result', - classifiers=[ - 'Development Status :: 5 - Production/Stable', - '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 :: Microsoft :: Windows', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: Implementation :: CPython', - 'Programming Language :: Python :: Implementation :: PyPy', - 'Typing :: Typed', - ], -) diff --git a/src/outcome/_version.py b/src/outcome/_version.py index 735885d..45e2e33 100644 --- a/src/outcome/_version.py +++ b/src/outcome/_version.py @@ -1,4 +1,4 @@ -# This file is imported from __init__.py and exec'd from setup.py +# This file is imported from __init__.py and parsed by setuptools from typing import TYPE_CHECKING if TYPE_CHECKING: