Discussion:
[Docutils-develop] say goodbye to __version_details__?
Guenter Milde
2017-05-31 13:31:07 UTC
Permalink
Dear David,

recent discussion following `Feature Request #50`_ ended in the consensus
to use PEP 440 "pre-releases segments" and "development release segments" in
the version identifier.

While implementation is simple in "setup.py" and "HISTORY.txt", there is
need for clarification on how to handle this in ``docutils.__version__`` and
``docutils.__version_details__``.


1. Is the use of "pre-/development release segments" in __version__ an API
change?

Background:
The last pre-release uses ::

__version__ = '0.14rc1'

but the docstring says::

``major.minor.micro`` version number.


Up to the last release, Sphinx relied on __version__ beeing composed of
integers and parsed it accordingly. Therefore, sphinx < 1.6.2 fails with
Docutils 0.14rc1.


2. Can/should the "pre-/development release segments" (rcN, .dev) replace
the distinction 'repository', 'prerelease', 'release' in
__version_details__?


Suggestions:

* Use PEP 440 version identifier in setup.py but only the number in
__version__ (for the next time).

Change the description and announce the change to a PEP 440 version
identifier for the future.

* In __version_details__, replace
'repository' with 'dev',
'prerelease' with 'rc<N>', and
'release' with ''.

Don't output version details with --version, if not __version_details__.


* Keep __version_details__ empty (unless manually set to snapshot
details) after moving to PEP 444 version indentifiers in __version__.

Günter




------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-develop mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-develop

Please use "Re
David Goodger
2017-06-01 14:51:00 UTC
Permalink
Post by Guenter Milde
Dear David,
recent discussion following `Feature Request #50`_ ended in the consensus
to use PEP 440 "pre-releases segments" and "development release segments" in
the version identifier.
While implementation is simple in "setup.py" and "HISTORY.txt", there is
need for clarification on how to handle this in ``docutils.__version__`` and
``docutils.__version_details__``.
1. Is the use of "pre-/development release segments" in __version__ an API
change?
__version__ = '0.14rc1'
``major.minor.micro`` version number.
Up to the last release, Sphinx relied on __version__ beeing composed of
integers and parsed it accordingly. Therefore, sphinx < 1.6.2 fails with
Docutils 0.14rc1.
If it's an API change, it's the simplest, most innocuous possible.

Any client software that depends on that never changing is IMO broken,
or at least extremely fragile. Sphinx is quite tightly coupled to
Docutils, so we're probably going to see Sphinx breakage on a regular
basis any time we change anything in Docutils. On the other hand,
Sphinx is quite responsive to changes, so it's not such a big deal.
Post by Guenter Milde
2. Can/should the "pre-/development release segments" (rcN, .dev) replace
the distinction 'repository', 'prerelease', 'release' in
__version_details__?
We should keep the __version_details__ string, because it is an API,
and somebody's software may break if we remove it.
Post by Guenter Milde
* In __version_details__, replace
'repository' with 'dev',
'prerelease' with 'rc<N>', and
'release' with ''.
The contents of __version_details__ can be whatever we want. We should
continue to use the conventions we've established.

Note that these properties do not correspond one-to-one. The current
(SVN) __version__ is '0.14rc2.dev', which would be both "repository"
and "prerelease" status. These (rc and dev) are signifying two
different things.
Post by Guenter Milde
* Use PEP 440 version identifier in setup.py but only the number in
__version__ (for the next time).
Change the description and announce the change to a PEP 440 version
identifier for the future.
I think this is overly cautious. Any software that depends on the
format of __version__ will have to change at some point. Better sooner
than later.
Post by Guenter Milde
Don't output version details with --version, if not __version_details__.
* Keep __version_details__ empty (unless manually set to snapshot
details) after moving to PEP 444 version indentifiers in __version__.
You mean PEP 440, right?

I think __version_details__ should be left as-is.

The root source of this problem is that Docutils predates PEP 440 and
the others. I suggest that we modernize by:

1. Adopt PEP 440 explicitly (done in dev/release.txt in r8092, thanks
Günter). It should be documented in docutils/__init__.py at
__version__; does it need to be documented anywhere else?

2. Add a new __version_info__ (or version_info) attribute to
docutils/__init__.py that emulates Python's sys.version_info::

from collections import namedtuple

__version_info__ = (
namedtuple(
'version_info', ['major', 'minor', 'micro',
'releaselevel', 'serial',
'development'])
(major=0, minor=14, micro=0, releaselevel='rc', serial=2,
development=True))

This would obviate the need for client code to parse our version
string at all. However, this requires Python 2.6, which is all the
more reason to drop Python 2.4 & 2.5 compatibility now. Alternatively,
if we absolutely must keep 2.4/2.5 compatibility, we could implement
__version_info__ as a simple class for now:

class __version_info__:
major = 0
minor = 14
micro = 0
releaselevel = 'rc'
serial = 2
development = True

David Goodger
<http://python.net/~goodger>
David Goodger
2017-06-01 21:33:11 UTC
Permalink
Post by David Goodger
2. Add a new __version_info__ (or version_info) attribute to
Proposed patch below.

David Goodger
<http://python.net/~goodger>

Index: __init__.py
===================================================================
--- __init__.py (revision 8099)
+++ __init__.py (working copy)
@@ -50,14 +50,33 @@
- writers: Format-specific output translators.
"""

+import sys
+
+try:
+ # Python 2.6 required:
+ from collections import namedtuple
+except ImportError:
+ namedtuple = None
+
+
__docformat__ = 'reStructuredText'

__version__ = '0.14rc2.dev'
-"""``major.minor.micro`` version number.
-The major number will be bumped when the project is feature-complete, and
-later if there is a major change in the design or API.
-The minor number is bumped whenever there are new features.
-The micro number is bumped for bug-fix releases.
+"""The Docutils version number (complies with PEP 440)::
+
+ major.minor[.micro][{releaselevel}serial][.dev]
+
+* The major number will be bumped when the project is feature-complete, and
+ later if there is a major change in the design or API.
+* The minor number is bumped whenever there are new features.
+* The micro number is bumped for bug-fix releases. Omitted for micro=0.
+* The releaselevel string is used for pre-releases, one of 'a' (alpha),
+ 'b' (beta), or 'rc' (release candidate). Omitted for final releases.
+* The serial number is used when
+* The '.dev' suffix indicates active development, unreleased, before the
+ version indicated.
+
+Rather than parsing this text, see `__version_info__` (below).
"""

__version_details__ = 'repository'
@@ -64,8 +83,21 @@
"""Extra version details (e.g. 'snapshot 2005-05-29, r3410', 'repository',
'prerelease', 'release'), modified automatically & manually."""

-import sys
+if namedtuple:
+ __version_info__ = (
+ namedtuple(
+ 'version_info',
+ ['major', 'minor', 'micro', 'releaselevel', 'serial',
'development'])
+ (major=0,
+ minor=14,
+ micro=0,
+ releaselevel='rc',
+ serial=2,
+ development=True))
+else:
+ __version_info__ = (0, 14, 0, 'rc', 2, True)

+
class ApplicationError(StandardError):
# Workaround:
# In Python < 2.6, unicode(<exception instance>) calls `str` on the

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-develop mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-develop

Please use "Reply All" to reply to the list.
Guenter Milde
2017-06-01 22:01:17 UTC
Permalink
Dear David, dear Docutils developers,
Post by David Goodger
Post by David Goodger
2. Add a new __version_info__ (or version_info) attribute to
Proposed patch below.
Thank you for the proposal.

Some comments:

Leave out the details, that are laid out in PEP 440 which we reference:

<<<<<<<<<<< snip
Post by David Goodger
+
+* The major number will be bumped when the project is feature-complete, and
+ later if there is a major change in the design or API.
+* The minor number is bumped whenever there are new features.
+* The micro number is bumped for bug-fix releases. Omitted for micro=0.
+* The releaselevel string is used for pre-releases, one of 'a' (alpha),
+ 'b' (beta), or 'rc' (release candidate). Omitted for final releases.
+* The serial number is used when
+* The '.dev' suffix indicates active development, unreleased, before the
+ version indicated.
+
+Rather than parsing this text, see `__version_info__` (below).
Post by David Goodger
snap
...
Post by David Goodger
+ __version_info__ = (
+ namedtuple(
+ 'version_info',
+ ['major', 'minor', 'micro', 'releaselevel', 'serial',
'development'])
+ (major=0,
+ minor=14,
+ micro=0,
+ releaselevel='rc',
+ serial=2,
+ development=True))
+ __version_info__ = (0, 14, 0, 'rc', 2, True)
While I agree that it helps downstream to provide the version identifier
as tuple (see Takeshi KOMIYAs post), this would leave the release manager
with the task to keep in sync version numbers at three different places
and details at four different places!

