Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement PEP-518 #295

Closed
drts01 opened this issue Nov 7, 2018 · 18 comments
Closed

Implement PEP-518 #295

drts01 opened this issue Nov 7, 2018 · 18 comments

Comments

@drts01
Copy link

drts01 commented Nov 7, 2018

Having the ability to use pyproject.toml instead of setup.cfg would be a "nice to have" feature.

@reinout
Copy link
Collaborator

reinout commented Nov 7, 2018

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.

@graingert
Copy link
Contributor

graingert commented Sep 23, 2020

usually projects use a [toml] extra to install tomli

@woutervh
Copy link

woutervh commented Jul 2, 2021

any progress?
Trying to move my tools-config to pyproject.toml.

@graingert
Copy link
Contributor

PEP 621 support would be even better!

@mauritsvanrees
Copy link
Member

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:

  • command line option
  • pyproject.toml
  • setup.cfg
  • ~/.pypirc

@woutervh
Copy link

woutervh commented Jul 2, 2021

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,...

@graingert
Copy link
Contributor

toml doesn't support toml v1 syntax. pip is also moving to tomli. pypa/pip#10035

@regebro
Copy link

regebro commented Aug 10, 2021

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?

@graingert
Copy link
Contributor

graingert commented Aug 10, 2021 via email

@graingert
Copy link
Contributor

Projects have now for the most part switched to tomli

@graingert
Copy link
Contributor

Here's a related issue about pep621 #373

@mauritsvanrees
Copy link
Member

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.

@regebro
Copy link

regebro commented Aug 21, 2021

Since Python 2 support ended over one and a half years ago, I fully endorese dropping Python 2 support.

@graingert
Copy link
Contributor

graingert commented Aug 21, 2021

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

@graingert
Copy link
Contributor

graingert commented Aug 21, 2021

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

@mauritsvanrees
Copy link
Member

I have created issue #374 for future plans.

@mauritsvanrees
Copy link
Member

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.

@reinout
Copy link
Collaborator

reinout commented Jul 12, 2023

Fixed in #415

@reinout reinout closed this as completed Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants