Repository navigation
Unvendor libmpdec sources #115119
Copy link
Copy link
Closed
1 / 11 of 1 issue completedLabels
buildThe build process and cross-buildThe build process and cross-buildextension-modulesC modules in the Modules dirC modules in the Modules dir
Description
To facilitate cleaner updates of the externally-maintained libmpdec required by the _decimal module, we should migrate away from the bundled copy in Modules/_decimal/libmpdec and towards an "external" in cpython-source-deps for Windows and --with-system-libmpdec by default elsewhere.
My tentative plan is as follows:
- In 3.13:
- Add
mpdecimal-2.5.1andmpdecimal-4.0.0tocpython-source-deps: - Switch Windows build to
mpdecimal-2.5.1external (gh-115119: Switch Windows build to mpdecimal external #115182) - gh-115119: Detect _decimal dependencies using pkg-config #115406
- Update deps and build instructions wrt. libmpdecimal devguide#1313
- gh-115119: Update macOS installer to build with libmpdec 4.0.0 #118382
- gh-115119: Update Windows installer to mpdecimal 4.0.0 #118506
- Update macOS build to
mpdecimal-4.0.0 - gh-115119: Default to --with-system-libmpdec=yes #118539
- gh-115119: Bump CI to use Ubuntu 22.04 #118631
-
Post#118539: amend Ubuntu CI to use system installed mpdecimal - Update the docs; see Unvendor
libmpdecsources #115119 (comment) - gh-115119: Fall back to bundled libmpdec if system libmpdec is not found #119196
- Add
- In 3.15:
- Defer removal of bundled libmpdec in 3.15: gh-115119: defer removal of bundled libmpdec to 3.16 #133997
- Remove the implicit fallback to the bundled copy, keep support for explicit
--without-system-libmpdec(with warning): gh-115119: removed implicit fallback to the bundled libmpdec #134078
- In 3.16:
- Remove
--with[out]-system-libmpdecconfigureoptions andModules/_decimal/libmpdec/: gh-115119: Removed bundled copy of the libmpdec #133964
- Remove
Linked PRs
- gh-115119: Switch Windows build to mpdecimal external #115182
- gh-115119: Detect _decimal dependencies using pkg-config #115406
- gh-115119: Update macOS installer to build with libmpdec 4.0.0 #118382
- gh-115119: Update Windows installer to mpdecimal 4.0.0 #118506
- gh-115119: Default to --with-system-libmpdec=yes #118539
- gh-115119: Bump CI to use Ubuntu 22.04 #118631
- [3.12] gh-115119: Bump CI to use Ubuntu 22.04 (#118631) #118634
- gh-115119: Fall back to bundled libmpdec if system libmpdec is not found #119196
- [3.13] gh-115119: Fall back to bundled libmpdec if system libmpdec is not found (GH-119196) #119217
- gh-115119: Removed bundled copy of the libmpdec #133964
- gh-115119: defer removal of bundled libmpdec to 3.16 #133997
- gh-115119: removed implicit fallback to the bundled libmpdec #134078
- gh-115119: removed implicit fallback to the bundled libmpdec #135568
- [3.14] gh-115119: Defer removal of bundled libmpdec to 3.16 (GH-133997) #136199
- [3.13] gh-115119: Defer removal of bundled libmpdec to 3.16 (GH-133997) #136201
- gh-115119: recommend upstream libmpdec in build requirements #136205
- gh-115119: Document libmpdec dependency in the build doc #136239
- [3.14] gh-115119: Recommend upstream libmpdec in build requirements (GH-136205) #136244
- [3.13] gh-115119: Recommend upstream libmpdec in build requirements (#136205) #136245
- gh-115119: Defer
--with-system-libmpdecremoval to 3.16 #139318 - [3.14] gh-115119: Defer
--with-system-libmpdecremoval to 3.16 (GH-139318) #139347 - [3.13] gh-115119: Defer
--with-system-libmpdecremoval to 3.16 (GH-139318) #139348 - gh-115119: Update macOS installer to use libmpdecimal 4.0.1. #140077
- gh-115119: remove TEST_COVERAGE private macro (_decimal module) #149756
- gh-115119: Fix libmpdec detection when pkg-config files are missing #150502
- [3.14] gh-115119: Update macOS installer to use libmpdecimal 4.0.1. (GH-140077) #151123
- [3.13] gh-115119: Update macOS installer to use libmpdecimal 4.0.1. (GH-140077) #151124
- gh-115119: Fix licence page after removing bundled copy of libmpdec #157686
- gh-115119: Remove deprecated --with-system-mpdec option from iOS build. #159215
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
buildThe build process and cross-buildThe build process and cross-buildextension-modulesC modules in the Modules dirC modules in the Modules dir
Activity
erlend-aasland commentedon Feb 7, 2024
+1 for an autoconf warning.
ned-deily commentedon Feb 8, 2024
Adding an external libmpdec to the macOS installer build shouldn't be a big issue. Assign it to me if you proceed with this.
erlend-aasland commentedon Feb 8, 2024
FTR: the source deps repo is now updated.
pythongh-115119: Switch Windows build to mpdecimal external
pythongh-115119: Switch Windows build to mpdecimal external
erlend-aasland commentedon Feb 8, 2024
@ned-deily: for build-installer.py, is there more to do than adding a configuration for mpdecimal? I've used the following
configureoptions:['--disable-cxx', 'MACHINE=universal']ned-deily commentedon Feb 8, 2024
Likely yes, I'll take care of it. Thanks.
ned-deily commentedon Feb 13, 2024
I took a quick look at this and be aware that this change proposal will likely impact everyone building Python 3.13 on macOS. macOS does not ship a copy of libmpdec so, if the bundled version is removed, anyone building Python on macOS will now need to provide a local copy, either building from source or using a version from one of the widely-used third-party package managers, like Homebrew or MacPorts. Both currently have
mpdecimalpackages at the 4.0.0 level. (Recall that, unlike Windows builds, we do not currently provide non-vendored third-party library binaries for macOS users, other than those built for and linked into the Pythons provided by python.org installers for macOS.) In a quick test, it appeared that with./configure --with-system-libmpdectoday,pkg-configinfo forlibmpdecwas not being used. If so, that should be corrected. And, in any case, the devguide instructions for installing dependencies will need to be updated to cover libmpdec. We should add all this and get this working before moving on to changing the installer.erlend-aasland commentedon Feb 13, 2024
Last time I checked, libmpdec did not provide pkgconfig files:
ned-deily commentedon Feb 13, 2024
With the current 4.0.0 version, it appears both Homebrew and MacPorts ship them:
erlend-aasland commentedon Feb 13, 2024
Yes, the 4.0.0 version does indeed provide pkg-config configuration files. I'll work on an Autoconf patch.
pythongh-115119: Detect _decimal dependencies using pkg-config
133 remaining items
zware commentedon May 13, 2026
I consider the disappearance of
libmpdec{,-dev}in Ubuntu 24.04 to be a bug in that version of Ubuntu; lobby them to fix it.asottile commentedon May 13, 2026
it's an LTS, they don't add new packages. I've tried many times
asottile commentedon May 13, 2026
it's also not present in debian:bookworm
vstinner commentedon May 13, 2026
Can't you add libmpdev in deadsnakes PPA?
eli-schwartz commentedon May 13, 2026
I quite literally mean backport the
*.debpackaging format package for a dpkg package named "libmpdec". If I'd meant reverting a patch to revendor the source directory I'd say "forward port the libmpdec sources from older python", which is the opposite of a backport.The repository that you control is deadsnakes, hence backport from Ubuntu 26.04 to deadsnakes.
skirpichev commentedon May 14, 2026
@asottile, could you please point to build logs or elaborate a bit exact reason of failure? Missing libmpdec shouldn't prevent CPython 3.16 from build:
It might be that differences of pure-Python decimal module wrt the C extension break some your CI tests. In this case, please open issues.
They blindly follow unprofessional actions of Debian maintainers: https://bugs.debian.org/1056785.
BTW, this is not a problem for ubuntu 22.04 or 26.04. Tentative schedule for new GA images: actions/runner-images#13964 (comment)
Edit:
That means April 2034, i.e ~10 years. Any good reasons for this huge delay, given that the libmpdec is available in PPA and it's trivial to build it from sources?
python3: upgrade to 3.14.5rc1
gh-115119: Remove superfluous TEST_COVERAGE private macro from _decim…
gh-115119: Fix libmpdec detection when pkg-config files are missing (#…
[3.13] gh-115119: Update macOS installer to use libmpdecimal 4.0.1. (G…
[3.14] gh-115119: Update macOS installer to use libmpdecimal 4.0.1. (G…
edmorley commentedon Sep 3, 2026
Opened https://support-portal.canonical.com/tickets/00448718
gh-115119: Fix licence page after removing bundled copy of libmpdec (#…
edmorley commentedon Sep 22, 2026
Which resulted in a (currently in-progress) SRU request to add
libmpdec-devto noble, here:https://bugs.launchpad.net/ubuntu/+source/mpdecimal/+bug/2167730
gh-115119: Remove deprecated --with-system-mpdec option from iOS buil…