Skip to content

Commit

Permalink
Merge pull request #378 from hynek/drop-ballast
Browse files Browse the repository at this point in the history
Drop Python versions that are unsupported by core team
  • Loading branch information
adiroiban authored Apr 8, 2022
2 parents e890c4d + c42a6f0 commit aead491
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 49 deletions.
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ source =
.tox/pypy*/site-packages/

[report]
show_missing = true
skip_covered = true
omit =
src/towncrier/__main__.py
src/towncrier/test/*
11 changes: 1 addition & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,9 @@ jobs:
runs-on: ubuntu-latest
- name: macOS
runs-on: macos-latest
- name: Windows
- name: Win
runs-on: windows-latest
python:
- name: CPython 2.7
tox: py27
action: 2.7
- name: CPython 3.5
tox: py35
action: 3.5
- name: CPython 3.7
tox: py37
action: 3.7
Expand All @@ -85,9 +79,6 @@ jobs:
- name: CPython 3.10
tox: py310
action: '3.10'
- name: PyPy 2.7
tox: pypy27
action: pypy-2.7
- name: PyPy 3.7
tox: pypy37
action: pypy-3.7
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ Install from PyPI::

.. note::

``towncrier``, as a command line tool, works on Python 2.7 and 3.5+ only.
``towncrier``, as a command line tool, works on Python 3.7+ only.
It is usable by projects written in other languages, provided you specify the project version either in the configuration file or on the command line.
For Python 2/3 compatible projects, the version can be discovered automatically.
For Python-compatible projects, the version can be discovered automatically.

In your project root, add a ``towncrier.toml`` or a ``pyproject.toml`` file (if both files exist, the first will take precedence).
You can configure your project in two ways.
Expand Down Expand Up @@ -75,7 +75,7 @@ Using the above example, your news fragments would be ``src/myproject/newsfragme

``towncrier`` needs to know what version your project is, and there are three ways you can give it:

- For Python 2/3 compatible projects, a ``__version__`` in the top level package.
- For Python-compatible projects, a ``__version__`` in the top level package.
This can be either a string literal, a tuple, or an `Incremental <https://github.com/hawkowl/incremental>`_ version.

- Manually passing ``--version=<myversionhere>`` when interacting with ``towncrier``.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@


[tool.black]
target-version = ['py27']
target-version = ['py37']
exclude = '''
(
Expand Down
9 changes: 3 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,23 @@
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"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",
],
use_incremental=True,
python_requires=">=3.7",
install_requires=[
"click",
"click-default-group",
"incremental",
"jinja2",
"setuptools",
"toml; python_version < '3.6'",
"tomli; python_version >= '3.6'",
"tomli",
],
extras_require={"dev": ["packaging"]},
package_dir={"": "src"},
Expand Down
8 changes: 1 addition & 7 deletions src/towncrier/_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from __future__ import absolute_import, division, print_function

import os
import sys
import textwrap
import traceback

Expand Down Expand Up @@ -90,14 +89,9 @@ def find_fragments(base_directory, sections, fragment_directory, definitions):
else:
section_dir = os.path.join(base_directory, val)

if sys.version_info >= (3,):
expected_exception = FileNotFoundError
else:
expected_exception = OSError

try:
files = os.listdir(section_dir)
except expected_exception as e:
except FileNotFoundError as e:
message = "Failed to list the news fragment files.\n{}".format(
''.join(traceback.format_exception_only(type(e), e)),
)
Expand Down
15 changes: 3 additions & 12 deletions src/towncrier/_settings/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,9 @@

import io
import os
import sys
import pkg_resources

if sys.version_info >= (3, 6):
import tomli
else:
tomli = None
import toml
import tomli

from collections import OrderedDict
from .._settings import fragment_types as ft
Expand Down Expand Up @@ -67,12 +62,8 @@ def load_config(directory):


def load_config_from_file(directory, config_file):
if tomli:
with io.open(config_file, "rb") as conffile:
config = tomli.load(conffile)
else:
with io.open(config_file, "r", encoding="utf8", newline="") as conffile:
config = toml.load(conffile)
with io.open(config_file, "rb") as conffile:
config = tomli.load(conffile)

return parse_toml(directory, config)

Expand Down
4 changes: 1 addition & 3 deletions src/towncrier/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ def __main(comparewith, directory, config):
# Use UTF-8 both when sys.stdout does not have .encoding (Python 2.7) and
# when the attribute is present but set to None (explicitly piped output
# and also some CI such as GitHub Actions).
encoding = getattr(sys.stdout, "encoding", None)
if encoding is None:
encoding = "utf8"
encoding = getattr(sys.stdout, "encoding", "utf8")

try:
files_changed = (
Expand Down
1 change: 1 addition & 0 deletions src/towncrier/newsfragments/378.removal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support for all Python versions older than 3.7 has been dropped.
7 changes: 1 addition & 6 deletions src/towncrier/test/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,7 @@ def test_import_fails(self):
"""
An exception is raised when getting the version failed due to missing Python package files.
"""
if sys.version_info >= (3, 6):
expected_exception = ModuleNotFoundError
else:
expected_exception = ImportError

with self.assertRaises(expected_exception):
with self.assertRaises(ModuleNotFoundError):
get_version(".", "projectname_without_any_files")

def test_already_installed_import(self):
Expand Down
7 changes: 6 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = cov-erase, flake8, {pypy27,pypy37,pypy38,py27,py35,py36,py37,py38,py39,py310}-{tests,flake8,check-manifest,check-newsfragment}, cov-report
envlist = cov-erase, flake8, {pypy37,pypy38,py37,py38,py39,py310}-tests, flake8, check-manifest, check-newsfragment, cov-report
isolated_build=true
skip_missing_envs = true

Expand All @@ -14,6 +14,11 @@ commands =
commands =
python -m towncrier.check

[testenv:check-manifest]
deps = check-manifest
skip_install = true
commands = check-manifest

[testenv]
deps =
Twisted
Expand Down

0 comments on commit aead491

Please sign in to comment.