Even when automated in the release script, this is a duplication (or
actually quadruplication) that can and should be avoided.

Alternatives:

a) just keep __version__ and __version_details__, this can be parsed with
LooseVersion from distutils.version (as currently done by Sphinx).

b) wait with the __version_info__ until 0.15.dev when we drop support for
Py 2.4 and 2.5 or just use the simple tuple in 0.14.

c) generate __version__ from __version_info__


Günter
David Goodger
2017-06-01 22:16:02 UTC
Permalink
Post by Guenter Milde
Dear David, dear Docutils developers,
Post by David Goodger
Post by David Goodger
2. Add a new __version_info__ (or version_info) attribute to
Proposed patch below.
Thank you for the proposal.
<<<<<<<<<<< snip
Post by David Goodger
+
+* The major number will be bumped when the project is feature-complete, and
+ later if there is a major change in the design or API.
+* The minor number is bumped whenever there are new features.
+* The micro number is bumped for bug-fix releases. Omitted for micro=0.
+* The releaselevel string is used for pre-releases, one of 'a' (alpha),
+ 'b' (beta), or 'rc' (release candidate). Omitted for final releases.
+* The serial number is used when
+* The '.dev' suffix indicates active development, unreleased, before the
+ version indicated.
+
+Rather than parsing this text, see `__version_info__` (below).
Post by David Goodger
snap
Unfortunately PEP 440 uses different terminology than we do. It
doesn't use major/minor/micro/etc. So I think we should leave this in.
Post by Guenter Milde
Post by David Goodger
+ __version_info__ = (
+ namedtuple(
+ 'version_info',
+ ['major', 'minor', 'micro', 'releaselevel', 'serial',
'development'])
+ (major=0,
+ minor=14,
+ micro=0,
+ releaselevel='rc',
+ serial=2,
+ development=True))
+ __version_info__ = (0, 14, 0, 'rc', 2, True)
While I agree that it helps downstream to provide the version identifier
as tuple (see Takeshi KOMIYAs post), this would leave the release manager
with the task to keep in sync version numbers at three different places
and details at four different places!
Even when automated in the release script, this is a duplication (or
actually quadruplication) that can and should be avoided.
I agree.
Post by Guenter Milde
a) just keep __version__ and __version_details__, this can be parsed with
LooseVersion from distutils.version (as currently done by Sphinx).
b) wait with the __version_info__ until 0.15.dev when we drop support for
Py 2.4 and 2.5 or just use the simple tuple in 0.14.
c) generate __version__ from __version_info__
(c) sounds good to me, easy to implement.

Please remind me: why are we waiting to drop support for Python 2.4 &
2.5? Why not now, in this release?

David Goodger
<http://python.net/~goodger>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-develop mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-develop

Please use "Reply All" to reply to the list.
David Goodger
2017-06-01 22:29:47 UTC
Permalink
Post by David Goodger
(c) sounds good to me, easy to implement.
New patch below

David Goodger
<http://python.net/~goodger>

Index: __init__.py
===================================================================
--- __init__.py (revision 8099)
+++ __init__.py (working copy)
@@ -50,14 +50,47 @@
- writers: Format-specific output translators.
"""

+import sys
+
+try:
+ # Python 2.6 required:
+ from collections import namedtuple
+except ImportError:
+ namedtuple = None
+
+
__docformat__ = 'reStructuredText'

-__version__ = '0.14rc2.dev'
-"""``major.minor.micro`` version number.
-The major number will be bumped when the project is feature-complete, and
-later if there is a major change in the design or API.
-The minor number is bumped whenever there are new features.
-The micro number is bumped for bug-fix releases.
+__version_info__ = (0, 14, 0, 'rc', 2, True)
+if namedtuple:
+ __version_info__ = (
+ namedtuple(
+ 'version_info',
+ ['major', 'minor', 'micro', 'releaselevel', 'serial',
'development'])
+ (*__version_info__))
+
+__version__ = '%s.%s%s%s%s%s' % (
+ __version_info__[0], # major
+ __version_info__[1], # minor
+ ('.%s' % __version_info__[2]) if __version_info__[2] else '', # micro
+ __version_info__[3], #
releaselevel
+ __version_info__[4] if __version_info__[4] else '', # serial
+ '.dev' if __version_info__[5] else '') # development
+"""The Docutils version number (complies with PEP 440)::
+
+ major.minor[.micro][{releaselevel}serial][.dev]
+
+* The major number will be bumped when the project is feature-complete, and
+ later if there is a major change in the design or API.
+* The minor number is bumped whenever there are new features.
+* The micro number is bumped for bug-fix releases. Omitted for micro=0.
+* The releaselevel string is used for pre-releases, one of 'a' (alpha),
+ 'b' (beta), or 'rc' (release candidate). Omitted for final releases.
+* The serial number is used when
+* The '.dev' suffix indicates active development, unreleased, before the
+ version indicated.
+
+Rather than parsing the `__version__` text, use `__version_info__`.
"""

__version_details__ = 'repository'
@@ -64,7 +97,6 @@
"""Extra version details (e.g. 'snapshot 2005-05-29, r3410', 'repository',
'prerelease', 'release'), modified automatically & manually."""

-import sys

class ApplicationError(StandardError):
# Workaround:

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-develop mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-develop

Please use "Reply All" to reply to the list.
Guenter Milde
2017-06-01 23:13:37 UTC
Permalink
Post by David Goodger
Post by David Goodger
(c) sounds good to me, easy to implement.
New patch below
Much better.


Comments:

Should a the __version_info__ tuple sort according to PEP 440?

# The release is higher than the prerelease:
#
# >>> (0, 14, 0, 'rc', 2, False) < (0, 14, 0, '', 0, False)
# True
#
# >>> (0, 14, 0, '', 0, True) < (0, 14, 0, 'rc', 1, False)
# True


For human readers, it is better to use 'dev' and '' than True and False
to mark developmental releases.


I wonder, if we could find better names than

'releaselevel', 'serial'

for what PEP 440 describes as:

The pre-release segment consists of an alphabetical identifier for the
pre-release phase, along with a non-negative integer value.

Günter
David Goodger
2017-06-02 16:21:07 UTC
Permalink
Post by Guenter Milde
Post by David Goodger
Post by David Goodger
(c) sounds good to me, easy to implement.
New patch below
Much better.
Should a the __version_info__ tuple sort according to PEP 440?
#
# >>> (0, 14, 0, 'rc', 2, False) < (0, 14, 0, '', 0, False)
# True
#
# >>> (0, 14, 0, '', 0, True) < (0, 14, 0, 'rc', 1, False)
# True
Not sure what you're asking or showing. Perhaps the first example
*should* be True, semantically, but in fact it produces a False
result. PEP 440 doesn't specify that version tuples sort naturally; it
specifies a specific sort order for releaselevel. There may be a
function in Distutils that enables comparisons.

Most comparisons will be to shorter examples, just (major, minor), e.g.::

if __version_info__ < (0, 13):

And this works fine regardless of the releaselevel or development values.
Post by Guenter Milde
For human readers, it is better to use 'dev' and '' than True and False
to mark developmental releases.
Perhaps, but as it's a simple flag, I felt that a boolean would be
better. Some schemes allow for a dev number ('.dev1', '.dev2', ...,
'.devN'), and this would allow for such numbers; False == 0, and True
== 1, so it would be easy to extend it to development=2 etc.

Note that the simple tuple is only used for Python < 2.6. For newer
Pythons, you'll see the self-documenting namedtuple::

version_info(major=0, minor=14, micro=0, releaselevel='rc',
serial=2, development=True)

If we used the value 'dev', what would we use as a name?
Post by Guenter Milde
I wonder, if we could find better names than
'releaselevel', 'serial'
The pre-release segment consists of an alphabetical identifier for the
pre-release phase, along with a non-negative integer value.
I followed the pattern of sys.version. These names seem as good as any.

David Goodger
<http://python.net/~goodger>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-develop mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-develop

