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

Improve packaging [PEP 517 + 621] #7076

Merged
merged 13 commits into from
Jun 28, 2022
Merged

Conversation

cdce8p
Copy link
Member

@cdce8p cdce8p commented Jun 27, 2022

Description

  • Use isolated build environments PEP 517 with python -m build instead of deprecated python setup.py sdist bdist_wheel
  • Move project metadata from setup.cfg to pyproject.toml PEP 621
  • Cleanup and remove MANIFEST.in -> entries haven't been used.
  • Add README.rst to MANIFEST.in. Required to be able to build the wheel from sdist and still include the readme text in the project metadata.
  • Remove setup.py. With recent pip versions (>= 21.0), no longer required for editable installs. setup.cfg is enough.

Metadata diff

-Author: Python Code Quality Authority
-Author-email: code-quality@python.org
+Author-email: Python Code Quality Authority <code-quality@python.org>
...
-Keywords: static code analysis linter python lint
+Keywords: static code analysis,linter,python,lint

Closes #4193

* PEP 517
* Include readme in sdist to be able to build wheel from it
* Update release ci job to use build
@github-actions

This comment has been minimized.

@coveralls
Copy link

coveralls commented Jun 27, 2022

Pull Request Test Coverage Report for Build 2576530244

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 95.324%

Totals Coverage Status
Change from base Build 2571502189: 0.0%
Covered Lines: 16655
Relevant Lines: 17472

💛 - Coveralls

@Pierre-Sassoulas Pierre-Sassoulas added the Maintenance Discussion or action around maintaining pylint or the dev workflow label Jun 27, 2022
Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

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

Thank you ! I wanted to wait for pep660 but what's left of the setup.cfg is really manageable in the end. This would close #4193

MANIFEST.in Show resolved Hide resolved
@Pierre-Sassoulas
Copy link
Member

Is there no change in the contributor doc at all ?

@cdce8p
Copy link
Member Author

cdce8p commented Jun 27, 2022

We can probably remove this entirely now ? Doesn't the pyproject.toml handles it ?

I first checked with just ´[build-system]when I got the error. You're correct though, with the[project]table, it works withoutMANIFEST.in`.

Is there no change in the contributor doc at all ?

pip install . and pip install -e . continue to function as expected. The main change is in the way the release package is build. python -m build instead of python setup.py sdist bdist_wheel but that is handled by Github actions anyway.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copy link
Collaborator

@DanielNoord DanielNoord left a comment

Choose a reason for hiding this comment

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

Let's not remove setup.py just yet:
dependabot/dependabot-core#4483

This is quite an annoying bug.

@cdce8p
Copy link
Member Author

cdce8p commented Jun 27, 2022

Update

Everything took a bit longer then I expected, but it's ready now.
I've also opened pylint-dev/astroid#1670 to update astroid, too.

README.rst and MANIFEST.in

Turns out if you remove the MANIFEST.in completely, README.rst will be included automatically. That's why the wheel build didn't fail. I've added README.rst explicitly now, just in case we do add some other files there in the future.

Let's not remove setup.py just yet:
dependabot/dependabot-core#4483

This is quite an annoying bug.

Thanks @DanielNoord! Didn't know about that. I've restored setup.py and added a comment.

@github-actions

This comment has been minimized.

Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

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

Perfect ! We've come a long way from the 2000's packaging !

@@ -93,6 +28,11 @@ known_third_party = platformdirs, astroid, sphinx, isort, pytest, mccabe, six, t
skip_glob = tests/functional/**,tests/input/**,tests/extensions/data/**,tests/regrtest_data/**,tests/data/**,astroid/**,venv/**
src_paths = pylint

[flake8]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't this go in .flake8?

Copy link
Member Author

Choose a reason for hiding this comment

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

Let's do it the other way round and move the whole flake8 config into setup.cfg. In the past, we have also removed .isort. At some point we can move most / all of these configs into pyproject.toml.

Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas Jun 28, 2022

Choose a reason for hiding this comment

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

Strong agree. I don't think .flake8 support pyproject.toml right now though . But there's other tool we could move already, tox and black probably.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Strong agree. I don't think .flake8 support pyproject.toml right now though . But there's other tool we could move already, tox and black probably.

I would recommend to keep tox (and pylint) separate. Both have quite complex configurations. It's much easier to have them in their individual files. We could however move isort, pytest, and mypy.

@github-actions

This comment has been minimized.

@cdce8p cdce8p requested a review from DanielNoord June 28, 2022 12:27
@cdce8p
Copy link
Member Author

cdce8p commented Jun 28, 2022

@DanielNoord dependabot/dependabot-core#4483 doesn't seem to be an issue anymore. I just checked one of my repos and dependabot runs fine even without a setup.py file. Let's try it. We can always re-add it if causes issues.

@github-actions
Copy link
Contributor

🤖 According to the primer, this change has no effect on the checked open source code. 🤖🎉

This comment was generated for commit d380aca

@DanielNoord
Copy link
Collaborator

Are you sure? These are the logs/statuses for pydocstringformatter, which also doesn't have a setup.py.
https://github.com/DanielNoord/pydocstringformatter

Schermafbeelding 2022-06-28 om 16 57 27

Schermafbeelding 2022-06-28 om 16 57 35

@cdce8p
Copy link
Member Author

cdce8p commented Jun 28, 2022

Are you sure? These are the logs/statuses for pydocstringformatter, which also doesn't have a setup.py. https://github.com/DanielNoord/pydocstringformatter

Yeah! This is from python-typing-updater. Dependabot just opened a new PR for black with the last run a few hours ago. Not exactly sure, why it's not working for you though. Wild guess, maybe it's because you don't have a project table in your pyproject.toml? https://github.com/cdce8p/python-typing-update
Screen Shot 2022-06-28 at 18 30 49

My suggestion would be to just try it without setup.py. If it fails, I can open a PR to add it back.

@DanielNoord
Copy link
Collaborator

Let's do that. I think @Pierre-Sassoulas csn report whether the check is running successfully afterwards!

@cdce8p cdce8p dismissed DanielNoord’s stale review June 28, 2022 21:38

Addressed feedback

@cdce8p cdce8p merged commit 0d36a63 into pylint-dev:main Jun 28, 2022
@cdce8p cdce8p deleted the improve-packaging branch June 28, 2022 21:39
@cdce8p
Copy link
Member Author

cdce8p commented Jun 28, 2022

Seems like you were right @DanielNoord 😞 Triggered the run manually just now.
I'll open a PR shortly to add setup.py back.

Screen Shot 2022-06-28 at 23 42 21

That just raises the question: Why does it work in my repo https://github.com/cdce8p/python-typing-update?
A difference I could think of is the requirements.txt file. Both pylint and pydocstringformatter do only have requirements*<...>.txt files.

@DanielNoord
Copy link
Collaborator

@cdce8p I have no idea really... The annoying thing is that in de dependabot issue there is already a solution. But my complete lack of ruby experience makes it impossible to contribute any test so I hesitated to create a PR...

@cdce8p cdce8p added this to the 2.15.0 milestone Jun 28, 2022
@cdce8p
Copy link
Member Author

cdce8p commented Jun 28, 2022

Followup PR: #7082

@DanielNoord
Copy link
Collaborator

Followup PR: #7249.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Maintenance Discussion or action around maintaining pylint or the dev workflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migration to pyproject.toml
4 participants