Skip to content

Commit ad6317e

Browse files
committed
Fix #176: Prepare semver 3.0.0-alpha0
* Remove targets py27, py34, py35, and pypy from `tox.ini` * Update `README.rst` and remove anything related to Python2 Mention maintenance branch `maint/v2` * `setup.py` - Update Trove classifiers - Require now Python >=3.6.* - Remove Tox and Clean classes, try to make it as simple as possible * `semver.py` - Change version number to "3.0.0-alpha0" - Remove old code related to Python2 * `tox.ini` - Remove py27, py34, and py35 (out of maintenance) - Add docs to default testenv - Remove --universal from bdist_wheel
1 parent dd110f1 commit ad6317e

File tree

5 files changed

+49
-120
lines changed

5 files changed

+49
-120
lines changed

CHANGELOG.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,34 @@ Change Log
66
All notable changes to this code base will be documented in this file,
77
in every released version.
88

9+
Version 3.0.0-alpha0
10+
====================
11+
12+
:Released:
13+
:Maintainer:
14+
15+
Features
16+
--------
17+
18+
n/a
19+
20+
Bug Fixes
21+
---------
22+
23+
n/a
24+
25+
Additions
26+
---------
27+
28+
n/a
29+
30+
31+
Deprecations
32+
------------
33+
34+
n/a
35+
36+
937

1038
Version 2.11.0
1139
==============

README.rst

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,13 @@ A Python module for `semantic versioning`_. Simplifies comparing versions.
99

1010
.. teaser-end
1111
12-
.. warning::
12+
.. note::
1313

14-
As anything comes to an end, this project will focus on Python 3.x only.
15-
New features and bugfixes will be integrated into the 3.x.y branch only.
16-
17-
Major version 3 of semver will contain some incompatible changes:
18-
19-
* removes support for Python 2.7 and 3.3
20-
* removes deprecated functions.
14+
This project works for Python 3 only. If you are looking for a compatible
15+
version for Python 2, use the maintenance branch ``maint/v2``.
2116

2217
The last version of semver which supports Python 2.7 and 3.4 will be
23-
2.10.x. However, keep in mind, version 2.10.x is frozen: no new
18+
2.11.x. However, keep in mind, version 2.11.x is frozen: no new
2419
features nor backports will be integrated.
2520

2621
We recommend to upgrade your workflow to Python 3.x to gain support,

semver.py

Lines changed: 8 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
PY3 = sys.version_info[0] == 3
1515

1616

17-
__version__ = "2.11.0"
17+
__version__ = "3.0.0-alpha0"
1818
__author__ = "Kostiantyn Rybnikov"
1919
__author_email__ = "k-bx@k-bx.com"
2020
__maintainer__ = ["Sebastien Celles", "Tom Schraitle"]
@@ -76,37 +76,17 @@ def u(s):
7676
return s
7777

7878

79-
else: # pragma: no cover
80-
string_types = unicode, str
81-
text_type = unicode
82-
binary_type = str
83-
84-
def b(s):
85-
return s
86-
87-
# Workaround for standalone backslash
88-
def u(s):
89-
return unicode(s.replace(r"\\", r"\\\\"), "unicode_escape")
90-
91-
9279
def ensure_str(s, encoding="utf-8", errors="strict"):
9380
# Taken from six project
9481
"""
9582
Coerce *s* to `str`.
9683
97-
For Python 2:
98-
- `unicode` -> encoded to `str`
99-
- `str` -> `str`
100-
101-
For Python 3:
102-
- `str` -> `str`
103-
- `bytes` -> decoded to `str`
84+
- `str` -> `str`
85+
- `bytes` -> decoded to `str`
10486
"""
10587
if not isinstance(s, (text_type, binary_type)):
10688
raise TypeError("not expecting type '%s'" % type(s))
107-
if PY2 and isinstance(s, text_type):
108-
s = s.encode(encoding, errors)
109-
elif PY3 and isinstance(s, binary_type):
89+
elif isinstance(s, binary_type):
11090
s = s.decode(encoding, errors)
11191
return s
11292

@@ -336,19 +316,6 @@ def to_dict(self):
336316
)
337317
)
338318