Please use "Reply All" to reply to the list.
Guenter Milde
2017-06-02 20:50:43 UTC
Permalink
Post by David Goodger
Post by Guenter Milde
Should a the __version_info__ tuple sort according to PEP 440?
#
# >>> (0, 14, 0, 'rc', 2, False) < (0, 14, 0, '', 0, False)
# True
#
# >>> (0, 14, 0, '', 0, True) < (0, 14, 0, 'rc', 1, False)
# True
Not sure what you're asking or showing. Perhaps the first example
*should* be True, semantically, but in fact it produces a False result.
PEP 440 doesn't specify that version tuples sort naturally; it
specifies a specific sort order for releaselevel.
Sorry, I see my wording error: Of course a standard tuple will not sort
according to PEP 440. The question is: "Should the __version_info__
variable contain an object that implements PEP 440 sorting."

If yes, we could, e.g., use a class that sorts according to PEP 440.
If no, why do we bother with __version_info__?
Post by David Goodger
There may be a function in Distutils that enables comparisons.
The PyPa packaging project has a `Version` class that can do this.
It's described at
https://github.com/pypa/packaging/blob/master/docs/version.rst

However, there seems to be no such tool in the standard library.

Sphinx currently uses LooseVersion from distutils, but this also fails to
sort the development version before the final one::

from distutils.version import LooseVersion

print LooseVersion("0.14.dev") <= LooseVersion("0.14")

However, it works as good as a tuple, so there is no urgent need for a
__version_info__ variable in 0.14.
Post by David Goodger
And this works fine regardless of the releaselevel or development values.
It may fail, if some feature was added during the 0.13 development and a
user has an early version of 0.13.dev.

This does not mean we cannot use it, but we must mind and document, that
sorting of the __version_info__ does not match the release timeline.
Post by David Goodger
Post by Guenter Milde
For human readers, it is better to use 'dev' and '' than True and False
to mark developmental releases.
Perhaps, but as it's a simple flag, I felt that a boolean would be
better. Some schemes allow for a dev number ('.dev1', '.dev2', ...,
'.devN'), and this would allow for such numbers; False == 0, and True
== 1, so it would be easy to extend it to development=2 etc.
PEP 440 says ".dev" == ".dev0", so this extension would not work out nicely.
Post by David Goodger
Note that the simple tuple is only used for Python < 2.6. For newer
version_info(major=0, minor=14, micro=0, releaselevel='rc',
serial=2, development=True)
If we used the value 'dev', what would we use as a name?
Also 'dev'? or the term from PEP 440: 'developmental'?
Post by David Goodger
Post by Guenter Milde
I wonder, if we could find better names than
'releaselevel', 'serial'
The pre-release segment consists of an alphabetical identifier for the
pre-release phase, along with a non-negative integer value.
I followed the pattern of sys.version. These names seem as good as any.
OK.

Maybe we can map `__version_details__` to `releaselevel` and do without the
additional `dev` field.

When re-naming the value "repository" to "development", details sort
well: "development" < "pre-release" < "release"
("snapshot" does not fit but is no longer actively used as
"version_detail").


With this scheme, both 0.14.dev and 0.14.rc1.dev map to

version_info(major=0, minor=14, micro=0,
releaselevel='development', serial=0)

but this is IMO acceptable as technically 0.14.rc1.dev is a
developmental version of the 0.14 series, too.

.. note::
When including __version_info__, we need to adapt the release script in
sandbox/infrastructure.


Günter


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-develop mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-develop

Please use "Reply All" to reply to the l
David Goodger
2017-06-02 21:28:46 UTC
Permalink
Post by Guenter Milde
Post by David Goodger
Post by Guenter Milde
Should a the __version_info__ tuple sort according to PEP 440?
#
# >>> (0, 14, 0, 'rc', 2, False) < (0, 14, 0, '', 0, False)
# True
#
# >>> (0, 14, 0, '', 0, True) < (0, 14, 0, 'rc', 1, False)
# True
Not sure what you're asking or showing. Perhaps the first example
*should* be True, semantically, but in fact it produces a False result.
PEP 440 doesn't specify that version tuples sort naturally; it
specifies a specific sort order for releaselevel.
Sorry, I see my wording error: Of course a standard tuple will not sort
according to PEP 440. The question is: "Should the __version_info__
variable contain an object that implements PEP 440 sorting."
If yes, we could, e.g., use a class that sorts according to PEP 440.
If no, why do we bother with __version_info__?
Because:

* Clients do want to compare. Comparing the first 3 items is sufficient.

* This prevents issues like the Sphinx bug that started this whole mess.

* It's easy, it's done. I'm going to check it in.
Post by Guenter Milde
Post by David Goodger
There may be a function in Distutils that enables comparisons.
The PyPa packaging project has a `Version` class that can do this.
It's described at
https://github.com/pypa/packaging/blob/master/docs/version.rst
However, there seems to be no such tool in the standard library.
Sphinx currently uses LooseVersion from distutils, but this also fails to
from distutils.version import LooseVersion
print LooseVersion("0.14.dev") <= LooseVersion("0.14")
If under active development or not is important, that has to be
checked separately.
Post by Guenter Milde
However, it works as good as a tuple, so there is no urgent need for a
__version_info__ variable in 0.14.
__version_info__ works better: it is self-documenting.

Maybe no urgent need, but it's already done.
Post by Guenter Milde
Post by David Goodger
And this works fine regardless of the releaselevel or development values.
It may fail, if some feature was added during the 0.13 development and a
user has an early version of 0.13.dev.
Done properly, it won't fail. The following actually means 0.14 or earlier:

if __version_info__ < (0, 15):

If they want to compare exact versions, they'll have to be more clever:

if __version_info__[:2] <= (0, 15) and not __version_info__.development:

In any case, if somebody is using a development version, they're on their own.
Post by Guenter Milde
This does not mean we cannot use it, but we must mind and document, that
sorting of the __version_info__ does not match the release timeline.
I disagree. We need not "mind and document". Over-specification creep: YAGNI.
Post by Guenter Milde
Post by David Goodger
Post by Guenter Milde
For human readers, it is better to use 'dev' and '' than True and False
to mark developmental releases.
Perhaps, but as it's a simple flag, I felt that a boolean would be
better. Some schemes allow for a dev number ('.dev1', '.dev2', ...,
'.devN'), and this would allow for such numbers; False == 0, and True
== 1, so it would be easy to extend it to development=2 etc.
PEP 440 says ".dev" == ".dev0", so this extension would not work out nicely.
So we don't extend to dev numbers, leave it at False/True. Or we just
specify that for Docutils, dev=0 means "not in development".
Post by Guenter Milde
Post by David Goodger
Note that the simple tuple is only used for Python < 2.6. For newer
version_info(major=0, minor=14, micro=0, releaselevel='rc',
serial=2, development=True)
If we used the value 'dev', what would we use as a name?
Also 'dev'? or the term from PEP 440: 'developmental'?
dev='dev'
developmental='dev'

Both redundant & ugly.

development=True

Elegant.
Post by Guenter Milde
Post by David Goodger
Post by Guenter Milde
I wonder, if we could find better names than
'releaselevel', 'serial'
The pre-release segment consists of an alphabetical identifier for the
pre-release phase, along with a non-negative integer value.
I followed the pattern of sys.version. These names seem as good as any.
OK.
Maybe we can map `__version_details__` to `releaselevel` and do without the
additional `dev` field.
No, we cannot, as I've already shown. They don't map properly.
Post by Guenter Milde
When re-naming the value "repository" to "development", details sort
well: "development" < "pre-release" < "release"
("snapshot" does not fit but is no longer actively used as
"version_detail").
Let's not rename anything there. Leave __version_details__ as-is.
Post by Guenter Milde
With this scheme, both 0.14.dev and 0.14.rc1.dev map to
version_info(major=0, minor=14, micro=0,
releaselevel='development', serial=0)
No they don't. "rc" and "dev" are not the same thing. We are currently
in the 0.14rc2.dev phase, to be followed by a 0.14rc2 release.
Post by Guenter Milde
but this is IMO acceptable as technically 0.14.rc1.dev is a
developmental version of the 0.14 series, too.
Unacceptable, because it's wrong.
Post by Guenter Milde
When including __version_info__, we need to adapt the release script in
sandbox/infrastructure.
Of course.

David Goodger
<http://python.net/~goodger>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-develop mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-develop

Please use "Reply All" to reply to the list.
engelbert gruber
2017-06-03 10:45:41 UTC
Permalink
Post by David Goodger
Post by Guenter Milde
When including __version_info__, we need to adapt the release script in
sandbox/infrastructure.
Of course.
i use this script as a reminder, but not as "just run it", testing is not
possible from one script
because 3+ platforms, 3+ versions, deinstallation of previous version,
wheels and pypi and ...

