Skip to content
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

Drop dependence on wheel at build time #4652

Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
CMAKE_GENERATOR_PLATFORM=x64
CMAKE_BUILD_PARALLEL_LEVEL=${{ steps.get_num_cores.outputs.count }}
CIBW_ARCHS: AMD64
CIBW_BEFORE_BUILD: python -m pip install setuptools wheel delvewheel # skip CasADi and CMake
CIBW_BEFORE_BUILD: python -m pip install setuptools delvewheel # skip CasADi and CMake
# Fix access violation because GHA runners have modified PATH that picks wrong
# msvcp140.dll, see https://github.com/adang1345/delvewheel/issues/54
CIBW_REPAIR_WHEEL_COMMAND: delvewheel repair --add-path C:/Windows/System32 -w {dest_dir} {wheel}
Expand Down Expand Up @@ -243,7 +243,7 @@ jobs:
# 10.13 for Intel (macos-13), 11.0 for Apple Silicon (macos-14 and macos-latest)
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.os == 'macos-14' && '11.0' || '10.13' }}
CIBW_ARCHS_MACOS: auto
CIBW_BEFORE_BUILD: python -m pip install cmake casadi setuptools wheel delocate
CIBW_BEFORE_BUILD: python -m pip install cmake casadi setuptools delocate
CIBW_REPAIR_WHEEL_COMMAND: |
if [[ $(uname -m) == "x86_64" ]]; then
delocate-listdeps {wheel} && delocate-wheel -v -w {dest_dir} {wheel}
Expand Down
8 changes: 1 addition & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[build-system]
requires = [
"setuptools>=64",
"wheel",
"setuptools>=70.1.1",
agriyakhetarpal marked this conversation as resolved.
Show resolved Hide resolved
# On Windows, use the CasADi vcpkg registry and CMake bundled from MSVC
"casadi>=3.6.7; platform_system!='Windows'",
# Note: the version of CasADi as a build-time dependency should be matched
Expand Down Expand Up @@ -271,11 +270,6 @@ log_date_format = "%Y-%m-%d %H:%M:%S"
source = ["src/pybamm"]
concurrency = ["multiprocessing"]

[tool.repo-review]
ignore = [
"PP003" # list wheel as a build-dep
]

[tool.mypy]
ignore_missing_imports = true
allow_redefinition = true
Expand Down
2 changes: 1 addition & 1 deletion scripts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ RUN uv venv $VIRTUAL_ENV
RUN #!/bin/bash && source /home/pybamm/venv/bin/activate;
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

RUN uv pip install --upgrade setuptools wheel wget cmake
RUN uv pip install --upgrade setuptools wget cmake

RUN python scripts/install_KLU_Sundials.py && \
rm -rf pybind11 && \
Expand Down
14 changes: 7 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
from multiprocessing import cpu_count
from pathlib import Path
from platform import system
import wheel.bdist_wheel as orig

from setuptools import setup, Extension
from setuptools.command.install import install
from setuptools.command.build_ext import build_ext
from setuptools.command.bdist_wheel import bdist_wheel


default_lib_dir = (
Expand Down Expand Up @@ -230,29 +230,29 @@ def run(self):
# ---------- Custom class for building wheels ------------------------------------------


class bdist_wheel(orig.bdist_wheel):
class PyBaMMWheel(bdist_wheel):
"""A custom install command to add 2 build options"""

user_options = [
*orig.bdist_wheel.user_options,
*bdist_wheel.user_options,
("suitesparse-root=", None, "suitesparse source location"),
("sundials-root=", None, "sundials source location"),
]

def initialize_options(self):
orig.bdist_wheel.initialize_options(self)
bdist_wheel.initialize_options(self)
self.suitesparse_root = None
self.sundials_root = None

def finalize_options(self):
orig.bdist_wheel.finalize_options(self)
bdist_wheel.finalize_options(self)
if not self.suitesparse_root:
self.suitesparse_root = default_lib_dir
if not self.sundials_root:
self.sundials_root = default_lib_dir

def run(self):
orig.bdist_wheel.run(self)
bdist_wheel.run(self)


def compile_KLU():
Expand Down Expand Up @@ -342,7 +342,7 @@ def compile_KLU():
ext_modules=ext_modules,
cmdclass={
"build_ext": CMakeBuild,
"bdist_wheel": bdist_wheel,
"bdist_wheel": PyBaMMWheel,
"install": CustomInstall,
},
)
Loading