- 
        Couldn't load subscription status. 
- Fork 317
Migrate project metadata from setup.py to pyproject.toml (PEP 639 Compliance) #1615
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: Lucas Cimon <[email protected]>
Merge branch 'master' of https://github.com/RaphaelFLT/fpdf2-ADSILLH Merge latest changes from the remote 'master' branch into local branch to resolve divergence before pushing final review fixes.
| A couple of notes: 
 | 
|  | ||
| authors = [ | ||
| { name = "Olivier PLATHEY" }, | ||
| { name = "Max" } | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| { name = "Max" } | |
| { name = "Max" } | |
| {name = "Lucas Cimon (@Lucas-C)" | 
Given that I maintain & contribute to fpdf2 since 2020, I would also like to be mention there please 🙂
Maybe @andersonhc & @alexanderankin would like to be mentioned too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My username would only be for historical preservation. I had found the library from Mariano Reingart and together with Lucas restored publishing and maintenance after long period of no maintenance. btw I maintain testcontainers-python now on a minimal basis and we use poetry (and thus pyproject.toml) with release-please.
| ] | ||
|  | ||
| maintainers = [ | ||
| { name = "Lucas Cimon" } | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| { name = "Lucas Cimon" } | |
| { name = "Lucas Cimon" } | |
| { name = " Anderson Herzogenrath da Costa (@andersonhc)" | 
|  | ||
| dependencies = [ | ||
| "defusedxml", | ||
| "Pillow>=8.0.0,!=9.2.*", | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "Pillow>=8.0.0,!=9.2.*", | |
| "Pillow>=8.0.0,!=9.2.*", # minimum version tested in .github/workflows/continuous-integration-workflow.yml | |
| # Version 9.2.0 is excluded due to DoS vulnerability with TIFF images: https://github.com/py-pdf/fpdf2/issues/628 | |
| # Version exclusion explained here: https://devpress.csdn.net/python/630462c0c67703293080c302.html | 
Please preserve explanatory comments from setup.cfg 🙂
| exclude = ''' | ||
| /( | ||
| \.git | ||
| | \.hg | ||
| | \.mypy_cache | ||
| | \.tox | ||
| | \.venv | ||
| | _build | ||
| | buck-out | ||
| | build | ||
| | dist | ||
| )/ | ||
| ''' | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessery given that we already have a .gitignore?
| line-length = 88 | ||
| target-version = ["py39", "py310", "py311", "py312"] | ||
| skip-string-normalization = false | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why introducing those settings?
| dynamic = ["version"] | ||
| description = "Simple & fast PDF generation for Python" | ||
| readme = "README.md" | ||
| requires-python = ">=3.9" | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| requires-python = ">=3.9" | |
| requires-python = ">=3.10" | 
Since I have just merged #1620
| "Intended Audience :: Developers", | ||
| "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", | ||
| "Programming Language :: Python", | ||
| "Programming Language :: Python :: 3.9", | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "Programming Language :: Python :: 3.9", | 
Since I have just merged #1620
| { name = "Lucas Cimon" } | ||
| ] | ||
|  | ||
| keywords = ["pdf", "unicode", "png", "jpg", "ttf", "barcode"] | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| keywords = ["pdf", "unicode", "png", "jpg", "ttf", "barcode"] | |
| keywords = ["pdf", "unicode", "png", "jpg", "ttf", "barcode", "library", "markdown"] | 
I had a look at the top 100 most used Pypi keywords: https://chezsoi.org/shaarli/shaare/ZNiBqA
library & markdown seem like good additions 🙂
| ] | ||
|  | ||
| [tool.setuptools.dynamic] | ||
| version = { attr = "fpdf.FPDF_VERSION" } | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| version = { attr = "fpdf.FPDF_VERSION" } | |
| version = { attr = "fpdf.fpdf:FPDF_VERSION" } | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the record, we have documented usages of from fpdf import FPDF_VERSION for a long time.
Example: https://github.com/py-pdf/fpdf2/blob/master/tutorial/tuto7.py#L4
So I'm not sure why/if this fix is needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we tried to build this PR it failed trying to import fpdf to get the version
https://github.com/py-pdf/fpdf2/actions/runs/18476680763
To import the main module to get the version number failed because fonttools was not available yet in the build environment
I believe we need this change so ast can get the string without a full import
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I understand now, thanks 👍 🙂
| @RaphaelFLT no hurry for reviewing our comments, take your time 🙂 Are you contributing as part of Hacktoberfest? | 
| 
 No, actually I'm doing it for my studies, we have to contribute to an open source project. I found this project interesting, so I'm trying to contribute to it. I'm very new to GitHub and not a great developer either, but you have to start somewhere. | 
| 
 You are very welcome. Good luck with your studies. | 
| I think we could publish a new version of  | 
| Hi 🙂 👋 | 
| 
 Hi, sorry for the delay; I've been quite busy for the last few weeks. I have now made the changes you requested. I ran the pytest locally and got the following results: Even though I've confirmed that  Thanks for your patience! :) | 
| 
 try  | 
Hello,
This Pull Request addresses the maintenance task of migrating project configuration to the modern, standardized format.
Key Changes:
Migrate Metadata: All project metadata (description, maintainers, dependencies, etc.) is moved from the legacy
setup.py/setup.cfgto the[project]table in pyproject.toml.Build System Standard: Adopted the modern PEP 517/PEP 621 build backend (via
setuptools.build_meta), which resolves the deprecation warning noted in the CI pipeline (as discussed in Updating Project Metadata to PEP 639 #1613 ).PEP 639 Compliance: Updated the
licensefield to use thefile = "LICENSE"approach, ensuring full compliance with PEP 639 for license specification.Integrate Tools: Configuration for
pytest(includingpytest-cov),black,isort, andflake8has been consolidated under the[tool.*]tables inpyproject.toml.Testing & Validation:
All original project information has been preserved in the new
pyproject.toml.The entire test suite (
pytest) runs successfully with this configuration locally (including coverage, text shaping, and encryption tests).This change ensures the project remains compatible with upcoming Python tooling changes and future versions of
pip.Thank you for the review!