i did already extract set_version part into a set_version.sh ... not yet
commited
David Goodger
2017-06-14 23:47:22 UTC
Permalink
On Wed, Jun 7, 2017 at 3:53 PM, Guenter Milde via Docutils-develop
Post by Guenter Milde
Dear David,
Post by David Goodger
* Clients do want to compare. Comparing the first 3 items is sufficient.
If comparing them is sufficient, then `docutils.__version_info__` should
consist of (major, minor, micro) only.
OTOH, `sys.version_info` shows that it is fairly easy to design a
`version_info` tuple that sorts versions chronologically.
You mean "sorts versions *normally*", with obj.sort() or sorted(obj).
(Instead of "normal sorting", we might say "regular sorting" or
"ordinary sorting".) Normal sorting is numeric for numbers, alphabetic
for strings. *Chronologically* means by date & time, and has nothing
to do with this. I'll read "chronological" as "normal", below.
Post by Guenter Milde
Post by David Goodger
In any case, if somebody is using a development version, they're on their own.
This is in stark contrast to the promotion of snapshots¹ in the Docutils
We recommend that you use a snapshot from Docutils' Subversion
repository. The snapshots usually contain more features and fewer bugs
than the "official" releases—they're not only for developers!
--- http://docutils.sourceforge.net/
IMO, users following this advise should not be left "on their own".
¹Snapshots are marked as "development release" to comply with PEP 440
and `Feature Request #50`.
You chopped out all the context, which is important. I'm not throwing
our users under any buses here. I simply meant, if they're using a
development/snapshot release, they may expect to have the occasional
issue with version comparisons.
Post by Guenter Milde
Post by David Goodger
Post by Guenter Milde
Post by David Goodger
I followed the pattern of sys.version. These names seem as good as any.
The data descriptors in `sys.version_info` are carefully chosen to ensure
that `sys.version_info` tuples sort in chronological order.
`docutils.__version_info__` should learn from `sys.version_info` and
a) Name the releaselevels so that alphabetical sorting matches release
chronology.
Sure.
Post by Guenter Milde
b) Invert the meaning of the boolean value in the last item because in
Python False < True and we need "repository" < "release"
major
Major release number
micro
Patch release number
minor
Minor release number
releaselevel
'candidate' or 'final'²
...
Post by Guenter Milde
²If standing by the statement that "snapshots usually contain more features
and fewer bugs than the 'official' releases", we can skip "alpha" and
"beta" releases.
**Usually**, not always. That's because it's assumed that developers
test their code before committing, which is not always true.

Although we may not be using them currently, we should not preclude
the use of "alpha" and "beta" releases.

But maybe we should be using them, even now. If we want to be able to
compare versions between releases, we'll need to identify the
releaselevel accordingly. It could be releaselevel='alpha',
release=False. Or we could use something like
releaselevel='(repository)', which sorts earlier than 'alpha' etc.
Post by Guenter Milde
serial
Serial release number
released
False for installs from the repository or a snapshot,
True for an officially released version.
"release" = True or False reads much better, as a noun. All the other
terms are nouns or parts of nouns.
Post by Guenter Milde
With this scheme, `docutils.__version_info__` will sort in chronological
order. A client requiring a feature introduced in 0.14.rc2 can check in a
if __version_info__ > (0, 14, 'candidate', 2, True)
Missing the micro level. Should be::

if __version_info__ > (0, 14, 0, 'candidate', 2, True)
Post by Guenter Milde
Post by David Goodger
* It's easy, it's done. I'm going to check it in.
Post by Guenter Milde
When including __version_info__, we need to adapt the release script in
sandbox/infrastructure.
Of course.
As the `version identifier` is used at several places (docutils/__init__.py,
setup.py, expected test output), it seems sensible to use it as origin and
generate the __version_info__ named tuple.
I disagree completely. A tuple of components is much more precise, and
it's much easier and more reliable to generate a version identifier
string from such a tuple than it is to parse the components from a
string.
Post by Guenter Milde
See below for a proof of concept to set `docutils.__version_info__` and
`docutils.__version_details__` from `docutils.__version__` and for a test of
chronologicals sorting of version_info.
I'll comment on the patch in your follow-up message.

David Goodger
<http://python.net/~goodger>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-develop mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-develop

Please use "Reply All" to repl
David Goodger
2017-06-15 22:39:14 UTC
Permalink
On Thu, Jun 15, 2017 at 3:56 PM, Guenter Milde via Docutils-develop
Dear David, dear Engelbert,
Post by David Goodger
On Wed, Jun 7, 2017 at 3:53 PM, Guenter Milde via Docutils-develop
Post by Guenter Milde
OTOH, `sys.version_info` shows that it is fairly easy to design a
`version_info` tuple that sorts versions chronologically.
You mean "sorts versions *normally*", with obj.sort() or sorted(obj).
(Instead of "normal sorting", we might say "regular sorting" or
"ordinary sorting".) Normal sorting is numeric for numbers, alphabetic
for strings. *Chronologically* means by date & time, and has nothing
to do with this. I'll read "chronological" as "normal", below.
"Chronological" stands for "following the release timeline".¹
More precise: design a `version_info` tuple that sorts just as the
matching version identifer according to "PEP 440 version identifier
sorting rules" (with the benefit of not requiring a special sort function
but using the built-in "ordinary" tuple sorting rules).
¹Note: The correct "version sort order" may differ from the release date
sorting, if a bugfix release follows the release of a subsequent version.
Exactly, which is why "chronological" doesn't make sense for version numbers.
Post by David Goodger
Post by Guenter Milde
The data descriptors in `sys.version_info` are carefully chosen to ensure
that `sys.version_info` tuples sort in chronological order.
`docutils.__version_info__` should learn from `sys.version_info` and
a) Name the releaselevels so that alphabetical sorting matches release
chronology.
Sure.
Post by Guenter Milde
b) Invert the meaning of the boolean value in the last item because in
Python False < True and we need "repository" < "release"
major
Major release number
micro
Patch release number
minor
Minor release number
releaselevel
'candidate' or 'final'
...
Post by David Goodger
Although we may not be using them currently, we should not preclude
the use of "alpha" and "beta" releases.
But maybe we should be using them, even now. If we want to be able to
compare versions between releases, we'll need to identify the
releaselevel accordingly. It could be releaselevel='alpha',
release=False. Or we could use something like
releaselevel='(repository)', which sorts earlier than 'alpha' etc.
Another option would be to use the empty string '' (that sorts before any
other string) until the level of the next release is decided.
So the choices are:

1. releaselevel='alpha', release=False
2. releaselevel='', release=False
3. releaselevel='(repository)', release=False; it could be
releaselevel='(development)' or ='(none)' or ='(undecided)' or
something else

I'd *much* prefer that we explicitly set a releaselevel value, not use
an implicit "empty string means in development". Alpha/beta/etc. are
universally recognized, therefore:

+1 for releaselevel='alpha', release=False
-1 for releaselevel='', release=False
+0 for releaselevel='(something)', release=False

Our "in development, no release planned" stage would be
releaselevel='alpha', serial='0', release=False.
Post by David Goodger
Post by Guenter Milde
serial
Serial release number
released
False for installs from the repository or a snapshot,
True for an officially released version.
"release" = True or False reads much better, as a noun. All the other
terms are nouns or parts of nouns.
This is a matter of taste. No objection. Let's use "release".
Post by David Goodger
Post by Guenter Milde
With this scheme, `docutils.__version_info__` will sort in chronological
order. A client requiring a feature introduced in 0.14.rc2 can check in a
...
Post by David Goodger
if __version_info__ > (0, 14, 0, 'candidate', 2, True)
__version_info__ > docutils.VersionInfo(0, 13, 0, 'candidate', 2,
released=True)
Yes. But I'd go even further in self-documentation, e.g.:

if __version_info__ > docutils.VersionInfo(
major=0, minor=13, micro=0,
releaselevel='candidate', serial=2, release=True)

