diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 000000000..6b26875f1 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1 @@ +1d7b1abd152e4cb5e6a46e52e6b7e3bf8d366486 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4c70a3f63..88494c690 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: check-added-large-files - id: check-case-conflict @@ -31,3 +31,9 @@ repos: - id: rst-backticks - id: rst-directive-colons - id: rst-inline-touching-normal + +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.1.4 + hooks: + - id: ruff + - id: ruff-format diff --git a/noxfile.py b/noxfile.py index 23dcb977f..698e82f9d 100644 --- a/noxfile.py +++ b/noxfile.py @@ -3,7 +3,6 @@ # Attribution-ShareAlike license: # http://creativecommons.org/licenses/by-sa/3.0. -import shutil import nox @@ -19,10 +18,12 @@ def translation(session): target_dir = "locales" session.run( "sphinx-build", - "-b", "gettext", # build gettext-style message catalogs (.pot file) - "-d", session.cache_dir / ".doctrees", # path to put the cache + "-b", + "gettext", # build gettext-style message catalogs (.pot file) + "-d", + session.cache_dir / ".doctrees", # path to put the cache "source/", # where the rst files are located - target_dir, # where to put the .pot file + target_dir, # where to put the .pot file ) @@ -45,10 +46,14 @@ def build(session, autobuild=False): ) session.run( - command, *extra_args, - "-j", "auto", # parallelize the build - "-b", "html", # use HTML builder - "-d", session.cache_dir / ".doctrees", # path to put the cache + command, + *extra_args, + "-j", + "auto", # parallelize the build + "-b", + "html", # use HTML builder + "-d", + session.cache_dir / ".doctrees", # path to put the cache "-n", # nitpicky warn about all missing references "-W", # Treat warnings as errors. *session.posargs, @@ -74,12 +79,16 @@ def linkcheck(session): session.install("-r", "requirements.txt") session.run( "sphinx-build", - "-b", "linkcheck", # use linkcheck builder - "-d", session.cache_dir / ".doctrees", # path to put the cache + "-b", + "linkcheck", # use linkcheck builder + "-d", + session.cache_dir / ".doctrees", # path to put the cache "--color", - "-n", "-W", "--keep-going", # be strict - "source", # where the rst files are located - "build", # where to put the check output + "-n", + "-W", + "--keep-going", # be strict + "source", # where the rst files are located + "build", # where to put the check output ) diff --git a/source/conf.py b/source/conf.py index b3e4d1bd3..64b99d0b2 100644 --- a/source/conf.py +++ b/source/conf.py @@ -31,12 +31,12 @@ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ - 'sphinx.ext.extlinks', - 'sphinx.ext.intersphinx', - 'sphinx.ext.todo', - 'sphinx_inline_tabs', - 'sphinx_copybutton', - 'sphinx_toolbox.collapse', + "sphinx.ext.extlinks", + "sphinx.ext.intersphinx", + "sphinx.ext.todo", + "sphinx_inline_tabs", + "sphinx_copybutton", + "sphinx_toolbox.collapse", ] # config for copy button @@ -44,53 +44,53 @@ copybutton_prompt_is_regexp = True # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # # source_suffix = ['.rst', '.md'] -source_suffix = '.rst' +source_suffix = ".rst" # The encoding of source files. # # source_encoding = 'utf-8-sig' # The master toctree document. -master_doc = 'index' +master_doc = "index" # -- Project information ----------------------------------------------------- -github_url = 'https://github.com' -github_repo_org = 'pypa' -github_repo_name = 'packaging.python.org' -github_repo_slug = f'{github_repo_org}/{github_repo_name}' -github_repo_url = f'{github_url}/{github_repo_slug}' -github_repo_issues_url = f'{github_url}/{github_repo_slug}/issues' -github_sponsors_url = f'{github_url}/sponsors' +github_url = "https://github.com" +github_repo_org = "pypa" +github_repo_name = "packaging.python.org" +github_repo_slug = f"{github_repo_org}/{github_repo_name}" +github_repo_url = f"{github_url}/{github_repo_slug}" +github_repo_issues_url = f"{github_url}/{github_repo_slug}/issues" +github_sponsors_url = f"{github_url}/sponsors" # General information about the project. -project = u'Python Packaging User Guide' -copyright = u'2013–2020, PyPA' -author = 'Python Packaging Authority' +project = "Python Packaging User Guide" +copyright = "2013–2020, PyPA" +author = "Python Packaging Authority" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = '' +version = "" # The full version, including alpha/beta/rc tags. -release = '' +release = "" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = 'en' +language = "en" -locale_dirs = ['../locales'] +locale_dirs = ["../locales"] gettext_auto_build = True # Build MO files from PO on each build @@ -111,12 +111,12 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This patterns also effect to html_static_path and html_extra_path -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] # The reST default role (used for this markup: `text`) to use for all # documents. # Ref: python-attrs/attrs#571 -default_role = 'any' # makes single backticks autofind targets +default_role = "any" # makes single backticks autofind targets # If true, '()' will be appended to :func: etc. cross-reference text. # @@ -133,7 +133,7 @@ # show_authors = False # The name of the Pygments (syntax highlighting) style to use. -#pygments_style = 'sphinx' +# pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] @@ -150,7 +150,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'furo' +html_theme = "furo" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -166,7 +166,7 @@ # The name for this set of Sphinx documents. # " v documentation" by default. # -html_title = 'Python Packaging User Guide' +html_title = "Python Packaging User Guide" # A shorter title for the navigation bar. Default is the same as html_title. # @@ -181,7 +181,7 @@ # the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. # -html_favicon = 'assets/py.png' +html_favicon = "assets/py.png" # 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, @@ -198,7 +198,7 @@ # bottom, using the given strftime format. # The empty string is equivalent to '%b %d, %Y'. # -html_last_updated_fmt = '' +html_last_updated_fmt = "" # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. @@ -271,34 +271,36 @@ # html_search_scorer = 'scorer.js' # Output file base name for HTML help builder. -htmlhelp_basename = 'pythonpackagingguide-authdoc' +htmlhelp_basename = "pythonpackagingguide-authdoc" # -- Options for LaTeX output --------------------------------------------- latex_elements = { - # 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', + # 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', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'pythonpackagingguide.tex', 'Python Packaging User Guide', - 'Python Packaging Authority', 'manual'), + ( + master_doc, + "pythonpackagingguide.tex", + "Python Packaging User Guide", + "Python Packaging Authority", + "manual", + ), ] # The name of an image file (relative to this directory) to place at the top of @@ -339,8 +341,7 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - (master_doc, 'pythonpackagingguide', 'Python Packaging User Guide', - [author], 1) + (master_doc, "pythonpackagingguide", "Python Packaging User Guide", [author], 1) ] # If true, show URL addresses after external links. @@ -354,9 +355,15 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'pythonpackagingguide', 'Python Packaging User Guide', - author, 'pythonpackagingguide', 'One line description of project.', - 'Miscellaneous'), + ( + master_doc, + "pythonpackagingguide", + "Python Packaging User Guide", + author, + "pythonpackagingguide", + "One line description of project.", + "Miscellaneous", + ), ] # Documents to append as an appendix to all manuals. @@ -377,11 +384,11 @@ # -- Options for extlinks extension --------------------------------------- extlinks = { - 'issue': (f'{github_repo_issues_url}/%s', '#%s'), # noqa: WPS323 - 'pr': (f'{github_repo_url}/pull/%s', 'PR #%s'), # noqa: WPS323 - 'commit': (f'{github_repo_url}/commit/%s', '%s'), # noqa: WPS323 - 'gh': (f'{github_url}/%s', 'GitHub: %s'), # noqa: WPS323 - 'user': (f'{github_sponsors_url}/%s', '@%s'), # noqa: WPS323 + "issue": (f"{github_repo_issues_url}/%s", "#%s"), # noqa: WPS323 + "pr": (f"{github_repo_url}/pull/%s", "PR #%s"), # noqa: WPS323 + "commit": (f"{github_repo_url}/commit/%s", "%s"), # noqa: WPS323 + "gh": (f"{github_url}/%s", "GitHub: %s"), # noqa: WPS323 + "user": (f"{github_sponsors_url}/%s", "@%s"), # noqa: WPS323 } linkcheck_ignore = [ @@ -395,33 +402,33 @@ # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = { - 'boltons': ('https://boltons.readthedocs.io/en/latest/', None), - 'bottle': ('https://bottlepy.org/docs/dev/', None), - 'build': ('https://pypa-build.readthedocs.io/en/stable/', None), - 'cffi': ('https://cffi.readthedocs.io/en/latest/', None), - 'conda': ('https://conda.io/en/latest/', None), - 'devpi': ('https://devpi.net/docs/devpi/devpi/latest/+doc', None), - 'dh-virtualenv': ('https://dh-virtualenv.readthedocs.io/en/latest/', None), - 'distlib': ('https://distlib.readthedocs.io/en/latest/', None), - 'flexx': ('https://flexx.readthedocs.io/en/latest/', None), - 'nox': ('https://nox.thea.codes/en/latest/', None), - 'openstack': ('https://docs.openstack.org/glance/latest/', None), - 'packaging': ('https://packaging.pypa.io/en/latest/', None), - 'packaging.python.org': ('https://packaging.python.org/en/latest/', None), - 'pip': ('https://pip.pypa.io/en/latest/', None), - 'pipenv': ('https://pipenv.pypa.io/en/latest/', None), - 'piwheels': ('https://piwheels.readthedocs.io/en/latest/', None), - 'pybind11': ('https://pybind11.readthedocs.io/en/stable/', None), - 'pynsist': ('https://pynsist.readthedocs.io/en/latest/', None), - 'pypa': ('https://www.pypa.io/en/latest/', None), - 'python': ('https://docs.python.org/3', None), - 'python-guide': ('https://docs.python-guide.org', None), - 'setuptools': ('https://setuptools.pypa.io/en/latest/', None), - 'spack': ('https://spack.readthedocs.io/en/latest/', None), - 'sphinx': ('https://www.sphinx-doc.org/en/master', None), - 'tox': ('https://tox.wiki/en/latest/', None), - 'twine': ('https://twine.readthedocs.io/en/stable/', None), - 'virtualenv': ('https://virtualenv.pypa.io/en/stable/', None), + "boltons": ("https://boltons.readthedocs.io/en/latest/", None), + "bottle": ("https://bottlepy.org/docs/dev/", None), + "build": ("https://pypa-build.readthedocs.io/en/stable/", None), + "cffi": ("https://cffi.readthedocs.io/en/latest/", None), + "conda": ("https://conda.io/en/latest/", None), + "devpi": ("https://devpi.net/docs/devpi/devpi/latest/+doc", None), + "dh-virtualenv": ("https://dh-virtualenv.readthedocs.io/en/latest/", None), + "distlib": ("https://distlib.readthedocs.io/en/latest/", None), + "flexx": ("https://flexx.readthedocs.io/en/latest/", None), + "nox": ("https://nox.thea.codes/en/latest/", None), + "openstack": ("https://docs.openstack.org/glance/latest/", None), + "packaging": ("https://packaging.pypa.io/en/latest/", None), + "packaging.python.org": ("https://packaging.python.org/en/latest/", None), + "pip": ("https://pip.pypa.io/en/latest/", None), + "pipenv": ("https://pipenv.pypa.io/en/latest/", None), + "piwheels": ("https://piwheels.readthedocs.io/en/latest/", None), + "pybind11": ("https://pybind11.readthedocs.io/en/stable/", None), + "pynsist": ("https://pynsist.readthedocs.io/en/latest/", None), + "pypa": ("https://www.pypa.io/en/latest/", None), + "python": ("https://docs.python.org/3", None), + "python-guide": ("https://docs.python-guide.org", None), + "setuptools": ("https://setuptools.pypa.io/en/latest/", None), + "spack": ("https://spack.readthedocs.io/en/latest/", None), + "sphinx": ("https://www.sphinx-doc.org/en/master", None), + "tox": ("https://tox.wiki/en/latest/", None), + "twine": ("https://twine.readthedocs.io/en/stable/", None), + "virtualenv": ("https://virtualenv.pypa.io/en/stable/", None), } @@ -435,12 +442,12 @@ # NOTE: consider having a separate ignore file # Ref: https://stackoverflow.com/a/30624034/595220 nitpick_ignore = [ - ('envvar', 'PATH'), - ('py:func', 'find_packages'), - ('py:func', 'setup'), - ('py:func', 'importlib.metadata.entry_points'), # remove when 3.10 is released - ('py:class', 'importlib.metadata.EntryPoint'), # remove when 3.10 is released - ('py:func', 'setuptools.find_namespace_packages'), - ('py:func', 'setuptools.find_packages'), - ('py:func', 'setuptools.setup'), + ("envvar", "PATH"), + ("py:func", "find_packages"), + ("py:func", "setup"), + ("py:func", "importlib.metadata.entry_points"), # remove when 3.10 is released + ("py:class", "importlib.metadata.EntryPoint"), # remove when 3.10 is released + ("py:func", "setuptools.find_namespace_packages"), + ("py:func", "setuptools.find_packages"), + ("py:func", "setuptools.setup"), ]