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

migrate setup.py to pyproject.toml #299

Merged
merged 6 commits into from
Aug 24, 2023

Conversation

deronnax
Copy link
Contributor

No description provided.

@deronnax
Copy link
Contributor Author

hmm funny, I don't have this circular/partial import error on my computer through tox.

@john-kurkowski
Copy link
Owner

Hey, thanks for the contribution!

No description provided.

What brought this PR about?

@deronnax
Copy link
Contributor Author

we use this project and I found it is still using setup.py, so I offer the conversion to setup.cfg, which is superior

@john-kurkowski
Copy link
Owner

Do you have any resources about setup.cfg's superiority? Is setup.py prior to this PR causing problems?

I've been using pyproject.toml in personal projects. I thought that was the new hotness. But after cursory Googling, the winning project configuration format is unclear to me! 😅

@john-kurkowski
Copy link
Owner

hmm funny, I don't have this circular/partial import error on my computer through tox.

I reproduced the failure by deleting the local, ignored file tldextract/_version.py. I wonder if there's a way to clean the file for tox tests, to make reproducing the failure easier. Anyway, in 2b42b48, I restored some lost code from the transition. Tests pass now.

According to setuptools_scm's older docs, its configuration must remain in setup.py. (The newest release of their docs only give pyproject.toml instructions.)

@deronnax
Copy link
Contributor Author

Do you have any resources about setup.cfg's superiority?

https://setuptools.pypa.io/en/latest/references/keywords.html:
Users are strongly encouraged to use a declarative config either via setup.cfg or pyproject.toml and only rely on setup.py if they need to tap into special behaviour that requires scripting (such as building C extensions).

Is setup.py prior to this PR causing problems?

Not per se, but its paradigm is deprecated (executing arbitrary code just to describe a package), it's more complex than setup.cfg, allows for error to slip in and support will eventually be dropped in a not-so-far future.

I've been using pyproject.toml in personal projects. I thought that was the new hotness

It is. But the change is (quite) bigger than the simple setup.py -> setup.cfg migration (for which semantics remain the same, setup.cfg is just a static version of setup.py) . There are tools to automaticaly migrate from setup.cfg to pyproject.toml.

@deronnax
Copy link
Contributor Author

OK I just discovered the _version.py was generated, that's why it's breaking.

@deronnax
Copy link
Contributor Author

And setuptools_scm seems to not work only with setup.cfg, arg. I will either spend some time trying to do the conversion to pyproject.toml or close the PR.
Sorry for the noise.

@john-kurkowski
Copy link
Owner

Thank you for the explanation on the different config options! That makes sense. I'm open to migrating away from the very legacy setup.py approach. However, rather than migrate setup.py to setup.cfg, and (soon?) migrate setup.cfg to pyproject.toml, I'd rather leap to pyproject.toml directly, to save some churn. I'd welcome that conversion. 🙏

OK I just discovered the _version.py was generated, that's why it's breaking.

Yes, I fixed it in 2b42b48, which you seemed to force-push over. 😉 If we're not doing setup.cfg anyway, no sweat.

@deronnax
Copy link
Contributor Author

deronnax commented Jul 19, 2023

Hmmm, there you go. Only the pypy job is failing, I don't really get why but I guess it has to do with just being too old versions of pypy or something similar. Since python 3.7 is EOL for 3 weeks now, you might want considering to just drop the support.
(I can't even install pypy3.7 on my M2 MacBook).

@deronnax
Copy link
Contributor Author

deronnax commented Jul 19, 2023

Wow. Here you go. You don't even have to drop support for python 3.7, just use the latest 3.7 of pypy, lucky you.
Don't forget to squash commits, of course.

@deronnax deronnax changed the title migrate setup.py to setup.cfg migrate setup.py to pyproject.toml Jul 19, 2023
@john-kurkowski
Copy link
Owner

Beautiful! Thank you!

@john-kurkowski john-kurkowski merged commit c458e14 into john-kurkowski:master Aug 24, 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

Successfully merging this pull request may close these issues.

2 participants