It helps to avoid typos, like the one below.
Post by David Goodger
Post by Guenter Milde
As the `version identifier` is used at several places (docutils/__init__.py,
setup.py, expected test output), it seems sensible to use it as origin and
generate the __version_info__ named tuple.
I disagree completely. A tuple of components is much more precise, and
it's much easier and more reliable to generate a version identifier
string from such a tuple than it is to parse the components from a
string.
I agree with Engelbert that the "magic" to set/update version_info and
version identifier should be in a separate "set_version" script (this may
be a shell script or a python script). This leaves docutils/__init__.py
small, clean, and explicit.
I agree that docutils/__init__.py ought to be all those things. If
you're OK with duplicate/redundant version info in
docutils/__init__.py, and we have a "set_version" script that can set
these well, then sure. Until that script is updated, we'll need to
manually update these.
We defined one-to-one mapping between version identifier and
version_info: both directions can be implemented easily and safely.
Whether the PEP 440 identifier or version_info is used as origin should
be decided by the release manager based on usability considerations.
Agreed, but the identifier2version_info etc. functions must live in
set_version.py or in docutils/utils/ somewhere, not in
docutils/__init__.py.
For practical reasons, I suggest to
* Set __version_info__ as a "simple" tuple "by hand" in release 0.14.
* Raise the minimal supported Python verision to 2.6 in in Docutils 0.15.dev
and use collections.namedtuple without compatibility hacks and
VersionInfo = namedtuple('VersionInfo',
'major minor micro releaselevel serial release')
__version_info__ = VersionInfo(
major=15,
minor=0,
Typo: should be major=0, minor=15.
micro=0,
releaselevel=''
To be determined. I suggest:

releaselevel='alpha',
serial=0,
release=False)
* Enhance the "set_version" script to set __version__, __version_details__,
and __version_info__.
Sounds good to me.

David Goodger
<http://python.net/~goodger>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-develop mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-develop

Please use "Reply All" to rep
engelbert gruber
2017-06-16 07:26:27 UTC
Permalink
forcing ascii strings to sort to the top i use "!repository" instead of
"(repository)"
thinking about it

"!repository" speaks: attention repository version
"(repository)" speaks: only repository, "()" emphasizes this is not a
release
Post by David Goodger
On Thu, Jun 15, 2017 at 3:56 PM, Guenter Milde via Docutils-develop
Dear David, dear Engelbert,
Post by David Goodger
On Wed, Jun 7, 2017 at 3:53 PM, Guenter Milde via Docutils-develop
Post by Guenter Milde
OTOH, `sys.version_info` shows that it is fairly easy to design a
`version_info` tuple that sorts versions chronologically.
You mean "sorts versions *normally*", with obj.sort() or sorted(obj).
(Instead of "normal sorting", we might say "regular sorting" or
"ordinary sorting".) Normal sorting is numeric for numbers, alphabetic
for strings. *Chronologically* means by date & time, and has nothing
to do with this. I'll read "chronological" as "normal", below.
"Chronological" stands for "following the release timeline".¹
More precise: design a `version_info` tuple that sorts just as the
matching version identifer according to "PEP 440 version identifier
sorting rules" (with the benefit of not requiring a special sort function
but using the built-in "ordinary" tuple sorting rules).
¹Note: The correct "version sort order" may differ from the release date
sorting, if a bugfix release follows the release of a subsequent
version.
Exactly, which is why "chronological" doesn't make sense for version numbers.
Post by David Goodger
Post by Guenter Milde
The data descriptors in `sys.version_info` are carefully chosen to
ensure
Post by David Goodger
Post by Guenter Milde
that `sys.version_info` tuples sort in chronological order.
`docutils.__version_info__` should learn from `sys.version_info` and
a) Name the releaselevels so that alphabetical sorting matches release
chronology.
Sure.
Post by Guenter Milde
b) Invert the meaning of the boolean value in the last item because in
Python False < True and we need "repository" < "release"
major
Major release number
micro
Patch release number
minor
Minor release number
releaselevel
'candidate' or 'final'
...
Post by David Goodger
Although we may not be using them currently, we should not preclude
the use of "alpha" and "beta" releases.
But maybe we should be using them, even now. If we want to be able to
compare versions between releases, we'll need to identify the
releaselevel accordingly. It could be releaselevel='alpha',
release=False. Or we could use something like
releaselevel='(repository)', which sorts earlier than 'alpha' etc.
Another option would be to use the empty string '' (that sorts before any
other string) until the level of the next release is decided.
1. releaselevel='alpha', release=False
2. releaselevel='', release=False
3. releaselevel='(repository)', release=False; it could be
releaselevel='(development)' or ='(none)' or ='(undecided)' or
something else
I'd *much* prefer that we explicitly set a releaselevel value, not use
an implicit "empty string means in development". Alpha/beta/etc. are
+1 for releaselevel='alpha', release=False
-1 for releaselevel='', release=False
+0 for releaselevel='(something)', release=False
Our "in development, no release planned" stage would be
releaselevel='alpha', serial='0', release=False.
Post by David Goodger
Post by Guenter Milde
serial
Serial release number
released
False for installs from the repository or a snapshot,
True for an officially released version.
"release" = True or False reads much better, as a noun. All the other
terms are nouns or parts of nouns.
This is a matter of taste. No objection. Let's use "release".
Post by David Goodger
Post by Guenter Milde
With this scheme, `docutils.__version_info__` will sort in
chronological
Post by David Goodger
Post by Guenter Milde
order. A client requiring a feature introduced in 0.14.rc2 can check
in a
...
Post by David Goodger
if __version_info__ > (0, 14, 0, 'candidate', 2, True)
__version_info__ > docutils.VersionInfo(0, 13, 0, 'candidate', 2,
released=True)
if __version_info__ > docutils.VersionInfo(
major=0, minor=13, micro=0,
releaselevel='candidate', serial=2, release=True)
It helps to avoid typos, like the one below.
Post by David Goodger
Post by Guenter Milde
As the `version identifier` is used at several places
(docutils/__init__.py,
Post by David Goodger
Post by Guenter Milde
setup.py, expected test output), it seems sensible to use it as origin
and
Post by David Goodger
Post by Guenter Milde
generate the __version_info__ named tuple.
I disagree completely. A tuple of components is much more precise, and
it's much easier and more reliable to generate a version identifier
string from such a tuple than it is to parse the components from a
string.
I agree with Engelbert that the "magic" to set/update version_info and
version identifier should be in a separate "set_version" script (this may
be a shell script or a python script). This leaves docutils/__init__.py
small, clean, and explicit.
I agree that docutils/__init__.py ought to be all those things. If
you're OK with duplicate/redundant version info in
docutils/__init__.py, and we have a "set_version" script that can set
these well, then sure. Until that script is updated, we'll need to
manually update these.
We defined one-to-one mapping between version identifier and
version_info: both directions can be implemented easily and safely.
Whether the PEP 440 identifier or version_info is used as origin should
be decided by the release manager based on usability considerations.
Agreed, but the identifier2version_info etc. functions must live in
set_version.py or in docutils/utils/ somewhere, not in
docutils/__init__.py.
For practical reasons, I suggest to
* Set __version_info__ as a "simple" tuple "by hand" in release 0.14.
* Raise the minimal supported Python verision to 2.6 in in Docutils
0.15.dev
and use collections.namedtuple without compatibility hacks and
VersionInfo = namedtuple('VersionInfo',
'major minor micro releaselevel serial release')
__version_info__ = VersionInfo(
major=15,
minor=0,
Typo: should be major=0, minor=15.
micro=0,
releaselevel=''
releaselevel='alpha',
serial=0,
release=False)
* Enhance the "set_version" script to set __version__,
__version_details__,
and __version_info__.
Sounds good to me.
David Goodger
<http://python.net/~goodger>
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-develop mailing list
https://lists.sourceforge.net/lists/listinfo/docutils-develop
Please use "Reply All" to reply to the list.
David Goodger
2017-06-20 17:02:14 UTC
Permalink
On Mon, Jun 19, 2017 at 4:05 PM, Guenter Milde via Docutils-develop
Post by David Goodger
I'd *much* prefer that we explicitly set a releaselevel value, not use
an implicit "empty string means in development".
Agreed.
Post by David Goodger
+1 for releaselevel='alpha', release=False
-1 for releaselevel='', release=False
+0 for releaselevel='(something)', release=False
Alpha/beta/etc. are commonly used and recognized to denote
the `development status`__.
__ https://blog.codinghorror.com/alpha-beta-and-sometimes-gamma/
Therefore I have the following
Suggestions
===========
1. releaselevel == development status
-------------------------------------
Don't use release level '(repository)' or '!repository' or ''.
release = False Suffix ".dev"
release = True no developmental release segment
Instead, use `releaselevel` for the development status of either
* the repository (if release == False) or
* the release (if release == True).
+1
Motivation: even if no release is planned, the repository has a
development status in the sense that we can recommend it for
alpha internal testing,
beta external testing,
candidate pre-test of an upcoming release,
final production use and inclusion in distributions
I have no clear preference whether to keep the name or call it
``development_status`` instead.
My clear preference is to keep the name "releaselevel", because that's
what sys.version_info calls it. Record that "releaselevel =
development status" in the docstring.
2. default repository status == "beta"
--------------------------------------
The "in development, no release planned" stage defaults to
releaselevel='beta', serial='0', release=False.
NB: This would prevent us from ever using the "alpha" status. I am not
strongly against this, just pointing it out.

