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 declarative config for compatibility with setuptools declarative config #364

Merged
merged 11 commits into from
Nov 25, 2019

Conversation

jaraco
Copy link
Member

@jaraco jaraco commented Oct 19, 2019

Fixes #181

In irc.freenode.net#pylib, Ronny asked about supporting setuptools_scm on setuptools in a declarative config world. This change illustrates how I'd propose for that to happen. Setuptools would expose a new hook, something like

https://gist.github.com/b45998781be03918a21f17da996ee687

And then setuptools_scm would provide a hook into that such as the one (building on all of the existing work already done).

@jaraco
Copy link
Member Author

jaraco commented Oct 19, 2019

Still to do:

  • Settle on the right hook/API and release changes in setuptools.
  • Decide if setuptools_scm needs to support both setup() invocation and this declarative mode.
  • If so, implement compatibility protocol.
  • Add tests for this new functionality.
  • Implement the stubbed config file reader.
  • Update docs to describe how to use this preferred functionality.

@jaraco jaraco changed the title Illustrate how setuptools_scm could adapt to a proposed setuptools hook WIP: Illustrate how setuptools_scm could adapt to a proposed setuptools hook Oct 19, 2019
Copy link
Contributor

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Choose a reason for hiding this comment

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

I like this,
the setup keyword can actually stay relatively easy with this,

Could setuptools provide a helper to get the settings section from pyproject.toml

Thanks!

@jaraco
Copy link
Member Author

jaraco commented Oct 19, 2019

Unfortunately, setuptools itself doesn't yet have toml (or pyproject.toml) support... but it might be worthwhile for setuptools to own that functionality to avoid plugins needing to own the parsing.

How much harm is it for setuptools_scm to have a dependency (toml)?

@RonnyPfannschmidt
Copy link
Contributor

its a pain for anyone using the legacy support as it will pull in toml via easy_install

so having a toml dependency outside of what setuptools does would be a big blow for backward compat

its possible to make it a extra dependency
but its not clear to me how to make the entrypoint work properly then in all situation

@RonnyPfannschmidt
Copy link
Contributor

@jaraco got thinking again, its easy to have a extra and a optional import, after all - i can sort out most of the pain i believe (bit it would still be much nicer if the toml data was readily available in some way)

@jaraco
Copy link
Member Author

jaraco commented Oct 22, 2019

its a pain for anyone using the legacy support as it will pull in toml via easy_install

Are there scenarios where requiring a pure-python source distribution wouldn't work as a simple dependency (as toml installs under easy_install)? I'm not opposed to finding another solution, but I'd like to know what scenario we're seeking to solve.

its easy to have a extra and a optional import

Oh, so setuptools_scm[toml]>=version_with_toml (or similar) would be the requirement specified by setup_requires or PEP 518 build_requires? That sounds feasible.

Copy link
Contributor

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Choose a reason for hiding this comment

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

This is shaping up nicely, I like it

testing/test_config.py Outdated Show resolved Hide resolved
setup.py Outdated Show resolved Hide resolved
jaraco and others added 2 commits November 23, 2019 18:48
Co-Authored-By: Ronny Pfannschmidt <opensource@ronnypfannschmidt.de>
@jaraco jaraco mentioned this pull request Nov 24, 2019
Copy link
Contributor

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Choose a reason for hiding this comment

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

great work, what about the wip status

@jaraco
Copy link
Member Author

jaraco commented Nov 25, 2019

I've got a few more commits to address the docs.

@jaraco jaraco changed the title WIP: Illustrate how setuptools_scm could adapt to a proposed setuptools hook Illustrate how setuptools_scm could adapt to a proposed setuptools hook Nov 25, 2019
@jaraco jaraco changed the title Illustrate how setuptools_scm could adapt to a proposed setuptools hook Implement declarative config for compatibility with setuptools declarative config Nov 25, 2019
@RonnyPfannschmidt RonnyPfannschmidt merged commit 8a69f1c into master Nov 25, 2019
@RonnyPfannschmidt
Copy link
Contributor

thanks for implementing and documenting this

with this fabulous work many are finally free of setup.py

i plan to release mid week after including the ci/pre-commit fixups


This feature requires Setuptools 42 or later, released in Nov, 2019.
If your project needs to support build from sdist on older versions
of Setuptools, you will need to also implement the ``setup.py usage``
Copy link
Member

Choose a reason for hiding this comment

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

Looks like you placed the closing backticks too far...

Copy link
Member Author

Choose a reason for hiding this comment

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

I wasn't quite sure how to handle that, given that the backticks are in the title. I'm happy to accept edits on it.

Copy link
Member

Choose a reason for hiding this comment

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

Oh. I'm not sure either. Could probably try using a link syntax.

@madig
Copy link

madig commented Nov 25, 2019

Just chiming in to say FUCK YEAH. Thanks! One less file lying around 👍

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.

setuptools_scm does not work with setup.cfg
4 participants