Skip to content

Commit

Permalink
Produce a warning when the installation of both pypdf & fpdf2 package…
Browse files Browse the repository at this point in the history
…s is detected (#1042)
  • Loading branch information
Lucas-C authored Dec 5, 2023
1 parent c4da2ef commit 526f1ce
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ This can also be enabled programmatically with `warnings.simplefilter('default',

## [2.7.7] - Not released yet
### Added
* basic support for `<image>` elements in SVG vector graphics inserted
* SVG importing now supports clipping paths, and `defs` tags anywhere in the SVG file
* Basic support for `<image>` elements in SVG vector graphics inserted
* SVG importing now supports clipping paths, and `<defs>` tags anywhere in the SVG file
* [`FPDF.fonts.FontFace`](https://py-pdf.github.io/fpdf2/fpdf/fonts.html#fpdf.fonts.FontFace): Now has a static `combine` method that allows overriding a default FontFace (e.g. for specific cells in a table). Unspecified properties of the override FontFace retain the values of the default.
* [`TextColumns()`](https://py-pdf.github.io/fpdf2/TextColumns.html) can now have images inserted (both raster and vector).
* [`TextColumns()`](https://py-pdf.github.io/fpdf2/TextColumns.html) can now advance to the next column with the new `new_column()` method or a FORM_FEED character (`\u000c`) in the text.
Expand Down
15 changes: 14 additions & 1 deletion fpdf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* `fpdf.template.FlexTemplate`
"""

import sys
import warnings, sys

from .enums import Align, TextMode, XPos, YPos
from .errors import FPDFException
Expand All @@ -31,6 +31,19 @@
from .template import Template, FlexTemplate
from .deprecation import WarnOnDeprecatedModuleAttributes

try:
# This module only exists in PyFPDF, it has been removed in fpdf2 since v2.5.7:
# pylint: disable=import-self
from . import ttfonts

warnings.warn(
"You have both PyFPDF & fpdf2 installed. "
"Both packages cannot be installed at the same time as they share the same module namespace. "
"To only keep fpdf2, run: pip uninstall --yes pypdf && pip install --upgrade fpdf2"
)
except ImportError:
pass # no PyFPDF installation detected

FPDF_VERSION = _FPDF_VERSION
"Current fpdf2 version, also available as `__version__`"

Expand Down

0 comments on commit 526f1ce

Please sign in to comment.