It seems odd to start at "beta". Just as easy to make "alpha" the
default development status, and skip "beta".

But we can use "beta" for now. In future, if we find that we need an
"alpha" status, we can start using it then.
* "Beta" seems the best match when comparing the `description of the
development stages`__ with the state of the repository and our release
policies --- which state that the code in the repository is
a) *experimental* until the major version number reaches 1 and
b) always kept in a *stable* state (usable and as problem-free as
possible).
__ https://en.wikipedia.org/wiki/Software_release_life_cycle
'Development Status :: 4 - Beta',
We can and should change this to match the actual status, on an ongoing basis.
3. status change == freeze/thaw
-------------------------------
A change of the "repository development status" would require prior
beta->candidate == "feature freeze": No new features, only bugfixes.
candidate->final == "freeze": No commits without affirmation by the
release manager.
tested new features allowed, keep API
Bugs may still slip in due to
incomplete tests or clients depending
on internal features.
Clarification: final → version number bump + beta
beta->alpha: In case a developer wants to add a new and experimental
feature (e.g. merging a feature branch) and expects
"toothing problems" we may agree to an "alpha period" (and
possibly an alpha release for interested testers).
(The move beta->alpha will "throw back" the version (0.15a < 0.15b).
This is OK, we don't want users *updating* from a beta version to an
alpha version. Alpha testers must clearly specify the desired version.)
-1: This seems wrong to me. Can you point out any project that does this?

"Alpha testers must clearly specify the desired version." Specify how?
releaselevel=beta 0.15b.dev [0.15b]¹
releaselevel=candidate 0.15rc1.dev 0.15rc1
[releaselevel=candidate 0.15rc2.dev 0.15rc2]²
releaseleve=final 0.15.dev 0.15
releaselevel=beta 0.16b.dev [0.16b]
¹Beta releases are optional.
²Follow-up pre-releases as required.
Bugfix releases use a branch.
* If development shall continue during the freeze periods, we can also
set up the maintenance branch already with/for the pre-release (candidate).
Cherry-picking is easy with, e.g. git-svn.
* To keep the repository reasonably small, older maintenance branches should
be deleted (moved to the attic). Version control ensures they can be
revived if required.
set_version and redundancy
==========================
Post by David Goodger
I agree with Engelbert that the "magic" to set/update version_info and
version identifier should be in a separate "set_version" script (this may
be a shell script or a python script). This leaves docutils/__init__.py
small, clean, and explicit.
I agree that docutils/__init__.py ought to be all those things. If
you're OK with duplicate/redundant version info in
docutils/__init__.py, and we have a "set_version" script that can set
these well, then sure. Until that script is updated, we'll need to
manually update these.
I am fine with some duplication in docutils/__init__.py, especially if it
is auto-managed in the long run. However, I wonder if we really need the
same info at *three* places (version identifier, info, and details).
We don't *need* all three, except that it's more work and bother (and
potential incompatibility) to remove it. We've spent more time and
effort arguing over this than will be saved by any conceivable change,
over the remainder of Docutils' foreseeable lifetime.
Let's reduce the amount of meaningless navel gazing instead, yes?
* using __version_info__ to document/explain the segments of the
__version__ identifier (major, minor, micro, ...),
* "retiring" __version_details__: Keep the variable for backwards
compatibility and special cases ('snapshot of r2045', say) but leave it
emtpy for cases that are clearly indicated by the "modern" replacements
__version_info__ and the PEP 440 version identifier (development,
__version_details__ = ''
"""
Optional extra version details (e.g. 'snapshot 2005-05-29, r3410').
For development and release status see `__version_info__`
and `__version__`.
"""
+0, if it really bothers you so much.
Alternatively (if someone insists on keeping __version_details__ alive),
move __version_info__ to a separate module, ``docutils.version_info`` or
``docutils.utils.version_info``, say.
Clients in need of a version comparing operation would load the module
which on import would parse the __version__ identifier and set
docutils.version_info.version_info.
-1. KISS. This is way more effort than necessary. And **again**, the
whole point of __version_info__ is to remove any need to parse
__version__.

What we have now is fine, and what we'll have in 0.15 is better, more
than good enough. Let's stop flogging this dead horse.

David Goodger
<http://python.net/~goodger>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-develop mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-develop

Please use "Repl
David Goodger
2017-06-22 16:26:13 UTC
Permalink
On Wed, Jun 21, 2017 at 9:18 AM, Guenter Milde via Docutils-develop
Post by David Goodger
On Mon, Jun 19, 2017 at 4:05 PM, Guenter Milde via Docutils-develop
Alpha/beta/etc. are commonly used and recognized to denote
the `development status`__.
__ https://blog.codinghorror.com/alpha-beta-and-sometimes-gamma/
Therefore I have the following
Suggestions
===========
1. releaselevel == development status
-------------------------------------
Don't use release level '(repository)' or '!repository' or ''.
release = False Suffix ".dev"
release = True no developmental release segment
Instead, use `releaselevel` for the development status of either
* the repository (if release == False) or
* the release (if release == True).
+1
Motivation: even if no release is planned, the repository has a
development status in the sense that we can recommend it for
alpha internal testing,
beta external testing,
candidate pre-test of an upcoming release,
final production use and inclusion in distributions
I have no clear preference whether to keep the name or call it
``development_status`` instead.
My clear preference is to keep the name "releaselevel", because that's
what sys.version_info calls it. Record that "releaselevel =
development status" in the docstring.
Done.
Did you make a change? I didn't see a commit.
Post by David Goodger
2. default repository status == "beta"
--------------------------------------
...
Post by David Goodger
It seems odd to start at "beta". Just as easy to make "alpha" the
default development status, and skip "beta".
Given that we agree on
Post by David Goodger
1. releaselevel == development status
it seems rather odd to mark the repository status as "alpha"
(experimental, for internal tests only, expect breakage and data loss)
after every release (even without any other change)!
Post by David Goodger
But we can use "beta" for now. In future, if we find that we need an
"alpha" status, we can start using it then.
... and also discuss details if the need arises rather than now.
Post by David Goodger
* To keep the repository reasonably small, older maintenance branches should
be deleted (moved to the attic). Version control ensures they can be
revived if required.
OK to `svn delete` branch "docutils-0.4"?
Sure.
Post by David Goodger
And **again**, the whole point of __version_info__ is to remove any
need to parse __version__.
The point was to offer __version_info__ as a service so that **clients**
don't need to parse __version__ (to prevent parsing errors like the
already fixed one in Sphinx).
This does not bar us from parsing __version__ ourselfs (in a script or
sub-module) instead of forcing the release manager to maintain
__version_info__ "per hand".
1. It would be hypocritical to say "don't do that" and then do it ourselves.

2. If we insist on setting the version once, the logical and correct
way would be to set __version_info__ then automatically build the
__version__ string. I already had code for this, which you objected
to. Well, I vehemently object to doing it the other way.

3. Parsing would introduce extra, unnecessary, and potentially fragile code.

4. The version information is maintained by a script anyway.

Let's stop bickering about this. Consider it a proclamation, and move on.
Post by David Goodger
What we have now is fine, and what we'll have in 0.15 is better, more
than good enough.
So, as "mathjax URL" and "__version_info__" are solved,
lets release 0.14.
Fine with me.

David Goodger
<http://python.net/~goodger>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-develop mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-develop

