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 metadata from setup.py and setup.cfg to pyproject.toml #2517

Closed
wants to merge 2 commits into from

Conversation

cclauss
Copy link
Contributor

@cclauss cclauss commented Oct 5, 2022

Migrate to pyproject.toml using ini2toml to do the file conversion and running validate-pyproject to validate the results.

  • Currently flake8 is yet not compatible with pyproject.toml so move its config into .flake8

Copy link
Collaborator

@peternewman peternewman left a comment

Choose a reason for hiding this comment

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

You need to fix our CI tests please which currently call setup.py to install itself.

pyproject.toml Outdated Show resolved Hide resolved
@cclauss cclauss force-pushed the pyproject.toml branch 3 times, most recently from a2f6342 to 0bc11c1 Compare October 6, 2022 08:11
@cclauss cclauss marked this pull request as draft October 6, 2022 08:37
@cclauss
Copy link
Contributor Author

cclauss commented Oct 6, 2022

You need to fix our CI tests please which currently call setup.py to install itself.

Yes. These calls to setup.py are exactly what we are trying to avoid. This confusing little dance between setup.py and make increases the attack surface.

This pull request must remain in DRAFT status until someone can propose an effective fix for make check-distutils. Unfortunately, my make-foo was not up to that task.

Makefile Outdated
Comment on lines 51 to 52
python setup.py check --restructuredtext --strict
echo "WARNING: 'make check-distutils' is disabled!!"
# python setup.py check --restructuredtext --strict
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just adding a comment here to make sure we don't miss this, it will obviously be outdated when someone fixes it.

So in the same way as you changed the other commands, how do we run this command in the new format? If you can tell me on the command line, I should be able to make it work in the Makefile, i.e. I think it's a Python not a Make issue.

This page explains what it did, the correct answer might be that these particular commands are no longer required, but hopefully there's a similar set of tools to validate pyproject.toml we should switch to instead? It's interesting that we weren't validating the metadata itself before!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahhh... I did not know that setup.py had a check command. The commit message mentions validate-pyproject.

I will update.

@cclauss cclauss marked this pull request as ready for review October 6, 2022 13:51
Co-authored-by: Peter Newman <peternewman@users.noreply.github.com>
Copy link
Collaborator

@peternewman peternewman left a comment

Choose a reason for hiding this comment

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

Sorry @larsoner has also done this (and some other stuff) in #2523 .

I don't know which one we merge/use first...

@@ -47,8 +47,8 @@ trim-dictionaries:
check-manifest:
check-manifest

check-distutils:
python setup.py check --restructuredtext --strict
check-pyproject:
Copy link
Collaborator

Choose a reason for hiding this comment

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

May as well leave some backwards compatibility...

Suggested change
check-pyproject:
check-distutils: check-pyproject
check-pyproject:

Copy link
Contributor Author

@cclauss cclauss Oct 14, 2022

Choose a reason for hiding this comment

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

distutils will not be in py1.12 so this is probably a good time to change the name.

@@ -2,11 +2,11 @@ SORT_ARGS := -f -b

DICTIONARIES := codespell_lib/data/dictionary*.txt

PHONY := all check check-dictionaries sort-dictionaries trim-dictionaries check-dictionary sort-dictionary trim-dictionary check-manifest check-distutils flake8 pytest pypi clean
PHONY := all check check-dictionaries sort-dictionaries trim-dictionaries check-dictionary sort-dictionary trim-dictionary check-manifest check-pyproject flake8 pytest pypi clean
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
PHONY := all check check-dictionaries sort-dictionaries trim-dictionaries check-dictionary sort-dictionary trim-dictionary check-manifest check-pyproject flake8 pytest pypi clean
PHONY := all check check-dictionaries sort-dictionaries trim-dictionaries check-dictionary sort-dictionary trim-dictionary check-manifest check-pyproject check-distutils flake8 pytest pypi clean

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This would run the code twice under two different names.

@larsoner
Copy link
Member

I don't know which one we merge/use first...

Argh sorry I didn't see this! #2523 also has CI infrastructure to make releasing (hopefully!) trivial, so I'd rather merge that one.

@cclauss
Copy link
Contributor Author

cclauss commented Oct 14, 2022

No troubles. Closing in favor of #2523.

@cclauss cclauss closed this Oct 14, 2022
@cclauss cclauss deleted the pyproject.toml branch October 14, 2022 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants