Skip to content

Commit ff07c90

Browse files
authored
Merge pull request #306 from tomschr/feature/169-package
Create semver package
2 parents ddf2b30 + 7d00884 commit ff07c90

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2512
-2198
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,8 @@ fabric.properties
259259
# --------
260260

261261

262-
263262
# Patch/Diff Files
264263
*.patch
265264
*.diff
265+
docs/_api
266+
!docs/_api/semver.__about__.rst

CHANGELOG.rst

Lines changed: 0 additions & 317 deletions
Original file line numberDiff line numberDiff line change
@@ -102,323 +102,6 @@ Trivial/Internal Changes
102102
* :pr:`290`: Add supported Python versions to :command:`black`.
103103

104104

105-
106-
----
107-
108-
109-
Version 2.13.0
110-
==============
111-
112-
:Released: 2020-10-20
113-
:Maintainer: Tom Schraitle
114-
115-
116-
Features
117-
--------
118-
119-
* :pr:`287`: Document how to create subclass from ``VersionInfo``
120-
121-
122-
Bug Fixes
123-
---------
124-
125-
* :pr:`283`: Ensure equal versions have equal hashes.
126-
Version equality means for semver, that ``major``,
127-
``minor``, ``patch``, and ``prerelease`` parts are
128-
equal in both versions you compare. The ``build`` part
129-
is ignored.
130-
131-
132-
Additions
133-
---------
134-
135-
n/a
136-
137-
138-
Deprecations
139-
------------
140-
141-
n/a
142-
143-
144-
----
145-
146-
147-
Version 2.12.0
148-
==============
149-
150-
:Released: 2020-10-19
151-
:Maintainer: Tom Schraitle
152-
153-
154-
Bug Fixes
155-
---------
156-
157-
* :gh:`291` (:pr:`292`): Disallow negative numbers of
158-
``major``, ``minor``, and ``patch`` for :class:`semver.VersionInfo`
159-
160-
161-
----
162-
163-
164-
Version 2.11.0
165-
==============
166-
167-
:Released: 2020-10-17
168-
:Maintainer: Tom Schraitle
169-
170-
171-
Bug Fixes
172-
---------
173-
174-
* :gh:`276` (:pr:`277`): ``VersionInfo.parse`` should be a class method
175-
Also add authors and update changelog in :gh:`286`
176-
* :gh:`274` (:pr:`275`): Py2 vs. Py3 incompatibility TypeError
177-
178-
179-
----
180-
181-
182-
Version 2.10.2
183-
==============
184-
185-
:Released: 2020-06-15
186-
:Maintainer: Tom Schraitle
187-
188-
Features
189-
--------
190-
191-
:gh:`268`: Increase coverage
192-
193-
194-
Bug Fixes
195-
---------
196-
197-
* :gh:`260` (:pr:`261`): Fixed ``__getitem__`` returning None on wrong parts
198-
* :pr:`263`: Doc: Add missing "install" subcommand for openSUSE
199-
200-
201-
Deprecations
202-
------------
203-
204-
* :gh:`160` (:pr:`264`):
205-
* :func:`semver.max_ver`
206-
* :func:`semver.min_ver`
207-
208-
209-
----
210-
211-
212-
Version 2.10.1
213-
==============
214-
215-
:Released: 2020-05-13
216-
:Maintainer: Tom Schraitle
217-
218-
219-
Features
220-
--------
221-
222-
* :pr:`249`: Added release policy and version restriction in documentation to
223-
help our users which would like to stay on the major 2 release.
224-
* :pr:`250`: Simplified installation semver on openSUSE with ``obs://``.
225-
* :pr:`256`: Made docstrings consistent
226-
227-
228-
229-
Bug Fixes
230-
---------
231-
232-
* :gh:`251` (:pr:`254`): Fixed return type of ``semver.VersionInfo.next_version``
233-
to always return a ``VersionInfo`` instance.
234-
235-
236-
----
237-
238-
239-
240-
Version 2.10.0
241-
==============
242-
243-
:Released: 2020-05-05
244-
:Maintainer: Tom Schraitle
245-
246-
Features
247-
--------
248-
249-
* :pr:`138`: Added ``__getitem__`` magic method to ``semver.VersionInfo`` class.
250-
Allows to access a version like ``version[1]``.
251-
* :pr:`235`: Improved documentation and shift focus on ``semver.VersionInfo`` instead of advertising
252-
the old and deprecated module-level functions.
253-
* :pr:`230`: Add version information in some functions:
254-
255-
* Use ``.. versionadded::`` RST directive in docstrings to
256-
make it more visible when something was added
257-
* Minor wording fix in docstrings (versions -> version strings)
258-
259-
260-
Bug Fixes
261-
---------
262-
263-
* :gh:`224` (:pr:`226`): In ``setup.py``, replaced in class ``clean``,
264-
``super(CleanCommand, self).run()`` with ``CleanCommand.run(self)``
265-
* :gh:`244` (:pr:`245`): Allow comparison with ``VersionInfo``, tuple/list, dict, and string.
266-
267-
268-
Additions
269-
---------
270-
271-
* :pr:`228`: Added better doctest integration
272-
273-
274-
Deprecations
275-
------------
276-
* :gh:`225` (:pr:`229`): Output a DeprecationWarning for the following functions:
277-
278-
- ``semver.parse``
279-
- ``semver.parse_version_info``
280-
- ``semver.format_version``
281-
- ``semver.bump_{major,minor,patch,prerelease,build}``
282-
- ``semver.finalize_version``
283-
- ``semver.replace``
284-
- ``semver.VersionInfo._asdict`` (use the new, public available
285-
function ``semver.VersionInfo.to_dict()``)
286-
- ``semver.VersionInfo._astuple`` (use the new, public available
287-
function ``semver.VersionInfo.to_tuple()``)
288-
289-
These deprecated functions will be removed in semver 3.
290-
291-
292-
----
293-
294-
295-
Version 2.9.1
296-
=============
297-
:Released: 2020-02-16
298-
:Maintainer: Tom Schraitle
299-
300-
Features
301-
--------
302-
303-
* :gh:`177` (:pr:`178`): Fixed repository and CI links (moved https://github.com/k-bx/python-semver/ repository to https://github.com/python-semver/python-semver/)
304-
* :pr:`179`: Added note about moving this project to the new python-semver organization on GitHub
305-
* :gh:`187` (:pr:`188`): Added logo for python-semver organization and documentation
306-
* :gh:`191` (:pr:`194`): Created manpage for pysemver
307-
* :gh:`196` (:pr:`197`): Added distribution specific installation instructions
308-
* :gh:`201` (:pr:`202`): Reformatted source code with black
309-
* :gh:`208` (:pr:`209`): Introduce new function :func:`semver.VersionInfo.isvalid`
310-
and extend :command:`pysemver` with :command:`check` subcommand
311-
* :gh:`210` (:pr:`215`): Document how to deal with invalid versions
312-
* :pr:`212`: Improve docstrings according to PEP257
313-
314-
Bug Fixes
315-
---------
316-
317-
* :gh:`192` (:pr:`193`): Fixed "pysemver" and "pysemver bump" when called without arguments
318-
319-
320-
----
321-
322-
Version 2.9.0
323-
=============
324-
:Released: 2019-10-30
325-
:Maintainer: Sébastien Celles <s.celles@gmail.com>
326-
327-
Features
328-
--------
329-
330-
* :gh:`59` (:pr:`164`): Implemented a command line interface
331-
* :gh:`85` (:pr:`147`, :pr:`154`): Improved contribution section
332-
* :gh:`104` (:pr:`125`): Added iterator to :func:`semver.VersionInfo`
333-
* :gh:`112`, :gh:`113`: Added Python 3.7 support
334-
* :pr:`120`: Improved test_immutable function with properties
335-
* :pr:`125`: Created :file:`setup.cfg` for pytest and tox
336-
* :gh:`126` (:pr:`127`): Added target for documentation in :file:`tox.ini`
337-
* :gh:`142` (:pr:`143`): Improved usage section
338-
* :gh:`144` (:pr:`156`): Added :func:`semver.replace` and :func:`semver.VersionInfo.replace`
339-
functions
340-
* :gh:`145` (:pr:`146`): Added posargs in :file:`tox.ini`
341-
* :pr:`157`: Introduce :file:`conftest.py` to improve doctests
342-
* :pr:`165`: Improved code coverage
343-
* :pr:`166`: Reworked :file:`.gitignore` file
344-
* :gh:`167` (:pr:`168`): Introduced global constant :data:`SEMVER_SPEC_VERSION`
345-
346-
Bug Fixes
347-
---------
348-
349-
* :gh:`102`: Fixed comparison between VersionInfo and tuple
350-
* :gh:`103`: Disallow comparison between VersionInfo and string (and int)
351-
* :gh:`121` (:pr:`122`): Use python3 instead of python3.4 in :file:`tox.ini`
352-
* :pr:`123`: Improved :func:`__repr__` and derive class name from :func:`type`
353-
* :gh:`128` (:pr:`129`): Fixed wrong datatypes in docstring for :func:`semver.format_version`
354-
* :gh:`135` (:pr:`140`): Converted prerelease and build to string
355-
* :gh:`136` (:pr:`151`): Added testsuite to tarball
356-
* :gh:`154` (:pr:`155`): Improved README description
357-
358-
Removals
359-
--------
360-
361-
* :gh:`111` (:pr:`110`): Dropped Python 3.3
362-
* :gh:`148` (:pr:`149`): Removed and replaced ``python setup.py test``
363-
364-
365-
----
366-
367-
Version 2.8.2
368-
=============
369-
:Released: 2019-05-19
370-
:Maintainer: Sébastien Celles <s.celles@gmail.com>
371-
372-
Skipped, not released.
373-
374-
----
375-
376-
Version 2.8.1
377-
=============
378-
:Released: 2018-07-09
379-
:Maintainer: Sébastien Celles <s.celles@gmail.com>
380-
381-
Features
382-
--------
383-
384-
* :gh:`40` (:pr:`88`): Added a static parse method to VersionInfo
385-
* :gh:`77` (:pr:`47`): Converted multiple tests into pytest.mark.parametrize
386-
* :gh:`87`, :gh:`94` (:pr:`93`): Removed named tuple inheritance.
387-
* :gh:`89` (:pr:`90`): Added doctests.
388-
389-
Bug Fixes
390-
---------
391-
392-
* :gh:`98` (:pr:`99`): Set prerelease and build to None by default
393-
* :gh:`96` (:pr:`97`): Made VersionInfo immutable
394-
395-
396-
----
397-
398-
Version 2.8.0
399-
=============
400-
:Released: 2018-05-16
401-
:Maintainer: Sébastien Celles <s.celles@gmail.com>
402-
403-
404-
Changes
405-
-------
406-
407-
* :gh:`82` (:pr:`83`): Renamed :file:`test.py` to :file:`test_semver.py` so
408-
py.test can autodiscover test file
409-
410-
Additions
411-
---------
412-
413-
* :gh:`79` (:pr:`81`, :pr:`84`): Defined and improve a release procedure file
414-
* :gh:`72`, :gh:`73` (:pr:`75`): Implemented :func:`__str__` and :func:`__hash__`
415-
416-
Removals
417-
--------
418-
419-
* :gh:`76` (:pr:`80`): Removed Python 2.6 compatibility
420-
421-
422105
..
423106
Local variables:
424107
coding: utf-8

README.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ A Python module for `semantic versioning`_. Simplifies comparing versions.
3030
.. |MAINT| replace:: ``maint/v2``
3131
.. _MAINT: https://github.com/python-semver/python-semver/tree/maint/v2
3232

33+
3334
The module follows the ``MAJOR.MINOR.PATCH`` style:
3435

3536
* ``MAJOR`` version when you make incompatible API changes,
@@ -45,11 +46,11 @@ To import this library, use:
4546
>>> import semver
4647
4748
Working with the library is quite straightforward. To turn a version string into the
48-
different parts, use the ``semver.VersionInfo.parse`` function:
49+
different parts, use the ``semver.Version.parse`` function:
4950

5051
.. code-block:: python
5152
52-
>>> ver = semver.VersionInfo.parse('1.2.3-pre.2+build.4')
53+
>>> ver = semver.Version.parse('1.2.3-pre.2+build.4')
5354
>>> ver.major
5455
1
5556
>>> ver.minor
@@ -62,21 +63,21 @@ different parts, use the ``semver.VersionInfo.parse`` function:
6263
'build.4'
6364
6465
To raise parts of a version, there are a couple of functions available for
65-
you. The function ``semver.VersionInfo.bump_major`` leaves the original object untouched, but
66-
returns a new ``semver.VersionInfo`` instance with the raised major part:
66+
you. The function ``semver.Version.bump_major`` leaves the original object untouched, but
67+
returns a new ``semver.Version`` instance with the raised major part:
6768

6869
.. code-block:: python
6970
70-
>>> ver = semver.VersionInfo.parse("3.4.5")
71+
>>> ver = semver.Version.parse("3.4.5")
7172
>>> ver.bump_major()
72-
VersionInfo(major=4, minor=0, patch=0, prerelease=None, build=None)
73+
Version(major=4, minor=0, patch=0, prerelease=None, build=None)
7374
7475
It is allowed to concatenate different "bump functions":
7576

7677
.. code-block:: python
7778
7879
>>> ver.bump_major().bump_minor()
79-
VersionInfo(major=4, minor=1, patch=0, prerelease=None, build=None)
80+
Version(major=4, minor=1, patch=0, prerelease=None, build=None)
8081
8182
To compare two versions, semver provides the ``semver.compare`` function.
8283
The return value indicates the relationship between the first and second

changelog.d/169.deprecation.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Deprecate CLI functions not imported from ``semver.cli``.

changelog.d/169.feature.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Create semver package and split code among different modules in the packages.
2+
3+
* Remove :file:`semver.py`
4+
* Create :file:`src/semver/__init__.py`
5+
* Create :file:`src/semver/cli.py` for all CLI methods
6+
* Create :file:`src/semver/_deprecated.py` for the ``deprecated`` decorator and other deprecated functions
7+
* Create :file:`src/semver/__main__.py` to allow calling the CLI using :command:`python -m semver`
8+
* Create :file:`src/semver/_types.py` to hold type aliases
9+
* Create :file:`src/semver/version.py` to hold the :class:`Version` class (old name :class:`VersionInfo`) and its utility functions
10+
* Create :file:`src/semver/__about__.py` for all the metadata variables

0 commit comments

Comments
 (0)