Please use "Reply All" to reply to the list.
David Goodger
2017-06-22 16:31:04 UTC
Permalink
On Wed, Jun 21, 2017 at 9:39 AM, Guenter Milde via Docutils-develop
Post by David Goodger
On Mon, Jun 19, 2017 at 4:05 PM, Guenter Milde via Docutils-develop
* "Beta" seems the best match when comparing the `description of the
development stages`__ with the state of the repository and our release
policies --- which state that the code in the repository is
a) *experimental* until the major version number reaches 1 and
b) always kept in a *stable* state (usable and as problem-free as
possible).
__ https://en.wikipedia.org/wiki/Software_release_life_cycle
'Development Status :: 4 - Beta',
We can and should change this to match the actual status, on an ongoing basis.
I suggest to
* Update the policies to reflect the status of the last discussions.
(See patch below.)
I have one edit, below.
* Keep the trove classifier at "4 - Beta" (also for final releases) until
we reach 1.0.
Change the trove classifier to "5 - Production/Stable"
with final release 1.0
After 1.0, it should be 4-Beta for the repository and pre-releases and
5-Stable for final releases.
Sounds good.
Index: policies.txt
===================================================================
--- policies.txt (Revision 8113)
+++ policies.txt (Arbeitskopie)
@@ -285,14 +285,12 @@
core**) is used for active -- but stable, fully tested, and reviewed
-- development.
-There will be at least one active **maintenance branch** at a time,
-based on at least the latest feature release. For example, when
-Docutils 0.5 is released, its maintenance branch will take over, and
-the 0.4.x maintenance branch may be retired. Maintenance branches
-will receive bug fixes only; no new features will be allowed here.
+If we need to cut a bugfix release, we'll create a **maintenance branch**
+based on the latest feature release. For example, when Docutils 0.5 is
+released, this would be ``branches/docutils-0.5``, and an eventually
+existing 0.4.x maintenance branch may be retired. Maintenance branches will
"and an eventually existing 0.4.x maintenance branch may be retired"
doesn't parse. Suggest "and any existing 0.4.x maintenance branches
may be retired".

David Goodger
<http://python.net/~goodger>
+receive bug fixes only; no new features will be allowed here.
-.. TODO: is this still active policy?
-
Obvious and uncontroversial bug fixes *with tests* can be checked in
directly to the core and to the maintenance branches. Don't forget to
add test cases! Many (but not all) bug fixes will be applicable both
@@ -411,12 +409,10 @@
Docutils version numbering uses a ``major.minor.micro`` scheme (x.y.z;
for example, 0.4.1).
-**Major releases** (x.0, e.g. 1.0) will be rare, and will represent
-major changes in API, functionality, or commitment. For example, as
-long as the major version of Docutils is 0, it is to be considered
-*experimental code*. When Docutils reaches version 1.0, the major
-APIs will be considered frozen and backward compatibility will become
-of paramount importance.
+**Major releases** (x.0, e.g. 1.0) will be rare, and will represent major
+changes in API, functionality, or commitment. When Docutils reaches version
+1.0, the major APIs will be considered frozen and backward compatibility
+will become of paramount importance.
Releases that change the minor number (x.y, e.g. 0.5) will be
**feature releases**; new features from the `Docutils core`_ will be
@@ -431,7 +427,8 @@
official version numbering policy, and micro releases contained both
bug fixes and new features.
-See also the `Docutils Release Procedure`_.
+See also the `Docutils Release Procedure`_, `docutils.__version__` and
+`docutils.__version_info__`.
.. _Docutils Release Procedure: release.html#version-numbers
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-develop mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-develop

Please use "Reply All" to reply to the list.

David Goodger
2017-06-14 23:47:57 UTC
Permalink
On Sat, Jun 10, 2017 at 6:59 AM, Guenter Milde via Docutils-develop
Post by Guenter Milde
`sys.version_info` shows that it is fairly easy to design a
`version_info` tuple that sorts versions chronologically.
...
Post by Guenter Milde
a) Name the releaselevels so that alphabetical sorting matches release
chronology.
b) Invert the meaning of the boolean value in the last item because in
Python False < True and we need "repository" < "release"
...
Post by Guenter Milde
With this scheme, `docutils.__version_info__` will sort in chronological
order. A client requiring a feature introduced in 0.14.rc2 can check in a
if __version_info__ > (0, 14, 'candidate', 2, True)
It's easy, it's done. See patch below.
@David: OK to commit?
Not yet. Lots of issues, below.
Why has docutils `__version_info__` but sys `version_info`?
Because we have docutils.__version__ and docutils.__version_details__.
So docutils.__version_info__ matches that pattern.

Python has a multitude of modules and packages, so the version info
can go in a specific module. If we want to do the same thing, it would
be something like docutils.utils.version_info or
docutils.utils.version.info. I'd rather leave it as
docutils.__version_info__.
Index: test/test__init__.py
===================================================================
--- test/test__init__.py (Revision 8102)
+++ test/test__init__.py (Arbeitskopie)
@@ -23,6 +23,45 @@
err = docutils.ApplicationError(u'\u0169')
self.assertEqual(unicode(err), u'\u0169')
+ self.assertEqual(len(docutils.__version_info__), 6)
+ self.assertEqual(type(docutils.__version_info__.major), int)
+ self.assertEqual(type(docutils.__version_info__.minor), int)
+ self.assertEqual(type(docutils.__version_info__.micro), int)
+ self.assertEqual(type(docutils.__version_info__.releaselevel), str)
+ self.assertEqual(type(docutils.__version_info__.serial), int)
Missing a test for .release::

+ self.assertEqual(type(docutils.__version_info__.release), bool)
+
+ """Return version identifier matching `version_info`."""
+ identifier = '%s.%s%s' % (version_info.major, version_info.minor,
+ '.%s' % version_info.micro if version_info.micro else '')
+ identifier += 'rc' + str(version_info.serial)
That's too simple. It should check the releaselevel string, and use a
lookup table.
Replace "released" with "release" globally.
+ identifier += '.dev'
+ return identifier
+
+ self.assertEqual(docutils.__version__, self.version_info2identifier(
+ docutils.__version_info__))
+
+ identifiers = ['0.13.1',
+ '0.14.dev',
+ '0.14rc1',
+ '0.14rc2.dev',
+ '0.14rc2',
+ '0.14',
+ '0.14.1.dev',
+ '0.14.1rc1.dev',
+ '0.14.1rc1',
+ '0.14.1']
+ version_infos = [docutils.identifier2version_info(identifier)
+ for identifier in identifiers]
+ self.assertEqual(version_infos, sorted(version_infos))
+
+
unittest.main()
Index: docutils/__init__.py
===================================================================
--- docutils/__init__.py (Revision 8102)
+++ docutils/__init__.py (Arbeitskopie)
@@ -50,35 +50,35 @@
- writers: Format-specific output translators.
"""
-import sys
+import re, sys
-1 on parsing the version string into __version_info__. So we don't
need to import re.

As I wrote in a docstring in docutils.__init__: "Rather than parsing
the `__version__` text, use `__version_info__`." It would be
incredibly hypocritical for us to say this then go ahead and do it
ourselves.
from collections import namedtuple
+ VersionInfo = namedtuple('version_info',
+ 'major minor micro releaselevel serial released')
If we do this, the names should match::

version_info = namedtuple('version_info', ...)

Replace "released" with "release" globally.
- namedtuple = None
+ self.keys = tuple('major minor micro releaselevel serial released'.split())
+ setattr(self, key, arg)
+ return 'version_info(' + ', '.join(
+ ['%s=%r' % (key, getattr(self, key))
+ for key in self.keys]) + ')'
+ return cmp(tuple(getattr(self, key) for key in self.keys), other)
+
+
This seems far too clever to me. And why add code that we're just
going to strip away soon? Let's just stick to a simple static tuple.
__docformat__ = 'reStructuredText'
-__version_info__ = (0, 14, 0, 'rc', 2, True)
- __version_info__ = (
- namedtuple(
- 'version_info',
- ['major', 'minor', 'micro', 'releaselevel', 'serial', 'development'])
- (*__version_info__))
+__version__ = '0.14rc2.dev'
-__version__ = '%s.%s%s%s%s%s' % (
- __version_info__[0], # major
- __version_info__[1], # minor
- ('.%s' % __version_info__[2]) if __version_info__[2] else '', # micro
- __version_info__[3], # releaselevel
- __version_info__[4] if __version_info__[4] else '', # serial
- '.dev' if __version_info__[5] else '') # development
-
major.minor[.micro][{releaselevel}serial][.dev]
* The major number will be bumped when the project is feature-complete, and
@@ -85,20 +85,58 @@
later if there is a major change in the design or API.
* The minor number is bumped whenever there are new features.
* The micro number is bumped for bug-fix releases. Omitted for micro=0.
-* The releaselevel string is used for pre-releases, one of 'a' (alpha),
- 'b' (beta), or 'rc' (release candidate). Omitted for final releases.
-* The serial number is used when
-* The '.dev' suffix indicates active development, unreleased, before the
- version indicated.
+* Pre-releases are marked by appended 'rc' + serial number.
+* The '.dev' suffix indicates snapshots and installs from the repository.
Rather than parsing the `__version__` text, use `__version_info__`.
"""
-__version_details__ = 'repository'
+_version_regexp = re.compile(r"""
+ (?P<release>
+ (?P<major>[0-9]+)
+ \.(?P<minor>[0-9]+)
+ (\.(?P<micro>[0-9]+))?
+ )
+ (?P<pre> # pre-release segment
+ (?P<pre_l>(a|b|rc))
+ (?P<pre_n>[0-9]+)?
+ )?
+ (\.(?P<dev>dev))? # dev segment
+ """, re.VERBOSE)
+
+ """Convert Docutils version identifier to a `version_info` namedtuple"""
+ segments = _version_regexp.match(identifier).groupdict()
+ releaselevel = 'candidate'
+ releaselevel = ''
+ releaselevel = 'final'
+ return VersionInfo(
+ major=int(segments['major']),
+ minor=int(segments['minor']),
+ micro=segments['micro'] and int(segments['micro']) or 0,
+ releaselevel=releaselevel,
+ serial=segments['pre_n'] and int(segments['pre_n']) or 0,
+ released=not segments['dev'])
+
+__version_info__ = identifier2version_info(__version__)
+
-1. Way too complicated, without a need or benefit. The correct
process is to build the identifier string from the static components,
rather than parsing the string into the components.
-1, too clever, not needed. In addition to checking
docutils.__version_details__, we want to be able to just look at the
docutils/__init__.py source and see the same thing. It should be a
simple static string.
+__version_details__ = ''
"""Extra version details (e.g. 'snapshot 2005-05-29, r3410', 'repository',
'prerelease', 'release'), modified automatically & manually."""
+ __version_details__ = 'repository'
+ __version_details__ = 'prerelease'
+ __version_details__ = 'release'
Way too complicated. I can't even tell if this is correct. The code
can be in development state (i.e., 'repository') while it's in the
releaselevel='candidate' state.

