Skip to content

Fix license collection with the latest pip packages #41

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

Merged
merged 5 commits into from
Jul 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 7 additions & 18 deletions .github/workflows/test_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,27 @@ jobs:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
embedded-py: [3.11.5, 3.12.4]
conan:
- version: 1
args: lumicks/testing --build=missing
- version: 2
args: --user=lumicks --channel=testing --build=missing
name: "${{ matrix.os }}, ${{ matrix.embedded-py }}, v${{ matrix.conan.version }}"
embedded-py: [3.11.5, 3.12.10, 3.13.5]
name: "${{ matrix.os }}, ${{ matrix.embedded-py }}"
env:
create_pck: conan create . ${{ matrix.conan.args }} -o embedded_python-core/*:version=${{ matrix.embedded-py }}
create_pck: conan create . -o embedded_python-core/*:version=${{ matrix.embedded-py }} --build=missing --user=lumicks --channel=testing
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"
- if: runner.os == 'macOS'
name: Set up CC/CXX env
run: |
echo CC=/usr/bin/clang >> $GITHUB_ENV
echo CXX=/usr/bin/clang++ >> $GITHUB_ENV
- if: matrix.conan.version == '1'
name: Install Conan v1
run: |
python -m pip install conan==1.64.1
conan profile new default --detect
- if: matrix.conan.version == '2'
name: Install Conan v2
- name: Install Conan
run: |
python -m pip install conan==2.4.1
python -m pip install conan==2.18.1
conan profile detect
- name: Test core
run: conan create ./core ${{ matrix.conan.args }} -o embedded_python-core/*:version=${{ matrix.embedded-py }}
run: cd core && ${{ env.create_pck }}
- name: Test baseline
run: ${{ env.create_pck }}
- name: Test with numpy env
Expand Down
7 changes: 7 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## v1.10.0 | 2025-07-23

- Added support for Python 3.13.
- Switched from `pip-licenses` to `pip-licenses-cli` since the former doesn't seem to be maintained anymore and is falling behind on compatibility. See https://github.com/raimon49/pip-licenses/issues/227. The matching `pip_licenses_version` option has been renamed to `pip_licenses_cli_version`.
- Updated default recipe options to `pip` v25.1.1, `setuptools` v80.9.0, and `wheel` v0.45.1.
- Dropped support for Conan v1.

## v1.9.1 | 2024-06-17

- Fixed an issue where calling CMake with `-DPython_EXECUTABLE=<system_python>` created conflicts with the embedded Python (either a loud version error, or silently passing the wrong library paths). Some IDEs would pass this flag implicitly and it would hijack the `find_package(Python)` call used internally by this recipe. Now, we specifically protect against this since there should be no traces of system Python in a project that wishes to embed it.
Expand Down
21 changes: 9 additions & 12 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
from conan import ConanFile
from conan.tools import files, scm

required_conan_version = ">=1.59.0"
required_conan_version = ">=2.5.0"


# noinspection PyUnresolvedReferences
class EmbeddedPython(ConanFile):
name = "embedded_python"
version = "1.9.1" # of the Conan package, `embedded_python-core:version` is the Python version
version = "1.10.0" # of the Conan package, `embedded_python-core:version` is the Python version
license = "PSFL"
description = "Embedded distribution of Python"
topics = "embedded", "python"
Expand All @@ -20,22 +20,21 @@ class EmbeddedPython(ConanFile):
options = {
"packages": [None, "ANY"],
"pip_version": ["ANY"],
"pip_licenses_version": ["ANY"],
"pip_licenses_cli_version": ["ANY"],
"setuptools_version": ["ANY"],
"wheel_version": ["ANY"],
}
default_options = {
"packages": None,
"pip_version": "24.0",
"pip_licenses_version": "4.4.0",
"setuptools_version": "69.5.1",
"wheel_version": "0.43.0",
"pip_version": "25.1.1",
"pip_licenses_cli_version": "1.4.0",
"setuptools_version": "80.9.0",
"wheel_version": "0.45.1",
}
short_paths = True # some of the pip packages go over the 260 char path limit on Windows
exports_sources = "embedded_python.cmake"

def requirements(self):
self.requires(f"embedded_python-core/1.3.1@{self.user}/{self.channel}")
self.requires(f"embedded_python-core/1.4.0@{self.user}/{self.channel}")

@property
def pyversion(self):
Expand Down Expand Up @@ -140,7 +139,7 @@ def _build_bootstrap(self):
f"pip=={self.options.pip_version}",
f"setuptools=={self.options.setuptools_version}",
f"wheel=={self.options.wheel_version}",
f"pip-licenses=={self.options.pip_licenses_version}",
f"pip-licenses-cli=={self.options.pip_licenses_cli_version}",
]
options = "--no-warn-script-location --upgrade"
self._run_bootstrap_py(f"-m pip install {options} {' '.join(specs)}")
Expand Down Expand Up @@ -202,9 +201,7 @@ def package(self):
self._gather_packages(license_folder)

def package_info(self):
self.env_info.PYTHONPATH.append(self.package_folder)
self.cpp_info.set_property("cmake_build_modules", ["embedded_python.cmake"])
self.cpp_info.build_modules = ["embedded_python.cmake"]
self.cpp_info.includedirs = []
self.cpp_info.bindirs = []
self.cpp_info.libdirs = []
13 changes: 5 additions & 8 deletions core/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
from conan.errors import ConanInvalidConfiguration
from conan.tools import files, scm

required_conan_version = ">=1.59.0"
required_conan_version = ">=2.5"


# noinspection PyUnresolvedReferences
class EmbeddedPythonCore(ConanFile):
name = "embedded_python-core"
version = "1.3.1" # of the Conan package, `options.version` is the Python version
version = "1.4.0" # of the Conan package, `options.version` is the Python version
license = "PSFL"
description = "The core embedded Python (no extra pip packages)"
topics = "embedded", "python"
Expand All @@ -27,7 +27,7 @@ class EmbeddedPythonCore(ConanFile):
default_options = {
"zip_stdlib": "stored",
}
exports_sources = "embedded_python_tools.py", "embedded_python*.cmake"
exports_sources = "embedded_python*.cmake"
package_type = "shared-library"

def validate(self):
Expand All @@ -52,13 +52,13 @@ def requirements(self):
if self.settings.os == "Windows":
return # on Windows, we download a binary, so we don't need anything else

self.requires("sqlite3/3.45.3")
self.requires("sqlite3/3.49.1")
self.requires("bzip2/1.0.8")
self.requires("xz_utils/5.4.5")
self.requires("zlib/[>=1.2.11 <2]")
self.requires("openssl/[>=3 <4]")
if self.settings.os == "Linux":
self.requires("libffi/3.4.4")
self.requires("libffi/3.4.8")
self.requires("libuuid/1.0.3")
self.requires("mpdecimal/2.5.1")

Expand Down Expand Up @@ -279,7 +279,6 @@ def package(self):
src = self.build_folder
dst = pathlib.Path(self.package_folder, "embedded_python")
files.copy(self, "embedded_python*.cmake", src, dst=self.package_folder)
files.copy(self, "embedded_python_tools.py", src, dst=self.package_folder)
license_folder = pathlib.Path(self.package_folder, "licenses")

if self.settings.os == "Windows":
Expand Down Expand Up @@ -321,11 +320,9 @@ def package(self):
self._zip_stdlib(dst)

def package_info(self):
self.env_info.PYTHONPATH.append(self.package_folder)
self.cpp_info.set_property(
"cmake_build_modules", ["embedded_python-core.cmake", "embedded_python-tools.cmake"]
)
self.cpp_info.build_modules = ["embedded_python-core.cmake", "embedded_python-tools.cmake"]
prefix = pathlib.Path(self.package_folder) / "embedded_python"
self.cpp_info.includedirs = [str(prefix / "include")]
if self.settings.os == "Windows":
Expand Down
62 changes: 0 additions & 62 deletions core/embedded_python_tools.py

This file was deleted.

6 changes: 1 addition & 5 deletions core/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import sys
import pathlib
import subprocess
import conan
from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout

Expand Down Expand Up @@ -33,10 +32,7 @@ def build(self):

@property
def _core_package_path(self):
if conan.__version__.startswith("2"):
return pathlib.Path(self.dependencies["embedded_python-core"].package_folder)
else:
return pathlib.Path(self.deps_cpp_info["embedded_python-core"].rootpath)
return pathlib.Path(self.dependencies["embedded_python-core"].package_folder)

@property
def _py_exe(self):
Expand Down
2 changes: 1 addition & 1 deletion license.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2021, LUMICKS B.V.
Copyright (c) 2025, LUMICKS B.V.

Apache License, Version 2.0, January 2004, http://www.apache.org/licenses/

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.black]
line-length = 100
target-version = ['py311']
target-version = ['py312']
extend-exclude = '''
(
/(
Expand Down
11 changes: 2 additions & 9 deletions test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import sys
import pathlib
import subprocess
import conan
from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout

Expand All @@ -27,17 +26,11 @@ class TestEmbeddedPython(ConanFile):

@property
def _core_package_path(self):
if conan.__version__.startswith("2"):
return pathlib.Path(self.dependencies["embedded_python-core"].package_folder)
else:
return pathlib.Path(self.deps_cpp_info["embedded_python-core"].rootpath)
return pathlib.Path(self.dependencies["embedded_python-core"].package_folder)

@property
def _package_path(self):
if conan.__version__.startswith("2"):
return pathlib.Path(self.dependencies["embedded_python"].package_folder)
else:
return pathlib.Path(self.deps_cpp_info["embedded_python"].rootpath)
return pathlib.Path(self.dependencies["embedded_python"].package_folder)

@property
def _py_exe(self):
Expand Down
Loading
Loading