339-
# For compatibility reasons:
340-
@deprecated(replace="semver.VersionInfo.to_tuple", version="2.10.0")
341-
def _astuple(self):
342-
return self.to_tuple() # pragma: no cover
343-
344-
_astuple.__doc__ = to_tuple.__doc__
345-
346-
@deprecated(replace="semver.VersionInfo.to_dict", version="2.10.0")
347-
def _asdict(self):
348-
return self.to_dict() # pragma: no cover
349-
350-
_asdict.__doc__ = to_dict.__doc__
351-
352319
def __iter__(self):
353320
"""Implement iter(self)."""
354321
# As long as we support Py2.7, we can't use the "yield from" syntax
@@ -693,15 +660,15 @@ def parse(cls, version):
693660
"""
694661
Parse version string to a VersionInfo instance.
695662
663+
.. versionchanged:: 2.11.0
664+
Changed method from static to classmethod to
665+
allow subclasses.
666+
696667
:param version: version string
697668
:return: a :class:`VersionInfo` instance
698669
:raises: :class:`ValueError`
699670
:rtype: :class:`VersionInfo`
700671
701-
.. versionchanged:: 2.11.0
702-
Changed method from static to classmethod to
703-
allow subclasses.
704-
705672
>>> semver.VersionInfo.parse('3.4.5-pre.2+build.4')
706673
VersionInfo(major=3, minor=4, patch=5, \
707674
prerelease='pre.2', build='build.4')

setup.py

Lines changed: 5 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,7 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
import semver as package
3-
from glob import glob
4-
from os import remove
53
from os.path import dirname, join
64
from setuptools import setup
7-
from setuptools.command.test import test as TestCommand
8-
9-
try:
10-
from setuptools.command.clean import clean as CleanCommand
11-
except ImportError:
12-
from distutils.command.clean import clean as CleanCommand
13-
from shlex import split
14-
from shutil import rmtree
15-
16-
17-
class Tox(TestCommand):
18-
user_options = [("tox-args=", "a", "Arguments to pass to tox")]
19-
20-
def initialize_options(self):
21-
TestCommand.initialize_options(self)
22-
self.tox_args = None
23-
24-
def finalize_options(self):
25-
TestCommand.finalize_options(self)
26-
self.test_args = []
27-
self.test_suite = True
28-
29-
def run_tests(self):
30-
from tox import cmdline
31-
32-
args = self.tox_args
33-
if args:
34-
args = split(self.tox_args)
35-
errno = cmdline(args=args)
36-
exit(errno)
37-
38-
39-
class Clean(CleanCommand):
40-
def run(self):
41-
CleanCommand.run(self)
42-
delete_in_root = ["build", ".cache", "dist", ".eggs", "*.egg-info", ".tox"]
43-
delete_everywhere = ["__pycache__", "*.pyc"]
44-
for candidate in delete_in_root:
45-
rmtree_glob(candidate)
46-
for visible_dir in glob("[A-Za-z0-9]*"):
47-
for candidate in delete_everywhere:
48-
rmtree_glob(join(visible_dir, candidate))
49-
rmtree_glob(join(visible_dir, "*", candidate))
50-
51-
52-
def rmtree_glob(file_glob):
53-
for fobj in glob(file_glob):
54-
try:
55-
rmtree(fobj)
56-
print("%s/ removed ..." % fobj)
57-
except OSError:
58-
try:
59-
remove(fobj)
60-
print("%s removed ..." % fobj)
61-
except OSError:
62-
pass
635

646

657
def read_file(filename):
@@ -92,17 +34,15 @@ def read_file(filename):
9234
"License :: OSI Approved :: BSD License",
9335
"Operating System :: OS Independent",
9436
"Programming Language :: Python",
95-
"Programming Language :: Python :: 2",
96-
"Programming Language :: Python :: 2.7",
9737
"Programming Language :: Python :: 3",
98-
"Programming Language :: Python :: 3.4",
99-
"Programming Language :: Python :: 3.5",
10038
"Programming Language :: Python :: 3.6",
10139
"Programming Language :: Python :: 3.7",
40+
"Programming Language :: Python :: 3.8",
41+
"Programming Language :: Python :: 3.9",
42+
# "Programming Language :: Python :: Implementation :: PyPy",
10243
"Topic :: Software Development :: Libraries :: Python Modules",
10344
],
104-
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
45+
python_requires=">=3.6.*",
10546
tests_require=["tox", "virtualenv"],
106-
cmdclass={"clean": Clean, "test": Tox},
10747
entry_points={"console_scripts": ["pysemver = semver:main"]},
10848
)

tox.ini

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[tox]
22
envlist =
33
flake8
4-
py{27,34,35,36,37}
5-
pypy
4+
py{36,37,38,39}
5+
docs
66

77
[testenv]
8-
description = Run test suite
8+
description = Run test suite for {basepython}
99
whitelist_externals = make
1010
commands = pytest {posargs:}
1111
deps =
@@ -58,13 +58,12 @@ deps = sphinx
5858
skip_install = true
5959
commands = make -C docs man
6060

61-
6261
[testenv:prepare-dist]
6362
description = Prepare for TestPyPI
6463
basepython = python3
6564
deps =
6665
wheel
6766
twine
6867
commands =
69-
python3 setup.py sdist bdist_wheel --universal
68+
python3 setup.py sdist bdist_wheel
7069
twine check dist/*

0 commit comments

Comments
 (0)