Release level ( __version_info__.releaselevel) and
__version_info__.release are orthogonal. __version_details__ is
related to both.

And this is way too much code to add to docutils/__init__.py. Removing
the unnecessary cleverness should drop the line count. But if a
significant amount of these additions survive review (e.g.
identifier2version_info), it should go in docutils/utils/ instead (in
__init__.py or a new module).

Let's spell out the sequence of versions, past, present, & future, as
if we had been using the __version_info__ structure we're discussing.
Note, this is what we *should have been doing*. What we actually did
is mentioned in comments. Can we agree on this sequence?

1. Docutils 0.12 was released on 2014-07-06:

version=0.12.0 # short for major=0, minor=12, micro=0
releaselevel='final'
serial=0
release=True
__version__='0.12'
__version_details__='release'

2. Development of Docutils 0.13 commenced immediately afterwards:

version=0.13.0
releaselevel='alpha'
serial=0
release=False
__version__='0.13a0.dev' # was actually '0.13'
__version_details__='repository'

3. Docutils 0.13 was announced on 2016-12-05 (no alpha or release
candidate), but there was no release:

version=0.13.0
releaselevel='final'
serial=0
release=True
__version__='0.13'
__version_details__='release'

4. An issue with the Docutils versioning scheme was noted
(https://sourceforge.net/p/docutils/feature-requests/50/) and
Docutils 0.13.1 was released on 2016-12-09:

version=0.13.1
releaselevel='final'
serial=0
release=True
__version__='0.13.1'
__version_details__='release'

5. Development of Docutils 0.13.2 commenced immediately afterwards:

version=0.13.2
releaselevel='alpha'
serial=0
release=False
__version__='0.13.2a0.dev' # was actually '0.13.2a'
__version_details__='repository'

6. Docutils 0.14rc1 was released on 2017-05-27. First there was a
'prerelease' in r8076:

version=0.14.0
releaselevel='alpha'
serial=0
release=False
__version__='0.14a0.dev' # was actually '0.14.0a' in r8076,
# changed to '0.14a0' in r8081
__version_details__='prerelease'

Then the actual release was cut in r8087:

version=0.14.0
releaselevel='candidate'
serial=1
release=True
__version__='0.14rc1'
__version_details__='prerelease'

7. Immediately afterward, in r8089:

version=0.14.0
releaselevel='candidate'
serial=2
release=False
__version__='0.14rc2.dev' # was actually '0.14rc2' in r8089,
# changed to '0.14rc2.dev' in r8091
__version_details__='repository'

8. Upcoming release of Docutils 0.14rc2:

version=0.14.0
releaselevel='candidate'
serial=2
release=True
__version__='0.14rc2'
__version_details__='prerelease'

9. Immediately afterward, in preparation for the final release:

version=0.14.0
releaselevel='final'
serial=0
release=False
__version__='0.14.dev'
__version_details__='repository'

10. The final release of Docutils 0.14:

version=0.14.0
releaselevel='final'
serial=0
release=True
__version__='0.14'
__version_details__='release'

11. Immediately afterward, the trunk becomes:

version=0.15.0
releaselevel='alpha'
serial=0
release=False
__version__='0.15a0.dev'
__version_details__='repository'

12. If we need to cut a bugfix release of 0.14, we'll create a branch
off step 10 and set:

version=0.14.1
releaselevel='alpha'
serial=0
release=False
__version__='0.14.1a0.dev'
__version_details__='repository'

David Goodger
<http://python.net/~goodger>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-develop mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-develop

Please use "Reply All" to reply to the list.
Guenter Milde
2017-06-01 23:19:17 UTC
Permalink
Dear David, dear Docutils developers,
Post by David Goodger
Unfortunately PEP 440 uses different terminology than we do. It
doesn't use major/minor/micro/etc. So I think we should leave this in.
It actually mentions major/minor/micor as a typical numbering scheme but
does not specify details, so OK.
Post by David Goodger
Post by Guenter Milde
c) generate __version__ from __version_info__
(c) sounds good to me, easy to implement.
Please remind me: why are we waiting to drop support for Python 2.4 &
2.5? Why not now, in this release?
Because

Release 0.13.1 had a few bugs that shall be fixed without usage restriction.
(Even if we don't have a pure bug-fix release),

I use 2.4 on my Nokia 810 and cannot easily update,

When dropping support for 2.4 and 2.5 I want to clean up the code from
compatibility hacks. This requires time, consideration, and testing.
I want 0.14 to come out soon.

Günter


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-develop mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-develop

Please
Komiya Takeshi
2017-06-01 15:08:04 UTC
Permalink
Hi,
1. Is the use of "pre-/development release segments" in __version__ an API change?
I don't think so.

In addition, the trouble in Sphinx was a bug of Sphinx. And it was
already fixed.
so it does not prevent to assign correct and semantic versions to docutils.


IMO, it would be nice to provide `__version_info__` as a tuple (namedtuple?).
It helps us to the version numbers easily in future:

if docutils.__version_info__ >= (0, 14): # 0.14 or above.
# pass

Thanks,
Takeshi KOMIYA
Dear David,
recent discussion following `Feature Request #50`_ ended in the consensus
to use PEP 440 "pre-releases segments" and "development release segments" in
the version identifier.
While implementation is simple in "setup.py" and "HISTORY.txt", there is
need for clarification on how to handle this in ``docutils.__version__`` and
``docutils.__version_details__``.
1. Is the use of "pre-/development release segments" in __version__ an API
change?
__version__ = '0.14rc1'
``major.minor.micro`` version number.
Up to the last release, Sphinx relied on __version__ beeing composed of
integers and parsed it accordingly. Therefore, sphinx < 1.6.2 fails with
Docutils 0.14rc1.
2. Can/should the "pre-/development release segments" (rcN, .dev) replace
the distinction 'repository', 'prerelease', 'release' in
__version_details__?
* Use PEP 440 version identifier in setup.py but only the number in
__version__ (for the next time).
Change the description and announce the change to a PEP 440 version
identifier for the future.
* In __version_details__, replace
'repository' with 'dev',
'prerelease' with 'rc<N>', and
'release' with ''.
Don't output version details with --version, if not __version_details__.
* Keep __version_details__ empty (unless manually set to snapshot
details) after moving to PEP 444 version indentifiers in __version__.
Günter
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-develop mailing list
https://lists.sourceforge.net/lists/listinfo/docutils-develop
Please use "Reply All" to reply to the list.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-develop mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-develop

Please use "Reply A
Loading...