From f58f54eb454584fcf393acf451ea4e9c7a5d955d Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Wed, 4 Nov 2020 23:49:05 +0000 Subject: [PATCH 1/5] apply setup-py-upgrade --- exceptiongroup/_version.py | 2 +- setup.cfg | 30 ++++++++++++++++++++++++++++++ setup.py | 34 ++-------------------------------- 3 files changed, 33 insertions(+), 33 deletions(-) create mode 100644 setup.cfg diff --git a/exceptiongroup/_version.py b/exceptiongroup/_version.py index 490c03a..cdf1d9a 100644 --- a/exceptiongroup/_version.py +++ b/exceptiongroup/_version.py @@ -1,3 +1,3 @@ -# This file is imported from __init__.py and exec'd from setup.py +# This file is imported from __init__.py and AST-parsed from setuptools __version__ = "0.0.0" diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..4231f26 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,30 @@ +[metadata] +name = exceptiongroup +version = attr: exceptiongroup._version.__version__ +description = A way to represent multiple things going wrong at the same time, in Python +url = https://github.com/python-trio/exceptiongroup +long_description = file: README.rst +author = Nathaniel J. Smith +author_email = njs@pobox.com +license = MIT -or- Apache License 2.0 +keywords = + async + exceptions + error handling +classifiers = + License :: OSI Approved :: MIT License + License :: OSI Approved :: Apache Software License + Framework :: Trio + Framework :: AsyncIO + Operating System :: POSIX :: Linux + Operating System :: MacOS :: MacOS X + Operating System :: Microsoft :: Windows + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: Implementation :: CPython + Programming Language :: Python :: Implementation :: PyPy + Intended Audience :: Developers + +[options] +packages = find: +install_requires = trio +python_requires = >=3.5 diff --git a/setup.py b/setup.py index 9b1f6d6..6068493 100644 --- a/setup.py +++ b/setup.py @@ -1,33 +1,3 @@ -from setuptools import setup, find_packages +from setuptools import setup -exec(open("exceptiongroup/_version.py", encoding="utf-8").read()) - -LONG_DESC = open("README.rst", encoding="utf-8").read() - -setup( - name="exceptiongroup", - version=__version__, - description="A way to represent multiple things going wrong at the same time, in Python", - url="https://github.com/python-trio/exceptiongroup", - long_description=LONG_DESC, - author="Nathaniel J. Smith", - author_email="njs@pobox.com", - license="MIT -or- Apache License 2.0", - packages=find_packages(), - install_requires=["trio"], - keywords=["async", "exceptions", "error handling"], - python_requires=">=3.5", - classifiers=[ - "License :: OSI Approved :: MIT License", - "License :: OSI Approved :: Apache Software License", - "Framework :: Trio", - "Framework :: AsyncIO", - "Operating System :: POSIX :: Linux", - "Operating System :: MacOS :: MacOS X", - "Operating System :: Microsoft :: Windows", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: PyPy", - "Intended Audience :: Developers", - ], -) +setup() From 4ae9bc5ed311d39a6eb5682641be0e561f9931c3 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Wed, 4 Nov 2020 23:53:10 +0000 Subject: [PATCH 2/5] require setuptools >= 46.4.0 for version = attr: ast parsing see https://github.com/pypa/setuptools/pull/1753 --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index a0ebcad..ca329df 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,7 @@ +[build-system] +requires = ["setuptools >= 46.4.0", "wheel"] +build-backend = "setuptools.build_meta" + [tool.towncrier] package = "exceptiongroup" filename = "docs/source/history.rst" From 07d6e1d65e41c1960dad0e670a7ae32e803a119f Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Wed, 4 Nov 2020 23:54:26 +0000 Subject: [PATCH 3/5] add long_description_content_type = text/x-rst to avoid twine warnings --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index 4231f26..bec5674 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,6 +4,7 @@ version = attr: exceptiongroup._version.__version__ description = A way to represent multiple things going wrong at the same time, in Python url = https://github.com/python-trio/exceptiongroup long_description = file: README.rst +long_description_content_type = text/x-rst author = Nathaniel J. Smith author_email = njs@pobox.com license = MIT -or- Apache License 2.0 From 7a02006225d6f39195ad98ecf9a59489ba5bc18a Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Thu, 5 Nov 2020 00:17:45 +0000 Subject: [PATCH 4/5] apply black --- docs/source/conf.py | 62 +++++++++++++++++++++------------------- exceptiongroup/_tools.py | 2 +- 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 87e4454..1cce7a2 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -19,8 +19,9 @@ # import os import sys + # So autodoc can import our package -sys.path.insert(0, os.path.abspath('../..')) +sys.path.insert(0, os.path.abspath("../..")) # Warn about all references to unknown targets nitpicky = True @@ -40,16 +41,16 @@ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ - 'sphinx.ext.autodoc', - 'sphinx.ext.intersphinx', - 'sphinx.ext.coverage', - 'sphinx.ext.napoleon', - 'sphinxcontrib_trio', + "sphinx.ext.autodoc", + "sphinx.ext.intersphinx", + "sphinx.ext.coverage", + "sphinx.ext.napoleon", + "sphinxcontrib_trio", ] intersphinx_mapping = { - "python": ('https://docs.python.org/3', None), - "trio": ('https://trio.readthedocs.io/en/stable', None), + "python": ("https://docs.python.org/3", None), + "trio": ("https://trio.readthedocs.io/en/stable", None), } autodoc_member_order = "bysource" @@ -61,15 +62,15 @@ # You can specify multiple suffix as a list of string: # # source_suffix = ['.rst', '.md'] -source_suffix = '.rst' +source_suffix = ".rst" # The master toctree document. -master_doc = 'index' +master_doc = "index" # General information about the project. -project = 'exceptiongroup' -copyright = 'The exceptiongroup authors' -author = 'The exceptiongroup authors' +project = "exceptiongroup" +copyright = "The exceptiongroup authors" +author = "The exceptiongroup authors" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -77,6 +78,7 @@ # # The short X.Y version. import exceptiongroup + version = exceptiongroup.__version__ # The full version, including alpha/beta/rc tags. release = version @@ -94,10 +96,10 @@ exclude_patterns = [] # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # The default language for :: blocks -highlight_language = 'python3' +highlight_language = "python3" # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = False @@ -108,13 +110,14 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -#html_theme = 'alabaster' +# html_theme = 'alabaster' # We have to set this ourselves, not only because it's useful for local # testing, but also because if we don't then RTD will throw away our # html_theme_options. import sphinx_rtd_theme -html_theme = 'sphinx_rtd_theme' + +html_theme = "sphinx_rtd_theme" html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] # Theme options are theme-specific and customize the look and feel of a theme @@ -134,13 +137,13 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ["_static"] # -- Options for HTMLHelp output ------------------------------------------ # Output file base name for HTML help builder. -htmlhelp_basename = 'exceptiongroupdoc' +htmlhelp_basename = "exceptiongroupdoc" # -- Options for LaTeX output --------------------------------------------- @@ -149,15 +152,12 @@ # The paper size ('letterpaper' or 'a4paper'). # # 'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). # # 'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. # # 'preamble': '', - # Latex figure (float) alignment # # 'figure_align': 'htbp', @@ -167,8 +167,7 @@ # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'exceptiongroup.tex', 'Trio Documentation', - author, 'manual'), + (master_doc, "exceptiongroup.tex", "Trio Documentation", author, "manual"), ] @@ -177,8 +176,7 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - (master_doc, 'exceptiongroup', 'exceptiongroup Documentation', - [author], 1) + (master_doc, "exceptiongroup", "exceptiongroup Documentation", [author], 1) ] @@ -188,7 +186,13 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'exceptiongroup', 'exceptiongroup Documentation', - author, 'exceptiongroup', 'A way to represent multiple things going wrong at the same time, in Python', - 'Miscellaneous'), + ( + master_doc, + "exceptiongroup", + "exceptiongroup Documentation", + author, + "exceptiongroup", + "A way to represent multiple things going wrong at the same time, in Python", + "Miscellaneous", + ), ] diff --git a/exceptiongroup/_tools.py b/exceptiongroup/_tools.py index a380334..0c2554d 100644 --- a/exceptiongroup/_tools.py +++ b/exceptiongroup/_tools.py @@ -7,7 +7,7 @@ def split(exc_type, exc, *, match=None): - """ splits the exception into one half (matched) representing all the parts of + """splits the exception into one half (matched) representing all the parts of the exception that match the predicate, and another half (not matched) representing all the parts that don't match. From 57c8629ad035eaa5bbed5ada60dcedb2cbd9f98e Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Thu, 5 Nov 2020 00:18:06 +0000 Subject: [PATCH 5/5] pin black and check more .py files --- ci/travis.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ci/travis.sh b/ci/travis.sh index 7098011..5ece58f 100755 --- a/ci/travis.sh +++ b/ci/travis.sh @@ -54,8 +54,8 @@ fi pip install -U pip setuptools wheel if [ "$CHECK_FORMATTING" = "1" ]; then - pip install black - if ! black --check --diff setup.py exceptiongroup; then + pip install black==20.8b1 + if ! black --check --diff setup.py exceptiongroup docs; then cat <