Skip to content

chore: use setup.cfg as main config file#818

Merged
di merged 6 commits intopypa:mainfrom
henryiii:chore/cfg
Feb 3, 2021
Merged

chore: use setup.cfg as main config file#818
di merged 6 commits intopypa:mainfrom
henryiii:chore/cfg

Conversation

@henryiii
Copy link
Copy Markdown
Contributor

@henryiii henryiii commented Jan 29, 2021

Followup to #817, related to #809.


I've split out the setup.cfg changes. I still would highly recommend setup.cfg, because:

  • It is a static, easily parsable file, which is highly superior to a Python file - for example, cibuildwheel should soon gain support for reading the Requires-Python metadata from the PEP 621 location or from setup.cfg, but setup.py is impossible to reliably parse.
  • It avoids many common issues, like opening files without with, encoding issues, and issues with accessing the version.
  • It keeps setup.py as just logic, making it clear what's "dynamic" and what's just regular metadata.
  • It's actually readable, much less boilerplate
  • Less chance of importing from distutils before setuptools
  • The PyPA projects, like twine, build, etc, use setup.cfg.
  • It's been supported since 2016
  • It's really easy to just say the fields are dynamically specifiable as keywords to setup, while it is harder to say the keywords to setup might be in [options] or in [metadata] or in ...

While I'm really excited for PEP 621 support, that's quite some time away (looks like funding has not even been secured yet), and then there's another period for the tooling to mature and become common enough to be used, it won't ever support Python 2 / PyPy 2, etc, so I expect adoption to be slow. And setup.cfg is still not going away, with some tools strongly refusing (cough, flake8, cough cough) to ever add pyproject.toml support (MyPy is still setup.cfg only too).

If people are writing setup.cfg's, it will be much easier to transition to pyproject.toml than from setup.py.

@henryiii henryiii marked this pull request as draft January 29, 2021 01:23
@henryiii henryiii marked this pull request as ready for review January 29, 2021 01:25
@di
Copy link
Copy Markdown
Member

di commented Jan 29, 2021

@henryiii
Copy link
Copy Markdown
Contributor Author

I went with exectuablebooks' sphinx-tabs, as I'm a Jupyterbook fan. (https://henryiii.github.io/level-up-your-python ;) ), and it likely is well maintained. Here's what the current state looks like:

Screen Shot 2021-01-29 at 2 44 00 PM

Copy link
Copy Markdown
Member

@di di left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small suggestions but otherwise this looks great.

Copy link
Copy Markdown
Member

@di di left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, will give it a day or so to let other folks review as well before merging.

@pradyunsg
Copy link
Copy Markdown
Member

May I suggest using sphinx-inline-tabs instead? I think it looks nicer. :)

@di
Copy link
Copy Markdown
Member

di commented Feb 2, 2021

Oh, look at that! Very nice @pradyunsg. Does it support markup in the tab title?

@henryiii
Copy link
Copy Markdown
Contributor Author

henryiii commented Feb 2, 2021

I'll try it soon! :)

@henryiii
Copy link
Copy Markdown
Contributor Author

henryiii commented Feb 2, 2021

No, it doesn't, though it seems to try harder:

Screen Shot 2021-02-02 at 10 43 20 AM

@henryiii
Copy link
Copy Markdown
Contributor Author

henryiii commented Feb 2, 2021

I'll push a version that uses this:

Screen Shot 2021-02-02 at 10 51 03 AM

Copy link
Copy Markdown

@gaborbernat gaborbernat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gaborbernat
Copy link
Copy Markdown

@henryiii
Copy link
Copy Markdown
Contributor Author

henryiii commented Feb 3, 2021

The link is available already, "Details" on the readthedocs check. Putting an image in shows what it looks like without having to click a link, and once I've changed it, you only see the new version with a link, so you can't compare. Though I could have made the image clickable, I suppose :)

@gaborbernat
Copy link
Copy Markdown

The link is available already, "Details" on the readthedocs check. Putting an image in shows what it looks like without having to click a link, and once I've changed it, you only see the new version with a link, so you can't compare.

That link takes you to the main page, not the section you want to view the change rendered. It's nice to have a direct link available 😄

@di di merged commit 9dfbeb0 into pypa:main Feb 3, 2021
@di
Copy link
Copy Markdown
Member

di commented Feb 3, 2021

Thanks @henryiii!

@henryiii
Copy link
Copy Markdown
Contributor Author

henryiii commented Feb 6, 2021

FYI, sphinx-tabs now supports rst in tab headings, including math. executablebooks/sphinx-tabs#102

Copy link
Copy Markdown

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

V

@webknjaz
Copy link
Copy Markdown
Member

Hey @Bfox85, this sort of drive-through reviews is rather useless and is considered spam. Please use words if you have something meaningful to add here.

@pradyunsg
Copy link
Copy Markdown
Member

Does it support markup in the tab title?
[snip]
No, it doesn't, though it seems to try harder:

It does now!

pradyunsg/sphinx-inline-tabs#13

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

Successfully merging this pull request may close these issues.

5 participants