Closed drts01 closed 1 year ago
Yes, agreed. The code is already pretty flexible where it grabs its settings, so an extra file to look in can be added reasonably simply.
Only thing to watch out for is whether we need an extra dependency to support the .toml syntax. I assume that's OK.
usually projects use a [toml]
extra to install tomli
any progress? Trying to move my tools-config to pyproject.toml.
PEP 621 support would be even better!
I don't have an immediate need for this, so I am not likely to work on this in the near future. But if someone wants to make a PR, that would be fine.
Question is which toml parser to use. @graingert mentions tomli
, but toml
has more stars, and is for example used by towncrier
, which I use in the zestreleaser.towncrier
extension, so I would be inclined to use toml
.
I wonder: what would we do with it? Only use this to read the zest.releaser
configuration options?
Or do we also for example read and write the version number in pyproject.toml
? I have not used this file except for towncrier setup, so I don't know if this is supported by one of the dozen PEPs about version numbers...
When we read config options, I would say the following is a good order, where the first file where an option is found, wins:
pyproject.toml
setup.cfg
~/.pypirc
Only use this to read the zest.releaser configuration options? Yes. Newer tools like black only support pyproject.toml and no setup.cfg. Several tools that read their settings from setup.cfg, have not supported for pyproject.toml, like towncrier, check-manifest, isort,...
toml doesn't support toml v1 syntax. pip is also moving to tomli. https://github.com/pypa/pip/pull/10035
In the long run I suppose it needs to support updating the version no matter if it is in setup.cfg or pyproject.toml.
But looking into pyproject.toml at the moment, it seems like setuptools doesn't fully support it, so you still need a setup.cfg. I think the only build project that supports not having a setup.cfg is Poetry?
And flit
On Tue, 10 Aug 2021, 12:54 Lennart Regebro, @.***> wrote:
In the long run I suppose it needs to support updating the version no matter if it is in setup.cfg or pyproject.toml.
But looking into pyproject.toml at the moment, it seems like setuptools doesn't fully support it. I think the only build project that supports not having a setup.cfg is Poetry?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zestsoftware/zest.releaser/issues/295#issuecomment-895965447, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADFATFLDL7XVFRQ7MPF733T4EHODANCNFSM4GCIGAUA .
Projects have now for the most part switched to tomli
Here's a related issue about pep621 https://github.com/zestsoftware/zest.releaser/issues/373
tomli
seems the way to go yes. Even its first version is Python 3 only, but zest.releaser
currently stil supports 2.7. One way around this, would be to try to import tomli
and catch an ImportError, and simply only use tomli when it is there. Don't even add it to the dependencies.
A PR in that direction would be welcome. Does anyone want to take this on? I am happy to help, especially in getting tests to run, because that can be tricky.
Other approach would be to drop Python 2.7 support.
In general, zest.releaser
could use some more love, cleanup, modernising, and I am currently not giving it that. It is more in bugfix modus, me and @reinout are not actively adding features at the moment. We may want to draw up a plan for the future in a different issue. Some simplification could help.
Since Python 2 support ended over one and a half years ago, I fully endorese dropping Python 2 support.
I tried making a py2/py3 toml compat lib here https://github.com/graingert/read-toml/blob/default/read_toml/_impl.py#L23 but it's tricky getting it to type check
I think the way to go about dropping py2 is to cut a release with whatever you've got on the default branch then apply pyupgrade and python_requires with https://pre-commit.ci
I have created issue #374 for future plans.
Version 8.0.0a1 supports writing the version to pyproject.toml
, so this is a start, and will be enough for some use cases.
But for releasing you still need a setup.py
for now. Currently zest.releaser
simply checks if there is a setup.py
. If it is not there, zest.releaser
does not create distributions, and does not push to PyPI. That will hopefully be for later in the alpha stage.
Fixed in #415
Having the ability to use pyproject.toml instead of setup.cfg would be a "nice to have" feature.