Skip to content

Migrate metadata from setup.py and setup.cfg to pyproject.toml#2517

Closed
cclauss wants to merge 2 commits into
codespell-project:masterfrom
cclauss:pyproject.toml
Closed

Migrate metadata from setup.py and setup.cfg to pyproject.toml#2517
cclauss wants to merge 2 commits into
codespell-project:masterfrom
cclauss:pyproject.toml

Conversation

@cclauss

@cclauss cclauss commented Oct 5, 2022

Copy link
Copy Markdown
Contributor

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

@peternewman peternewman left a comment

Copy link
Copy Markdown
Collaborator

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.

Comment thread pyproject.toml Outdated
@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

cclauss commented Oct 6, 2022

Copy link
Copy Markdown
Contributor Author

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.

Comment thread 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
Copy Markdown
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
Copy Markdown
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>

@peternewman peternewman left a comment

Copy link
Copy Markdown
Collaborator

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

Comment thread Makefile

check-distutils:
python setup.py check --restructuredtext --strict
check-pyproject:

Copy link
Copy Markdown
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:

@cclauss cclauss Oct 14, 2022

Copy link
Copy Markdown
Contributor Author

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.

Comment thread Makefile
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

cclauss commented Oct 14, 2022

Copy link
Copy Markdown
Contributor Author

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.

4 participants