Skip to content

Conversation

@RaphaelFLT
Copy link

Hello,

This Pull Request addresses the maintenance task of migrating project configuration to the modern, standardized format.

Key Changes:

  1. Migrate Metadata: All project metadata (description, maintainers, dependencies, etc.) is moved from the legacy setup.py/setup.cfg to the [project] table in pyproject.toml.

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

  3. PEP 639 Compliance: Updated the license field to use the file = "LICENSE" approach, ensuring full compliance with PEP 639 for license specification.

  4. Integrate Tools: Configuration for pytest (including pytest-cov), black, isort, and flake8 has been consolidated under the [tool.*] tables in pyproject.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!

RaphaelFLT and others added 3 commits October 13, 2025 21:10
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.
@Lucas-C
Copy link
Member

Lucas-C commented Oct 15, 2025

A couple of notes:

  • we do not currently use flake8, even if its' mentioned in setup.cfg. I'd vote to get rid of this entry, as we are already using black
  • we do not currently use isort. While I'm open to discussion, I'm not sure that's a tool that we really need. It may be better to introduce it in a separate PR, and also ensure that it's checked in CI pipelines if we adopt it


authors = [
{ name = "Olivier PLATHEY" },
{ name = "Max" }
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
{ 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

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" }
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
{ name = "Lucas Cimon" }
{ name = "Lucas Cimon" }
{ name = " Anderson Herzogenrath da Costa (@andersonhc)"


dependencies = [
"defusedxml",
"Pillow>=8.0.0,!=9.2.*",
Copy link
Member

@Lucas-C Lucas-C Oct 15, 2025

Choose a reason for hiding this comment

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

Suggested change
"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 🙂

Comment on lines +85 to +97
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
'''
Copy link
Member

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?

Comment on lines +81 to +83
line-length = 88
target-version = ["py39", "py310", "py311", "py312"]
skip-string-normalization = false
Copy link
Member

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"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"Programming Language :: Python :: 3.9",

Since I have just merged #1620

{ name = "Lucas Cimon" }
]

keywords = ["pdf", "unicode", "png", "jpg", "ttf", "barcode"]
Copy link
Member

@Lucas-C Lucas-C Oct 15, 2025

Choose a reason for hiding this comment

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

Suggested change
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" }
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
version = { attr = "fpdf.FPDF_VERSION" }
version = { attr = "fpdf.fpdf:FPDF_VERSION" }

Copy link
Member

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?

Copy link
Collaborator

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

Copy link
Member

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 👍 🙂

@Lucas-C
Copy link
Member

Lucas-C commented Oct 15, 2025

@RaphaelFLT no hurry for reviewing our comments, take your time 🙂

Are you contributing as part of Hacktoberfest?

@RaphaelFLT
Copy link
Author

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

@Lucas-C
Copy link
Member

Lucas-C commented Oct 16, 2025

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.
Thank you for your time and interest in fpdf2.

Good luck with your studies.
Comme on dit en français : "merde" 🙂

@Lucas-C
Copy link
Member

Lucas-C commented Oct 17, 2025

I think we could publish a new version of fpdf2 once this is merged 🙂
We have quite a few new features & bugfixes pending release: https://github.com/py-pdf/fpdf2/blob/master/CHANGELOG.md

@Lucas-C
Copy link
Member

Lucas-C commented Oct 27, 2025

Hi 🙂 👋
We are close to the end of the month, I was just curious to know if you were willing to finish this PR as part of Hacktoberfest?

@RaphaelFLT
Copy link
Author

Hi 🙂 👋 We are close to the end of the month, I was just curious to know if you were willing to finish this PR as part of Hacktoberfest?

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:

========================== short test summary info ===========================
FAILED test/signing/test_sign.py::test_sign_pkcs12 - OSError: endesive.signer not available - PDF cannot be signed - Try: pip install endesive
FAILED test/signing/test_sign.py::test_sign_pkcs12_with_link - OSError: endesive.signer not available - PDF cannot be signed - Try: pip install endesive
================= 2 failed, 1599 passed, 2 skipped, 2 xfailed, 9 warnings in 146.72s =================

Even though I've confirmed that endesive is installed, these two tests still fail. Is this a known issue, or is it likely a problem on my end? ( I'm on MacOs)

Thanks for your patience! :)

@andersonhc
Copy link
Collaborator

Even though I've confirmed that endesive is installed, these two tests still fail. Is this a known issue, or is it likely a problem on my end? ( I'm on MacOs)

try pip install endesive[full]
or from the root of the library pip install -r test\requirements.txt - it includes endesive[full] and all other dependencies for the test suite.

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.

4 participants