Skip to content
Snippets Groups Projects
Commit 797272c9 authored by Simon McVittie's avatar Simon McVittie
Browse files

New upstream version 0.18.0

parent 5b7a447e
No related branches found
No related tags found
No related merge requests found
Showing
with 776 additions and 224 deletions
......@@ -41,9 +41,9 @@ debian-unstable_task:
cpu: 1
<< : *test
fedora-37_task:
fedora-41_task:
container:
dockerfile: ci/fedora-37.docker
dockerfile: ci/fedora-41.docker
cpu: 1
<< : *test
......@@ -55,12 +55,12 @@ manylinux-python3.13t_task:
PATH: "/opt/python/cp313-cp313t/bin/:${PATH}"
<< : *test
manylinux-python3.7_task:
manylinux-python3.8_task:
container:
dockerfile: ci/manylinux.docker
cpu: 1
env:
PATH: "/opt/python/cp37-cp37m/bin/:${PATH}"
PATH: "/opt/python/cp38-cp38/bin/:${PATH}"
<< : *test
miniconda_task:
......@@ -77,8 +77,8 @@ opensuse-15_task:
freebsd_task:
freebsd_instance:
image_family: freebsd-14-0
install_script: pkg install -y git ninja
image_family: freebsd-14-2
install_script: pkg install -y git ninja patchelf
<< : *test
macos-arm64_task:
......
......@@ -6,8 +6,12 @@ name: docs
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
branches:
- main
paths:
- docs/**
- CHANGELOG.rst
- README.md
pull_request:
branches:
- main
......@@ -16,10 +20,6 @@ on:
- docs/**
- CHANGELOG.rst
- README.md
workflow_dispatch:
inputs:
tag:
required: true
jobs:
......@@ -46,6 +46,6 @@ jobs:
environment:
name: github-pages
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || github.ref_type == 'tag' }}
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- uses: actions/deploy-pages@v4
......@@ -50,7 +50,7 @@ jobs:
- macos-13
- windows-latest
python:
- '3.7'
- '3.8'
- '3.13'
meson:
-
......@@ -60,7 +60,7 @@ jobs:
- os: ubuntu-latest
python: 'pypy-3.9'
- os: ubuntu-latest
python: 'pypy-3.10'
python: 'pypy-3.11'
- os: ubuntu-latest
python: '3.8'
- os: ubuntu-latest
......@@ -70,9 +70,6 @@ jobs:
# Test with older supported Meson version. Meson up to
# version 1.2.3 requires distutils, which has been removed
# from the stdlib in Python 3.12, thus test with Pythn 3.11.
- os: ubuntu-latest
python: '3.11'
meson: '~=0.63.3'
- os: ubuntu-latest
python: '3.11'
meson: '~=0.64.0'
......@@ -87,7 +84,13 @@ jobs:
meson: '~=1.2.3'
- os: ubuntu-latest
python: '3.12'
meson: '~=1.3'
meson: '~=1.3.0'
- os: ubuntu-latest
python: '3.12'
meson: '~=1.4.0'
- os: ubuntu-latest
python: '3.12'
meson: '~=1.5.0'
# Test with Meson master branch.
- os: ubuntu-latest
python: '3.12'
......@@ -95,13 +98,6 @@ jobs:
- os: windows-latest
python: '3.12'
meson: '@git+https://github.com/mesonbuild/meson.git'
# Test with older supported pyproject-metadata
- os: ubuntu-latest
python: '3.12'
pyproject_metadata: '==0.7.1'
- os: ubuntu-latest
python: '3.12'
pyproject_metadata: '==0.8.0'
steps:
- name: Checkout
......@@ -256,38 +252,6 @@ jobs:
run: python -m pytest --showlocals -vv
shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -leo pipefail -o igncr {0}
pyston:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python:
- '3.8'
meson:
-
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pyston
run: |
wget https://github.com/pyston/pyston/releases/download/pyston_2.3.5/pyston_2.3.5_20.04_amd64.deb
sudo apt install $(pwd)/pyston_2.3.5_20.04_amd64.deb
- name: Install Ninja
run: sudo apt-get install ninja-build
- name: Install Meson
run: python -m pip install "meson ${{ matrix.meson }}"
if: ${{ matrix.meson }}
- name: Install
run: pyston -m pip install .[test]
- name: Run tests
run: pyston -m pytest --showlocals -vv
homebrew:
runs-on: macos-latest
strategy:
......
......@@ -11,6 +11,35 @@
Changelog
+++++++++
0.18.0
======
- Drop Python 3.7 support.
- Bump minimum required Meson version to 0.64.0.
- Bump minimum required ``pyproject-metadata`` version to 0.9.0 to enable
support for PEP 639.
- Bump minimum required ``packaging`` version to 23.2. ``pyproject-metadata``
version 0.9.1 requires this version of ``packaging`` but fails to record the
version requirement in the package metadata. Enforcing the version
requirement in ``meson-python`` allows fixing possible dependency problems
without having ``meson-python`` depend on a very recent
``pyproject-metadata`` release.
- Add support for PEP 639 metadata fields. Canonicalization and validation of
the license expression requires ``packaging`` version 24.2 or later.
- Add support for declaring the ``licence`` and ``license-files`` as dynamic
fields in ``pyproject.toml`` to extract the package license and license
files from the ones declared via the ``project()`` call in
``meson.build``. This requires Meson version 1.6.0 or later.
- Add support for ``RPATH`` handling on SunOS.
- Include shared libraries built as part of the Meson project in the Python
wheels also on Windows, when explicitly enabled via the
``tool.meson-python.allow-windows-internal-shared-libs`` project setting.
- Add support for symbolic links that point to files within the source tree.
They are now included as regular files in the sdist archive.
Daniele Nicolodi, Marcel Telka, Ralf Gommers --- 30-04-2025.
0.17.1
======
......@@ -19,6 +48,7 @@ Changelog
Daniele Nicolodi --- 23-10-2024.
0.17.0
======
......@@ -45,6 +75,7 @@ Daniele Nicolodi --- 23-10-2024.
Christian Clauss, Daniele Nicolodi, Jonathan J. Helmus, Leo Singer, Loïc
Estève, Michael Simacek, Ralf Gommers, Simon McVittie --- 19-10-2024.
0.16.0
======
......
Metadata-Version: 2.1
Metadata-Version: 2.4
Name: meson-python
Version: 0.17.1
Version: 0.18.0
Summary: Meson Python build backend (PEP 517)
Keywords: meson,build,backend,pep517,package
Maintainer-Email: Ralf Gommers <ralf.gommers@gmail.com>, Daniele Nicolodi <daniele@grinta.net>, Henry Schreiner <HenrySchreinerIII@gmail.com>, Thomas Li <47963215+lithomas1@users.noreply.github.com>
License: Copyright © 2022 the meson-python contributors
Copyright © 2021 Quansight Labs and Filipe Laíns
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
License-Expression: MIT
License-File: LICENSES/MIT.txt
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python
Classifier: Topic :: Software Development :: Build Tools
......@@ -33,15 +13,14 @@ Project-URL: homepage, https://github.com/mesonbuild/meson-python
Project-URL: repository, https://github.com/mesonbuild/meson-python
Project-URL: documentation, https://mesonbuild.com/meson-python/
Project-URL: changelog, https://mesonbuild.com/meson-python/changelog.html
Requires-Python: >=3.7
Requires-Dist: meson>=0.63.3; python_version < "3.12"
Requires-Python: >=3.8
Requires-Dist: meson>=0.64.0; python_version < "3.12"
Requires-Dist: meson>=1.2.3; python_version >= "3.12"
Requires-Dist: packaging>=19.0
Requires-Dist: pyproject-metadata>=0.7.1
Requires-Dist: packaging>=23.2
Requires-Dist: pyproject-metadata>=0.9.0
Requires-Dist: tomli>=1.0.0; python_version < "3.11"
Provides-Extra: test
Requires-Dist: build; extra == "test"
Requires-Dist: packaging>=23.1; extra == "test"
Requires-Dist: pytest>=6.0; extra == "test"
Requires-Dist: pytest-cov[toml]; extra == "test"
Requires-Dist: pytest-mock; extra == "test"
......@@ -49,8 +28,8 @@ Requires-Dist: cython>=3.0.3; extra == "test"
Requires-Dist: wheel; extra == "test"
Requires-Dist: typing-extensions>=3.7.4; python_version < "3.11" and extra == "test"
Provides-Extra: docs
Requires-Dist: furo>=2023.5.20; extra == "docs"
Requires-Dist: sphinx~=6.2; extra == "docs"
Requires-Dist: furo>=2024.08.06; extra == "docs"
Requires-Dist: sphinx~=8.1.0; extra == "docs"
Requires-Dist: sphinx-copybutton>=0.5.0; extra == "docs"
Requires-Dist: sphinx-design>=0.1.0; extra == "docs"
Requires-Dist: sphinxext-opengraph>=0.7.0; extra == "docs"
......
......@@ -19,7 +19,7 @@ After that is done, you may release the project by following these steps:
#. Create the release commit
#. Bump the versions in ``meson.build`` and ``mesonpy/__init__.py``.
#. Bump the versions in ``pyproject.toml`` and in ``mesonpy/__init__.py``.
#. Create ``CHANGELOG.rst`` section for the new release and fill it.
#. The commit message should read: ``REL: set version to X.Y.Z``
......
......@@ -2,6 +2,6 @@
#
# SPDX-License-Identifier: MIT
# 20240817
# 20250212
FROM alpine:3
RUN apk add --no-cache python3-dev py3-pip build-base ninja-is-really-ninja git patchelf
......@@ -2,6 +2,6 @@
#
# SPDX-License-Identifier: MIT
# 20221203
# 20250127
FROM archlinux:latest
RUN pacman -Syu --noconfirm && pacman -S --noconfirm python python-pip gcc ninja git patchelf
......@@ -2,6 +2,6 @@
#
# SPDX-License-Identifier: MIT
# 20240204
# 20250212
FROM debian:bullseye
RUN apt-get update && apt-get install -y git ninja-build patchelf python3-pip python3-venv && rm -rf /var/lib/apt/lists/*
......@@ -2,6 +2,6 @@
#
# SPDX-License-Identifier: MIT
# 20240204
# 20250127
FROM debian:bookworm
RUN apt-get update && apt-get install -y git ninja-build patchelf python3-pip python3-venv && rm -rf /var/lib/apt/lists/*
......@@ -2,6 +2,6 @@
#
# SPDX-License-Identifier: MIT
# 20240204
FROM fedora:37
# 20250127
FROM fedora:41
RUN dnf -y update && dnf -y install python3-devel python3-pip gcc ninja-build git patchelf && dnf clean all
.. SPDX-FileCopyrightText: 2021 The meson-python developers
..
.. SPDX-License-Identifier: MIT
.. Contributors list for the latest release can be generated with
git log --format='%aN' $PREV..HEAD | sort -u | awk '$1=$1' RS='' FS='\n' OFS=', '
+++++++++
Changelog
+++++++++
0.18.0
======
- Drop Python 3.7 support.
- Bump minimum required Meson version to 0.64.0.
- Bump minimum required ``pyproject-metadata`` version to 0.9.0 to enable
support for PEP 639.
- Bump minimum required ``packaging`` version to 23.2. ``pyproject-metadata``
version 0.9.1 requires this version of ``packaging`` but fails to record the
version requirement in the package metadata. Enforcing the version
requirement in ``meson-python`` allows fixing possible dependency problems
without having ``meson-python`` depend on a very recent
``pyproject-metadata`` release.
- Add support for PEP 639 metadata fields. Canonicalization and validation of
the license expression requires ``packaging`` version 24.2 or later.
- Add support for declaring the ``licence`` and ``license-files`` as dynamic
fields in ``pyproject.toml`` to extract the package license and license
files from the ones declared via the ``project()`` call in
``meson.build``. This requires Meson version 1.6.0 or later.
- Add support for ``RPATH`` handling on SunOS.
- Include shared libraries built as part of the Meson project in the Python
wheels also on Windows, when explicitly enabled via the
``tool.meson-python.allow-windows-internal-shared-libs`` project setting.
- Add support for symbolic links that point to files within the source tree.
They are now included as regular files in the sdist archive.
Daniele Nicolodi, Marcel Telka, Ralf Gommers --- 30-04-2025.
0.17.1
======
- Update tests to work with newly released ``pyproject-metadata`` 0.9.0.
- Fix tests to work when not executed in a git work tree.
Daniele Nicolodi --- 23-10-2024.
0.17.0
======
- Refuse to build wheels targeting the limited API and free-threaded CPython:
the free-threaded CPython build does not support the limited API yet.
- Always use UTF-8 encoding for writing Meson native and cross files. Always
use UTF-8 encoding for reading read Meson introspection data and
``pyproject.toml``.
- Do not include uncommitted changes when creating source distributions.
Previously, uncommitted changes to files under version control were
included, but not untracked files. There was no strong use case for this
behavior and it was too surprising to keep it.
- Make source distribution reproducible: use the modification time of
``pyproject.toml`` for the generated files in the source distribution
archives.
- Disable the ``abi3`` wheel tag for PyPy when building wheels targeting the
limited API: PyPy supports the limited API but not the stable ABI.
- Raise ``ImportError`` when the package rebuild fails when importing an
editable install.
- Fix the wheel platform tag for GraalPy.
- Add ``.gitignore`` and ``.hgignore`` files to build directory if it is empty.
- Allow ``install_subdir()`` of missing directories.
Christian Clauss, Daniele Nicolodi, Jonathan J. Helmus, Leo Singer, Loïc
Estève, Michael Simacek, Ralf Gommers, Simon McVittie --- 19-10-2024.
0.16.0
======
- Correctly detect a wheel shipping shared libraries as being platform
dependent also when it does not ship compiled executables or Python
extension modules.
- Use 11.0 as minimum macOS platform ABI tag on arm64: lower versions
do not exist on arm64.
- Improve parsing of the ``$ARCHFLAGS`` environment
variable. Correctly handle repeated ``-arch`` flags.
- Do not break when trying to log filename containing Unicode
characters that cannot be encoded in the encoding used by the
standard output stream.
- Drop dependency on ``colorama`` on Windows.
- Suppress all uses of ANSI terminal escapes when logging to a stream
that does not support them.
- Fix ANSI escape coloring of error messages.
- Respect the ``exclude_dirs`` and ``exclude_files`` arguments passed
to the ``install_subdir()`` Meson function in editable installs too.
- Make ``pkgutil.iter_packages()`` work properly for modules loaded
from editable installs.
- Add support for the ``custom_target()`` Meson function installing a
directory.
- In editable installs, when a rebuild is triggered on module import,
emit a message indicating that the package is being rebuilt but
suppress any output when there is no work to do.
Daniele Nicolodi, Loïc Estève, Ralf Gommers --- 16-04-2024
0.15.0
======
- Enable compression for wheel files. The may result in several times
smaller wheels.
- Require Meson 1.2.3 or later on Python 3.12 or later. Meson 1.2.3
does not require anymore ``distutils``, allowing to remove the
dependency on ``setuptools`` on Python 3.12 or later.
- Unconditionally require ``patchelf`` on Linux. The ``patchelf``
package is added to the build dependencies if a suitable
``patchelf`` executable is not find on the ``$PATH``. This avoids
cases where ``meson setup`` was run twice during the build process
to determine whether ``patchelf`` is required.
- Allow to configure the ``meson`` executable to use for the build
process through the ``$MESON`` environment variable or the ``meson``
key under ``[tool.meson-python]`` in ``pyproject.toml``.
- Fix wheel platform tag generation on FreeBSD.
- Extend support to other UNIX-like systems and make the tests pass on
FreeBSD.
- Fix package name normalization in package metadata and improve
package name validation.
- Fix ``RPATH`` handling when the build ``RPATH`` points to
subdirectories of the build directory.
- Fix support for the Python limited C API when compiling for PyPy.
- Rename the ``builddir`` config-setting to ``build-dir``. For
backwards compatibility, the ``buildir`` config-setting remains
supported as an alias.
Christoph Reiter, Daniele Nicolodi, Elliott Sales de Andrade, Ralf Gommers,
Yue Yang --- 26-10-2023
0.14.0
======
- Do not run ``meson install`` to build a wheel. This was unnecessary
as files are added to the wheel from the build and source
directories. This does not affect the handling of ``meson install``
options, which are interpreted by ``meson-python`` itself.
- Obey the ``--skip-subprojects`` when specified for the ``meson
install`` command.
- Implement support for the ``exclude_directories`` and
``exclude_files`` arguments to Meson ``install_subdir()`` function
and similar installation functions. This requires Meson version
1.1.0 or later.
- Implement support for building wheels targeting the Python limited
API. Extension modules targeting the Python limited API can be
easily built starting with the upcoming Meson 1.3.0 release.
- When ``pyproject.toml`` does not contain a ``version`` field and
``version`` is not declared dynamic, raise an error instead of
silently using the version declared in ``meson.build``.
- Fix the mtime of source files in the sdist tarball.
- Add ``objc`` and ``objcpp`` compilers to the cross file generated
when the ``$ARCHFLAGS`` is set.
- Extensive documentation improvements.
Charles Brunet, Daniele Nicolodi, Henry Schreiner, Michał Górny, Ralf
Gommers --- 05-09-2023
0.13.2
======
- Fix system name in cross file generated when using ``$ARCHFLAGS``.
- Fix handling of ``null`` Meson install tags.
Charles Brunet, Daniele Nicolodi --- 22-06-2023.
0.13.1
======
- Fix regression in cross-compilation via ``$ARCHFLAGS`` on macOS where the
cross file was written in the build directory before it was created,
resulting in an error.
- Do not require setting ``$_PYTHON_HOST_PLATFORM`` when cross-compiling via
``$ARCHFLAGS`` on macOS.
- Add the ``--quiet`` option when invoking ``meson install``. The installation
paths are a detail of the ``meson-python`` implementation and are generally
not interesting for the user.
- Fix terminal logging when overriding the current line when listing files
added to the wheel.
- Improve the error message emitted when a package split between the
``purelib`` and ``platlib`` wheel locations is detected.
Daniele Nicolodi, Ralf Gommers --- 28-04-2023.
0.13.0
======
- Add support for editable installs.
- Adjust the default build options passed to ``meson setup``.
- Make sure that the directory where the wheel or sdist build artifacts are
created exists. Fixes building with PDM.
- Fix the specification of the C++ compiler for cross-compilation with
``$ARCHFLAGS`` on macOS.
- Pass the ``--reconfigure`` option to ``meson setup`` if and only if the
specified build directory exists and is a valid Meson build directory.
- Pass the ``--no-rebuild`` option to ``meson install``.
- Allow to select the files to be included in the wheel via Meson install tags
passing the ``--tags`` option to ``meson install`` via ``pyproject.toml`` or
config settings.
- Do not use the ``meson compile`` indirection to build the project, except on
Windows, where it is required to setup the Visual Studio environment.
- Do not add ``ninja`` to the build dependencies if ``$NINJA`` is set but it
does not point to a ``ninja`` executable with the required minimum version.
- Verify at run time that Meson satisfies the minimum required version.
- Place native and cross files in the build directory instead of in the
source directory.
- Drop the ``typing-extensions`` package dependency.
- Add dependency on ``setuptools`` on Python 3.12 and later. This fixes build
error due to Meson depending on the ``distutils`` standard library module
removed in Python 3.12.
- Bump the required ``pyproject-metadata`` version to 0.7.1.
- Allows some more cross-compilation setups by not checking extension modules
filename suffixes against the suffixes accepted by the current interpreter.
- Raise an error when a file that would be installed by Meson cannot be mapped
to a wheel location.
- Raise an error when a package is split between ``platlib`` and ``purelib``.
- Do not generate a warning when ``pyproject.toml`` does not contain a
``project`` section and Python package metadata is derived from ``meson.build``.
- Improve reporting of ``pyproject.toml`` validation errors.
- Fix validation of tool specific options in ``pyproject.toml``. In
particular, allows to specify an incomplete set of options in the
``tool.meson-python.args`` table.
Daniele Nicolodi, Doron Behar, Eli Schwartz, Filipe Laíns, Lars Pastewka,
Luigi Giugliano, Matthias Köppe, Peter Urban, Ralf Gommers, Stefan van der
Walt, Thomas Li --- 18-04-2023.
0.12.1
======
- Fix regression where the ``$MACOSX_DEPLOYMENT_TARGET`` environment variable
was accidentally renamed to ``$MACOS_DEPLOYMENT_TARGET``.
Filipe Laíns, Stefan van der Walt --- 17-02-2023.
0.12.0
======
- Require the ``typing_extensions`` package for Python < 3.10 rather than for
Python < 3.8 only.
- Emit an error message and raise ``SystemExit`` on expected errors.
- Revise error messages for consistency.
- Support setuptools-style macOS cross compilation via ``$ARCHFLAGS``.
- Allow to overwrite macOS platform tag via ``$_PYTHON_HOST_PLATFORM``.
- Include an hint with the most similar known option names in the error
message emitted when an unknown config setting is encountered.
Daniele Nicolodi, Filipe Laíns, Henry Schreiner, Matthias Köppe, Thomas A
Caswell --- 22-12-2022.
0.11.0
======
- Project moved to the ``mesonbuild`` organization.
- Determine wheel tags by introspecting the Python interpreter.
- Allow users to pass options directly to Meson via the ``dist``, ``setup``,
``compile``, and ``install`` entries in the ``tools.meson-python.args``
table in ``pyproject.toml``, or via the ``dist-args``, ``setup-args``,
``compile-args``, and ``install-args`` config settings.
- Use the system ``ninja`` if possible. Return ``ninja`` as a build dependency
otherwise.
- Include files generated by ``mesonadd_dist_script`` in the sdist.
- Use ``tomllib`` on Python 3.11 or later.
- Drop the ``wheel`` package dependency.
- Fix bug where the ``entry_points.txt`` file was not generated.
- Fix bug where Cygwin Python extensions were not being noticed.
Ben Greiner, Daniele Nicolodi, Filipe Laíns, Henry Schreiner, Matthias Köppe,
Ralf Gommers, Sam Thursfield, Thomas Li --- 21-11-2022.
0.10.0
======
- Ignore the minor version on macOS 11 or later, to match the behavior of
``pypa/packaging``.
Filipe Laíns, Ralf Gommers --- 05-10-2022.
0.9.0
=====
- More fixes on ABI tag detection.
- Fix incorrect tag on 32-bit Python running on a x86_64 host.
- Fix sdist permissions.
- Fix incorrect PyPy tags.
- Fix ``install_subdirs`` not being included in wheels.
- Take ``MACOSX_DEPLOYMENT_TARGET`` into account for the platform tag.
- Don't set the rpath on binaries if unneeded.
Eli Schwartz, Filipe Laíns, Matthias Köppe, Peyton Murray, Ralf Gommers,
Thomas Kluyver, Thomas Li --- 29-09-2022.
0.8.1
=====
- Fix ``UnboundLocalError`` in tag detection code.
Filipe Laíns, Ralf Gommers --- 28-07-2022.
0.8.0
=====
- Fix sometimes the incorrect ABI tags being generated.
- Add workaround for macOS 11 and 12 installations that are missing a minor
version in the platform string.
Filipe Laíns --- 26-07-2022.
0.7.0
=====
- Fix the wrong Python and ABI tags being generated in Meson 0.63.0.
- Fix project license not being included in the project metadata.
Filipe Laíns, Ralf Gommers --- 22-07-2022.
0.6.0
=====
- Project re-licensed to MIT.
- Error out when running in an unsupported interpreter.
- Fix slightly broken Debian heuristics.
- Update ``pep621`` dependency to ``pyproject-metadata``.
Filipe Laíns, Ralf Gommers, Thomas A Caswell --- 21-06-2022.
0.5.0
=====
- Improvements in dependency detections.
- Include uncommited changes in sdists.
Filipe Laíns --- 26-05-2022.
0.4.0
=====
- Set sane default arguments for release builds.
Filipe Laíns --- 06-05-2022.
0.3.0
=====
- Initial cross-platform support.
- Bundling libraries is still only supported on Linux.
- Add initial documentation.
- The build directory is now located in the project source.
Filipe Laíns, Rafael Silva --- 23-03-2022.
0.2.1
=====
- Fix getting the project version dynamically from Meson.
Filipe Laíns --- 26-02-2022.
0.2.0
=====
- Select the correct ABI and Python tags.
- Force Meson to use the correct Python executable.
- Replace auditwheel with in-house vendoring mechanism.
Filipe Laíns --- 24-01-2022.
0.1.2
=====
- Fix auditwheel not being run.
Filipe Laíns --- 12-11-2021.
0.1.1
=====
- Fix minor compatibility issue with Python < 3.9.
Filipe Laíns --- 28-10-2021.
0.1.0
=====
- Initial release.
Filipe Laíns --- 28-10-2021.
......@@ -2,108 +2,30 @@
#
# SPDX-License-Identifier: MIT
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
import datetime
import os
import time
import sys
sys.path.insert(0, os.path.abspath('..'))
import mesonpy
build_date = datetime.datetime.fromtimestamp(
int(os.environ.get('SOURCE_DATE_EPOCH', time.time())),
tz=datetime.timezone.utc,
)
# -- Project information -----------------------------------------------------
_build_time = int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))
_build_date = datetime.datetime.fromtimestamp(_build_time, tz=datetime.timezone.utc)
project = 'meson-python'
copyright = f'2021\N{EN DASH}{build_date.year} The meson-python developers'
# The short X.Y version
version = mesonpy.__version__
# The full version, including alpha/beta/rc tags
release = mesonpy.__version__
copyright = f'2021\N{EN DASH}{_build_date.year} The meson-python developers'
html_theme = 'furo'
html_title = f'meson-python'
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.todo',
'sphinx_copybutton',
'sphinx_design',
'sphinxext.opengraph',
'sphinx.ext.intersphinx',
]
try:
import sphinxcontrib.spelling
extensions.append('sphinxcontrib.spelling')
spelling_show_suggestions = True
spelling_warning = True
except ImportError:
pass
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []
default_role = 'any'
todo_include_todos = True
# sphinx.ext.intersphinx
intersphinx_mapping = {'python': ('https://docs.python.org/3', None)}
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'furo'
html_title = f'meson-python {version}'
html_static_path = ['static']
html_css_files = [
'css/contributors.css',
]
html_theme_options = {
'light_css_variables': {
'font-stack': (
'system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,'
'Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji'
),
},
}
# Open Graph
# sphinxext.opengraph
ogp_site_url = 'https://mesonbuild.com/meson-python/'
ogp_site_name = 'meson-python documentation'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named 'default.css' will overwrite the builtin 'default.css'.
# html_static_path = ['_static']
.. SPDX-FileCopyrightText: 2024 The meson-python developers
..
.. SPDX-License-Identifier: MIT
.. _shared-libraries:
**********************
Using shared libraries
**********************
Python projects may build shared libraries as part of their project, or link
with shared libraries from a dependency. This tends to be a common source of
issues, hence this page aims to explain how to include shared libraries in
wheels, any limitations and gotchas, and how support is implemented in
``meson-python`` under the hood.
We distinguish between *internal* shared libraries that are built as part of
the project, and *external* shared libraries that are provided by project
dependencies and that are linked with the project build artifacts.
For internal shared libraries, we also distinguish whether the shared library
is being installed to its default system location (typically
``/usr/local/lib`` on Unix-like systems, and ``C:\\lib`` on Windows - we call
this ``libdir`` in this guide) or to a location in ``site-packages`` within the
Python package install tree. All these scenarios are (or will be) supported,
with some caveats:
+-----------------------+------------------+------------+-------+-------+
| shared library source | install location | Windows | macOS | Linux |
+=======================+==================+============+=======+=======+
| internal | libdir | ✓ :sup:`1` | ✓ | ✓ |
+-----------------------+------------------+------------+-------+-------+
| internal | site-packages | ✓ | ✓ | ✓ |
+-----------------------+------------------+------------+-------+-------+
| external | --- | ✓ :sup:`2` | ✓ | ✓ |
+-----------------------+------------------+------------+-------+-------+
.. TODO: add subproject as a source
1. Support for internal shared libraries on Windows is enabled with the
:option:`tool.meson-python.allow-windows-internal-shared-libs` option and
requires cooperation from the package to extend the DLL search path or
preload the required libraries. See below for more details.
2. External shared libraries require ``delvewheel`` usage on Windows (or some
equivalent way, like amending the DLL search path to include the directory
in which the external shared library is located). Due to the lack of
`RPATH <https://en.wikipedia.org/wiki/Rpath>`__ support on Windows, there is
no good way around this.
.. _internal-shared-libraries:
Internal shared libraries
=========================
A shared library produced by ``library()`` or ``shared_library()`` built like this
.. code-block:: meson
example_lib = shared_library(
'example',
'examplelib.c',
install: true,
)
is installed to ``libdir`` by default. If the only reason the shared library exists
is to be used inside the Python package being built, then it is best to modify
the install location to be within the Python package itself:
.. code-block:: python
install_path: py.get_install_dir() / 'mypkg/subdir'
Then an extension module in the same install directory can link against the
shared library in a portable manner by using ``install_rpath``:
.. code-block:: meson
py3.extension_module('_extmodule',
'_extmodule.c',
link_with: example_lib,
install: true,
subdir: 'mypkg/subdir',
install_rpath: '$ORIGIN'
)
The above method will work as advertised on macOS and Linux; ``meson-python`` does
nothing special for this case. Windows needs some special handling though, due to
the lack of RPATH support:
.. literalinclude:: ../../tests/packages/sharedlib-in-package/mypkg/__init__.py
:start-after: start-literalinclude
:end-before: end-literalinclude
If an internal shared library is not only used as part of a Python package,
but for example also as a regular shared library then the method shown above
won't work. The library is then marked for installation into the system
default ``libdir`` location. Actually installing into ``libdir`` isn't
possible with wheels, hence ``meson-python`` will instead do the following:
1. Install the shared library to the ``.<project-name>.mesonpy.libs``
top-level directory in the wheel, which on install will end up in
``site-packages``.
2. On platforms other than Windows, rewrite RPATH entries for install targets
that depend on the shared library to point to that new install location
instead.
On platforms other than Windows, this will make the shared library work
automatically, with no other action needed from the package author. On
Windows, due to the lack of RPATH support, the ``.<project-name>.mesonpy.libs``
location search path needs to be added to the DLL search path, with code
similar to the one presented above. For this reason, handling of internal
shared libraries on Windows is conditional to setting the
:option:`tool.meson-python.allow-windows-internal-shared-libs` option.
External shared libraries
=========================
External shared libraries are installed somewhere on the build machine, and
usually detected by a ``dependency()`` or ``compiler.find_library()`` call in a
``meson.build`` file. When a Python extension module or executable uses the
dependency, the shared library will be linked against at build time.
If the shared library is located in a directory on the loader search path,
the wheel created by ``meson-python`` will work locally when installed.
If it's in a non-standard location however, the shared library will go
missing at runtime. The Python extension module linked against it needs an
RPATH entry - and Meson will not automatically manage RPATH entries for you.
Hence you'll need to add the needed RPATH yourself, for example by adding
``-Wl,rpath=/path/to/dir/sharedlib/is/in`` to ``LDFLAGS`` before starting
the build. In case you run into this problem after a wheel is built and
installed, adding that same path to the ``LD_LIBRARY_PATH`` environment variable is a quick way of
checking if that is indeed the problem.
On Windows, the solution is similar - the shared library can either be
preloaded, or the directory that the library is located in added to the DLL
search path with ``os.add_dll_directory``, or vendored into the wheel with
``delvewheel`` in order to make the built Python package usable locally.
Publishing wheels which depend on external shared libraries
-----------------------------------------------------------
On all platforms, wheels which depend on external shared libraries usually need
post-processing to make them usable on machines other than the one on which
they were built. This is because the RPATH entry for an external shared library
contains a path specific to the build machine. This post-processing is done by
tools like ``auditwheel`` (Linux), ``delvewheel`` (Windows), ``delocate``
(macOS) or ``repair-wheel`` (any platform, wraps the other tools).
Running any of those tools on a wheel produced by ``meson-python`` will vendor
the external shared library into the wheel and rewrite the RPATH entries (it
may also do some other things, like symbol mangling).
On Windows, the package author may also have to add the preloading like shown
above with ``_append_to_sharedlib_load_path()`` to the main ``__init__.py`` of
the package, ``delvewheel`` may or may not take care of this (please check its
documentation if your shared library goes missing at runtime).
Note that we don't cover using shared libraries contained in another wheel
and depending on such a wheel at runtime in this guide. This is inherently
complex and not recommended (you need to be in control of both packages, or
upgrades may be impossible/breaking).
Using libraries from a Meson subproject
=======================================
It can often be useful to build a shared library in a
`Meson subproject <https://mesonbuild.com/Subprojects.html>`__, for example as
a fallback in case an external dependency isn't detected. There are two main
strategies for folding a library built in a subproject into a wheel built with
``meson-python``:
1. Build the library as a static library instead of a shared library, and
link it into a Python extension module that needs it.
2. Build the library as a shared library, and either change its install path
to be within the Python package's tree, or rely on ``meson-python`` to fold
it into the wheel when it'd otherwise be installed to ``libdir``.
Option (1) tends to be easier, so unless the library of interest cannot be
built as a static library or it would inflate the wheel size too much because
it's needed by multiple Python extension modules, we recommend trying option
(1) first.
A typical C or C++ project providing a library to link against tends to provide
(a) one or more ``library()`` targets, which can be built as shared, static, or both,
and (b) headers, pkg-config files, tests and perhaps other development targets
that are needed to use the ``library()`` target(s). One of the challenges to use
such projects as a subproject is that the headers and other installable targets
are targeting system locations (e.g., ``<prefix>/include/``) which isn't supported
by wheels and hence ``meson-python`` errors out when it encounters such an install
target. This is perhaps the main issue one encounters with subproject usage,
and the following two sections discuss how options (1) and (2) can work around
that.
Static library from subproject
------------------------------
The major advantage of building a library target as static and folding it directly
into an extension module is that no targets from the subproject need to be installed.
To configure the subproject for this use case, add the following to the
``pyproject.toml`` file of your package:
.. code-block:: toml
[tool.meson-python.args]
setup = ['--default-library=static']
install = ['--skip-subprojects']
This ensures that ``library`` targets are built as static, and nothing gets installed.
To then link against the static library in the subproject, say for a subproject
named ``bar`` with the main library target contained in a ``bar_dep`` dependency,
add this to your ``meson.build`` file:
.. code-block:: meson
bar_proj = subproject('bar')
bar_dep = bar_proj.get_variable('bar_dep')
py.extension_module(
'_example',
'_examplemod.c',
dependencies: bar_dep,
install: true,
)
That is all!
Shared library from subproject
------------------------------
If we can't use the static library approach from the section above and we need
a shared library, then we must have ``install: true`` for that shared library
target. This can only work if we can pass some build option to the subproject
that tells it to *only* install the shared library and not headers or other
targets that we don't need. Install tags don't work per subproject, so
this will look something like:
.. code-block:: meson
foo_subproj = subproject('foo',
default_options: {
# This is a custom option - if it doesn't exist, can you add it
# upstream or in WrapDB?
'only_install_main_lib': true,
})
foo_dep = foo_subproj.get_variable('foo_dep')
Now we can use ``foo_dep`` like a normal dependency, ``meson-python`` will
include it into the wheel in ``.<project-name>.mesonpy.libs`` just like an
internal shared library that targets ``libdir`` (see
:ref:`internal-shared-libraries`).
*Remember: this method doesn't support Windows (yet)!*
......@@ -82,6 +82,7 @@ the use of ``meson-python`` and Meson for Python packaging.
how-to-guides/config-settings
how-to-guides/meson-args
how-to-guides/debug-builds
how-to-guides/shared-libraries
reference/limitations
projects-using-meson-python
......
......@@ -25,22 +25,7 @@ run-time inside the package alongside the Python code, and use
access them.
Shared libraries on Windows
===========================
On Windows, ``meson-python`` cannot encapsulate shared libraries
installed as part of the Meson project into the Python wheel for
Python extension modules or executables, in a way suitable for them to
be found at run-time.
This limitation can be overcome with static linking or using
`delvewheel`_ to post-process the Python wheel to bundle the required
shared libraries and include the setup code to properly set the
library search path.
.. _install_data(): https://mesonbuild.com/Reference-manual_functions.html#install_data
.. _importlib-resources: https://importlib-resources.readthedocs.io/en/latest/index.html
.. _delvewheel: https://github.com/adang1345/delvewheel
.. |install_data()| replace:: ``install_data()``
......@@ -15,9 +15,9 @@ maintain compatibility with as old as possible Meson releases.
However, some functionality is available only with more recent Meson
versions.
.. option:: 0.63.3
.. option:: 0.64.0
Meson is 0.63.3 is the minimum required version.
Meson is 0.64.0 is the minimum required version.
.. option:: 1.1.0
......@@ -26,6 +26,12 @@ versions.
and similar installation functions. On older Meson versions, these
arguments have no effect.
.. option:: 1.2.0
Meson 1.2.0 or later is required to support the ``--skip-subprojects``
option that can be passed to ``meson install`` to not include files
installed by some or all subprojects in the Python wheel.
.. option:: 1.2.3
Meson 1.2.3 or later is required to support Python 3.12 or later.
......@@ -39,6 +45,13 @@ versions.
Meson 1.3.0 or later is required for compiling extension modules
targeting the Python limited API.
.. option:: 1.6.0
Meson 1.6.0 or later is required to support ``license`` and
``license-files`` dynamic fields in ``pyproject.toml`` and to
populate the package license and license files from the ones
declared via the ``project()`` call in ``meson.build``.
Build front-ends by default build packages in an isolated Python
environment where build dependencies are installed. Most often, unless
a package or its build dependencies declare explicitly a version
......
......@@ -13,6 +13,19 @@ This page lists the configuration settings supported by
:ref:`how-to-guides-meson-args` guide for for information on how to
use them and examples.
.. option:: tool.meson-python.allow-windows-internal-shared-libs
Enable support for relocating internal shared libraries that would be
installed into the system shared library location to the
``.<package-name>.mesonpy.libs`` folder also on Windows. The relocation can
be done transparently on UNIX platforms and on macOS, where the shared
library load path can be adjusted via RPATH or equivalent mechanisms.
Windows lacks a similar facility, thus the Python package is responsible to
extend the DLL load path to include this directory or to preload the
shared libraries. See :ref:`here <internal-shared-libraries>` for detailed
documentation. This option ensures that the package authors are aware of
this requirement.
.. option:: tool.meson-python.limited-api
A boolean indicating whether the extension modules contained in the
......
......@@ -11,7 +11,6 @@ executables
frontend
Github
macOS
nox
Numpy
pre
pluggy
......
/*
* SPDX-FileCopyrightText: 2023 The meson-python developers
*
* SPDX-License-Identifier: MIT
*/
.sphinx-contributors--avatars .sphinx-contributors_contributor__image {
border-radius: 50%;
max-width: 80px;
margin: auto;
}
.sphinx-contributors--avatars .sphinx-contributors_contributor__username {
font-size: 80%;
text-align: center;
}
.sphinx-contributors--avatars .sphinx-contributors_contributor {
flex-grow: 1;
}
.sphinx-contributors--avatars .sphinx-contributors_list {
justify-content: flex-start;
gap: 10px;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment