From 87adea0141ffe25e13b5409f38d6dd466af728d8 Mon Sep 17 00:00:00 2001 From: Adi Roiban Date: Mon, 21 Oct 2024 23:18:18 +0100 Subject: [PATCH 1/5] Add documentation to the dist. --- pyproject.toml | 1 - src/towncrier/newsfragments/672.doc | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 src/towncrier/newsfragments/672.doc diff --git a/pyproject.toml b/pyproject.toml index 660ae1d7..5a2dac80 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,7 +63,6 @@ Distribution = "https://pypi.org/project/towncrier" exclude = [ "admin", "bin", - "docs", ".readthedocs.yaml", "src/towncrier/newsfragments", ] diff --git a/src/towncrier/newsfragments/672.doc b/src/towncrier/newsfragments/672.doc new file mode 100644 index 00000000..d1aa14b0 --- /dev/null +++ b/src/towncrier/newsfragments/672.doc @@ -0,0 +1 @@ +The documentation RST source files are now included in the sdist package. From 1bf54861ce4fd205b6735fbd87ac53bedb400b14 Mon Sep 17 00:00:00 2001 From: Adi Roiban Date: Tue, 22 Oct 2024 10:27:16 +0100 Subject: [PATCH 2/5] Exclude git and github files from sdist. --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 5a2dac80..50d4d1ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,6 +63,10 @@ Distribution = "https://pypi.org/project/towncrier" exclude = [ "admin", "bin", + ".github", + ".git-blame-ignore-revs", + ".pre-commit-config.yaml, + ".pre-commit-hooks.yaml", ".readthedocs.yaml", "src/towncrier/newsfragments", ] From fdba418e7bfab174666f6c942b62fc430ca39fba Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 22 Oct 2024 09:27:38 +0000 Subject: [PATCH 3/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- admin/check_tag_version_match.py | 2 -- bin/towncrier | 2 -- docs/conf.py | 2 -- noxfile.py | 1 - src/towncrier/__main__.py | 1 - src/towncrier/_builder.py | 4 ++-- src/towncrier/_git.py | 1 - src/towncrier/_project.py | 1 - src/towncrier/_settings/__init__.py | 1 - src/towncrier/_settings/fragment_types.py | 1 - src/towncrier/_settings/load.py | 2 -- src/towncrier/_writer.py | 2 -- src/towncrier/build.py | 6 ++---- src/towncrier/check.py | 1 - src/towncrier/click_default_group.py | 1 - src/towncrier/create.py | 2 -- src/towncrier/test/helpers.py | 2 -- src/towncrier/test/test_build.py | 4 ++-- src/towncrier/test/test_check.py | 1 - src/towncrier/test/test_create.py | 1 - src/towncrier/test/test_project.py | 2 -- src/towncrier/test/test_write.py | 1 - 22 files changed, 6 insertions(+), 35 deletions(-) diff --git a/admin/check_tag_version_match.py b/admin/check_tag_version_match.py index 25ae1809..6ee1c83d 100644 --- a/admin/check_tag_version_match.py +++ b/admin/check_tag_version_match.py @@ -9,10 +9,8 @@ # import sys - from importlib import metadata - TAG_PREFIX = "refs/tags/" if len(sys.argv) < 2: diff --git a/bin/towncrier b/bin/towncrier index a5604922..30c43f33 100755 --- a/bin/towncrier +++ b/bin/towncrier @@ -4,11 +4,9 @@ import os.path import sys - srcdir = os.path.join(os.path.dirname(__file__), "..", "src") sys.path.insert(0, srcdir) import towncrier - towncrier._main() diff --git a/docs/conf.py b/docs/conf.py index f98d50c8..6a6f34a7 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -30,11 +30,9 @@ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. import os - from datetime import date from importlib.metadata import version - towncrier_version = version("towncrier") diff --git a/noxfile.py b/noxfile.py index e7a4bafe..628f7971 100644 --- a/noxfile.py +++ b/noxfile.py @@ -4,7 +4,6 @@ import nox - nox.options.sessions = ["pre_commit", "docs", "typecheck", "tests"] nox.options.reuse_existing_virtualenvs = True nox.options.error_on_external_run = True diff --git a/src/towncrier/__main__.py b/src/towncrier/__main__.py index cf8d9378..49481253 100644 --- a/src/towncrier/__main__.py +++ b/src/towncrier/__main__.py @@ -2,5 +2,4 @@ from towncrier._shell import cli - cli() diff --git a/src/towncrier/_builder.py b/src/towncrier/_builder.py index dca09da6..d6444ca8 100644 --- a/src/towncrier/_builder.py +++ b/src/towncrier/_builder.py @@ -7,11 +7,11 @@ import os import re import textwrap - from collections import defaultdict from fnmatch import fnmatch from pathlib import Path -from typing import Any, DefaultDict, Iterable, Iterator, Mapping, NamedTuple, Sequence +from typing import (Any, DefaultDict, Iterable, Iterator, Mapping, NamedTuple, + Sequence) from click import ClickException from jinja2 import Template diff --git a/src/towncrier/_git.py b/src/towncrier/_git.py index ff3d5448..48f69afb 100644 --- a/src/towncrier/_git.py +++ b/src/towncrier/_git.py @@ -4,7 +4,6 @@ from __future__ import annotations import os - from subprocess import STDOUT, CalledProcessError, call, check_output diff --git a/src/towncrier/_project.py b/src/towncrier/_project.py index c09b1467..dadea663 100644 --- a/src/towncrier/_project.py +++ b/src/towncrier/_project.py @@ -10,7 +10,6 @@ import contextlib import importlib.metadata import sys - from importlib import import_module from importlib.metadata import PackageNotFoundError from types import ModuleType diff --git a/src/towncrier/_settings/__init__.py b/src/towncrier/_settings/__init__.py index 0f25f2f4..645d820b 100644 --- a/src/towncrier/_settings/__init__.py +++ b/src/towncrier/_settings/__init__.py @@ -4,7 +4,6 @@ from towncrier._settings import load - load_config = load.load_config ConfigError = load.ConfigError load_config_from_options = load.load_config_from_options diff --git a/src/towncrier/_settings/fragment_types.py b/src/towncrier/_settings/fragment_types.py index bb1313be..52f4946e 100644 --- a/src/towncrier/_settings/fragment_types.py +++ b/src/towncrier/_settings/fragment_types.py @@ -1,7 +1,6 @@ from __future__ import annotations import abc - from typing import Any, Iterable, Mapping diff --git a/src/towncrier/_settings/load.py b/src/towncrier/_settings/load.py index c54f9798..3227bf2f 100644 --- a/src/towncrier/_settings/load.py +++ b/src/towncrier/_settings/load.py @@ -8,7 +8,6 @@ import os import re import sys - from contextlib import ExitStack from pathlib import Path from typing import Any, Literal, Mapping, Sequence @@ -17,7 +16,6 @@ from .._settings import fragment_types as ft - if sys.version_info < (3, 10): import importlib_resources as resources else: diff --git a/src/towncrier/_writer.py b/src/towncrier/_writer.py index 634b5f19..32197b00 100644 --- a/src/towncrier/_writer.py +++ b/src/towncrier/_writer.py @@ -9,11 +9,9 @@ from __future__ import annotations import sys - from pathlib import Path from typing import Any - if sys.version_info < (3, 10): # Compatibility shim for newline parameter to write_text, added in 3.10 def _newline_write_text(path: Path, content: str, **kwargs: Any) -> None: diff --git a/src/towncrier/build.py b/src/towncrier/build.py index 3d183925..66126fff 100644 --- a/src/towncrier/build.py +++ b/src/towncrier/build.py @@ -9,22 +9,20 @@ import os import sys - from datetime import date from pathlib import Path import click - from click import Context, Option, UsageError from towncrier import _git from ._builder import find_fragments, render_fragments, split_fragments from ._project import get_project_name, get_version -from ._settings import ConfigError, config_option_help, load_config_from_options +from ._settings import (ConfigError, config_option_help, + load_config_from_options) from ._writer import append_to_newsfile - if sys.version_info < (3, 10): import importlib_resources as resources else: diff --git a/src/towncrier/check.py b/src/towncrier/check.py index 8b057545..94bcd85f 100644 --- a/src/towncrier/check.py +++ b/src/towncrier/check.py @@ -6,7 +6,6 @@ import os import sys - from subprocess import CalledProcessError from typing import Container from warnings import warn diff --git a/src/towncrier/click_default_group.py b/src/towncrier/click_default_group.py index 6d5e69bd..217adeb5 100644 --- a/src/towncrier/click_default_group.py +++ b/src/towncrier/click_default_group.py @@ -56,7 +56,6 @@ def bar(): import click - __all__ = ["DefaultGroup"] __version__ = "1.2.2" diff --git a/src/towncrier/create.py b/src/towncrier/create.py index e78fb658..cd81753c 100644 --- a/src/towncrier/create.py +++ b/src/towncrier/create.py @@ -8,7 +8,6 @@ from __future__ import annotations import os - from pathlib import Path from typing import cast @@ -17,7 +16,6 @@ from ._builder import FragmentsPath from ._settings import config_option_help, load_config_from_options - DEFAULT_CONTENT = "Add your info here" diff --git a/src/towncrier/test/helpers.py b/src/towncrier/test/helpers.py index 77cea36d..bb1db9f4 100644 --- a/src/towncrier/test/helpers.py +++ b/src/towncrier/test/helpers.py @@ -2,7 +2,6 @@ import sys import textwrap - from functools import wraps from pathlib import Path from subprocess import call @@ -10,7 +9,6 @@ from click.testing import CliRunner - if sys.version_info < (3, 9): import importlib_resources as resources else: diff --git a/src/towncrier/test/test_build.py b/src/towncrier/test/test_build.py index 0092d495..c518eadf 100644 --- a/src/towncrier/test/test_build.py +++ b/src/towncrier/test/test_build.py @@ -3,7 +3,6 @@ import os import tempfile - from datetime import date from pathlib import Path from subprocess import call @@ -15,7 +14,8 @@ from .._shell import cli from ..build import _main -from .helpers import read, read_pkg_resource, with_git_project, with_project, write +from .helpers import (read, read_pkg_resource, with_git_project, with_project, + write) class TestCli(TestCase): diff --git a/src/towncrier/test/test_check.py b/src/towncrier/test/test_check.py index 9d8c05aa..e79b9d85 100644 --- a/src/towncrier/test/test_check.py +++ b/src/towncrier/test/test_check.py @@ -4,7 +4,6 @@ import os import os.path import warnings - from pathlib import Path from subprocess import call diff --git a/src/towncrier/test/test_create.py b/src/towncrier/test/test_create.py index dc6f6b9d..10f3e4e9 100644 --- a/src/towncrier/test/test_create.py +++ b/src/towncrier/test/test_create.py @@ -3,7 +3,6 @@ import os import string - from pathlib import Path from textwrap import dedent from unittest import mock diff --git a/src/towncrier/test/test_project.py b/src/towncrier/test/test_project.py index a93ef190..452de71d 100644 --- a/src/towncrier/test/test_project.py +++ b/src/towncrier/test/test_project.py @@ -3,7 +3,6 @@ import os import sys - from importlib.metadata import version as metadata_version from click.testing import CliRunner @@ -13,7 +12,6 @@ from .._shell import cli as towncrier_cli from .helpers import write - towncrier_cli.name = "towncrier" diff --git a/src/towncrier/test/test_write.py b/src/towncrier/test/test_write.py index 563fde6f..16cad718 100644 --- a/src/towncrier/test/test_write.py +++ b/src/towncrier/test/test_write.py @@ -2,7 +2,6 @@ # See LICENSE for details. import os - from pathlib import Path from textwrap import dedent From c1e03b5f0be5891412ac5ebeeb61733e6e1eed96 Mon Sep 17 00:00:00 2001 From: Adi Roiban Date: Wed, 30 Oct 2024 10:42:01 +0000 Subject: [PATCH 4/5] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 50d4d1ca..56bfc33f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,7 +65,7 @@ exclude = [ "bin", ".github", ".git-blame-ignore-revs", - ".pre-commit-config.yaml, + ".pre-commit-config.yaml", ".pre-commit-hooks.yaml", ".readthedocs.yaml", "src/towncrier/newsfragments", From 28d9e08128d96f3a0ae7bfc10ce16fc43e11c41e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 30 Oct 2024 10:42:09 +0000 Subject: [PATCH 5/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- admin/check_tag_version_match.py | 2 ++ bin/towncrier | 2 ++ docs/conf.py | 2 ++ noxfile.py | 1 + src/towncrier/__main__.py | 1 + src/towncrier/_builder.py | 4 ++-- src/towncrier/_git.py | 1 + src/towncrier/_project.py | 1 + src/towncrier/_settings/__init__.py | 1 + src/towncrier/_settings/fragment_types.py | 1 + src/towncrier/_settings/load.py | 2 ++ src/towncrier/_writer.py | 2 ++ src/towncrier/build.py | 6 ++++-- src/towncrier/check.py | 1 + src/towncrier/click_default_group.py | 1 + src/towncrier/create.py | 2 ++ src/towncrier/test/helpers.py | 2 ++ src/towncrier/test/test_build.py | 4 ++-- src/towncrier/test/test_check.py | 1 + src/towncrier/test/test_create.py | 1 + src/towncrier/test/test_project.py | 2 ++ src/towncrier/test/test_write.py | 1 + 22 files changed, 35 insertions(+), 6 deletions(-) diff --git a/admin/check_tag_version_match.py b/admin/check_tag_version_match.py index 6ee1c83d..25ae1809 100644 --- a/admin/check_tag_version_match.py +++ b/admin/check_tag_version_match.py @@ -9,8 +9,10 @@ # import sys + from importlib import metadata + TAG_PREFIX = "refs/tags/" if len(sys.argv) < 2: diff --git a/bin/towncrier b/bin/towncrier index 30c43f33..a5604922 100755 --- a/bin/towncrier +++ b/bin/towncrier @@ -4,9 +4,11 @@ import os.path import sys + srcdir = os.path.join(os.path.dirname(__file__), "..", "src") sys.path.insert(0, srcdir) import towncrier + towncrier._main() diff --git a/docs/conf.py b/docs/conf.py index 6a6f34a7..f98d50c8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -30,9 +30,11 @@ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. import os + from datetime import date from importlib.metadata import version + towncrier_version = version("towncrier") diff --git a/noxfile.py b/noxfile.py index 628f7971..e7a4bafe 100644 --- a/noxfile.py +++ b/noxfile.py @@ -4,6 +4,7 @@ import nox + nox.options.sessions = ["pre_commit", "docs", "typecheck", "tests"] nox.options.reuse_existing_virtualenvs = True nox.options.error_on_external_run = True diff --git a/src/towncrier/__main__.py b/src/towncrier/__main__.py index 49481253..cf8d9378 100644 --- a/src/towncrier/__main__.py +++ b/src/towncrier/__main__.py @@ -2,4 +2,5 @@ from towncrier._shell import cli + cli() diff --git a/src/towncrier/_builder.py b/src/towncrier/_builder.py index d6444ca8..dca09da6 100644 --- a/src/towncrier/_builder.py +++ b/src/towncrier/_builder.py @@ -7,11 +7,11 @@ import os import re import textwrap + from collections import defaultdict from fnmatch import fnmatch from pathlib import Path -from typing import (Any, DefaultDict, Iterable, Iterator, Mapping, NamedTuple, - Sequence) +from typing import Any, DefaultDict, Iterable, Iterator, Mapping, NamedTuple, Sequence from click import ClickException from jinja2 import Template diff --git a/src/towncrier/_git.py b/src/towncrier/_git.py index 48f69afb..ff3d5448 100644 --- a/src/towncrier/_git.py +++ b/src/towncrier/_git.py @@ -4,6 +4,7 @@ from __future__ import annotations import os + from subprocess import STDOUT, CalledProcessError, call, check_output diff --git a/src/towncrier/_project.py b/src/towncrier/_project.py index dadea663..c09b1467 100644 --- a/src/towncrier/_project.py +++ b/src/towncrier/_project.py @@ -10,6 +10,7 @@ import contextlib import importlib.metadata import sys + from importlib import import_module from importlib.metadata import PackageNotFoundError from types import ModuleType diff --git a/src/towncrier/_settings/__init__.py b/src/towncrier/_settings/__init__.py index 645d820b..0f25f2f4 100644 --- a/src/towncrier/_settings/__init__.py +++ b/src/towncrier/_settings/__init__.py @@ -4,6 +4,7 @@ from towncrier._settings import load + load_config = load.load_config ConfigError = load.ConfigError load_config_from_options = load.load_config_from_options diff --git a/src/towncrier/_settings/fragment_types.py b/src/towncrier/_settings/fragment_types.py index 52f4946e..bb1313be 100644 --- a/src/towncrier/_settings/fragment_types.py +++ b/src/towncrier/_settings/fragment_types.py @@ -1,6 +1,7 @@ from __future__ import annotations import abc + from typing import Any, Iterable, Mapping diff --git a/src/towncrier/_settings/load.py b/src/towncrier/_settings/load.py index 3227bf2f..c54f9798 100644 --- a/src/towncrier/_settings/load.py +++ b/src/towncrier/_settings/load.py @@ -8,6 +8,7 @@ import os import re import sys + from contextlib import ExitStack from pathlib import Path from typing import Any, Literal, Mapping, Sequence @@ -16,6 +17,7 @@ from .._settings import fragment_types as ft + if sys.version_info < (3, 10): import importlib_resources as resources else: diff --git a/src/towncrier/_writer.py b/src/towncrier/_writer.py index 32197b00..634b5f19 100644 --- a/src/towncrier/_writer.py +++ b/src/towncrier/_writer.py @@ -9,9 +9,11 @@ from __future__ import annotations import sys + from pathlib import Path from typing import Any + if sys.version_info < (3, 10): # Compatibility shim for newline parameter to write_text, added in 3.10 def _newline_write_text(path: Path, content: str, **kwargs: Any) -> None: diff --git a/src/towncrier/build.py b/src/towncrier/build.py index 66126fff..3d183925 100644 --- a/src/towncrier/build.py +++ b/src/towncrier/build.py @@ -9,20 +9,22 @@ import os import sys + from datetime import date from pathlib import Path import click + from click import Context, Option, UsageError from towncrier import _git from ._builder import find_fragments, render_fragments, split_fragments from ._project import get_project_name, get_version -from ._settings import (ConfigError, config_option_help, - load_config_from_options) +from ._settings import ConfigError, config_option_help, load_config_from_options from ._writer import append_to_newsfile + if sys.version_info < (3, 10): import importlib_resources as resources else: diff --git a/src/towncrier/check.py b/src/towncrier/check.py index 94bcd85f..8b057545 100644 --- a/src/towncrier/check.py +++ b/src/towncrier/check.py @@ -6,6 +6,7 @@ import os import sys + from subprocess import CalledProcessError from typing import Container from warnings import warn diff --git a/src/towncrier/click_default_group.py b/src/towncrier/click_default_group.py index 217adeb5..6d5e69bd 100644 --- a/src/towncrier/click_default_group.py +++ b/src/towncrier/click_default_group.py @@ -56,6 +56,7 @@ def bar(): import click + __all__ = ["DefaultGroup"] __version__ = "1.2.2" diff --git a/src/towncrier/create.py b/src/towncrier/create.py index cd81753c..e78fb658 100644 --- a/src/towncrier/create.py +++ b/src/towncrier/create.py @@ -8,6 +8,7 @@ from __future__ import annotations import os + from pathlib import Path from typing import cast @@ -16,6 +17,7 @@ from ._builder import FragmentsPath from ._settings import config_option_help, load_config_from_options + DEFAULT_CONTENT = "Add your info here" diff --git a/src/towncrier/test/helpers.py b/src/towncrier/test/helpers.py index bb1db9f4..77cea36d 100644 --- a/src/towncrier/test/helpers.py +++ b/src/towncrier/test/helpers.py @@ -2,6 +2,7 @@ import sys import textwrap + from functools import wraps from pathlib import Path from subprocess import call @@ -9,6 +10,7 @@ from click.testing import CliRunner + if sys.version_info < (3, 9): import importlib_resources as resources else: diff --git a/src/towncrier/test/test_build.py b/src/towncrier/test/test_build.py index c518eadf..0092d495 100644 --- a/src/towncrier/test/test_build.py +++ b/src/towncrier/test/test_build.py @@ -3,6 +3,7 @@ import os import tempfile + from datetime import date from pathlib import Path from subprocess import call @@ -14,8 +15,7 @@ from .._shell import cli from ..build import _main -from .helpers import (read, read_pkg_resource, with_git_project, with_project, - write) +from .helpers import read, read_pkg_resource, with_git_project, with_project, write class TestCli(TestCase): diff --git a/src/towncrier/test/test_check.py b/src/towncrier/test/test_check.py index e79b9d85..9d8c05aa 100644 --- a/src/towncrier/test/test_check.py +++ b/src/towncrier/test/test_check.py @@ -4,6 +4,7 @@ import os import os.path import warnings + from pathlib import Path from subprocess import call diff --git a/src/towncrier/test/test_create.py b/src/towncrier/test/test_create.py index 10f3e4e9..dc6f6b9d 100644 --- a/src/towncrier/test/test_create.py +++ b/src/towncrier/test/test_create.py @@ -3,6 +3,7 @@ import os import string + from pathlib import Path from textwrap import dedent from unittest import mock diff --git a/src/towncrier/test/test_project.py b/src/towncrier/test/test_project.py index 452de71d..a93ef190 100644 --- a/src/towncrier/test/test_project.py +++ b/src/towncrier/test/test_project.py @@ -3,6 +3,7 @@ import os import sys + from importlib.metadata import version as metadata_version from click.testing import CliRunner @@ -12,6 +13,7 @@ from .._shell import cli as towncrier_cli from .helpers import write + towncrier_cli.name = "towncrier" diff --git a/src/towncrier/test/test_write.py b/src/towncrier/test/test_write.py index 16cad718..563fde6f 100644 --- a/src/towncrier/test/test_write.py +++ b/src/towncrier/test/test_write.py @@ -2,6 +2,7 @@ # See LICENSE for details. import os + from pathlib import Path from textwrap import dedent