Closed woutervh closed 5 years ago
a) yes, double quotes are the way to go. In some places, I think we actually look at the existing style, but apparently not here. Anyway, double quotes are a nicer default.
b) I think you can work around the problem by also stripping off single quotes:
version = line.split("=")[1].strip().strip('"').strip("'") # now that's a challenge to type right :-)
The version now gets passed including the single quotes. And python replaces all non-numerical (and abrc) characters with underscores. So that's why you get a such a funny version number.
Aah , I was not expecting the single-quotes and not stripping them.
This can be closed.
I recently started to put my version-numbers inside the package like this
init.py:
from version import __version__
version.py:
version = "x.y.dev0"
in my setup.py, I parse the version.py (not importing anything)
` def read(*names, **kwargs): r"""Return the contents of a file.
def read_version(*names): """ Returns: str: the version-number of the package.
version = read_version("src/foo/version.py") `
in my setup.cfg I have a section:
[zest.releaser] ... python-file-with-version = src/foo/version.py
This works fine.
Now when I make a release with zest.releaser (usually latest version) the version gets written back single-quoted instead of double-quoted
so
version = "x.y.dev0"
becomesversion = 'x.z.dev0'
but the change in quote-style now leads to a version-number
-x.z.dev0-
instead ofx.z.dev0
when I pip-install my dev-package it reports the version as
-x.z.dev0-
which cannot be parsed as a version-number. Therefore it cannot be compared, or compared incorrectly, to other versionsthe released packages are named
foo--x.z-.tar.gz foo-_x.z_-py2.py3-none-any.whl
instead offoo-x.z.tar.gz foo-x.z-py2.py3-none-any.whl
I currently don't yet know where the dashes are added and why that would happen. It's also a first for me where I see differences in functionality coming from a difference in quoting-style.
SOLUTION: use double quotes, (black also prefers double quotes)