Skip to content
Open
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
12 changes: 6 additions & 6 deletions .github/workflows/ci-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,22 @@ jobs:
fail-fast: false
matrix:
platform: [ 'windows-latest', 'ubuntu-latest' ]
python-version: [ 'cp310', 'cp311', 'cp312', 'cp313' ]
python-version: [ 'cp311', 'cp312', 'cp313', 'cp314' ]
timeout-minutes: 35
env:
CONAN_REVISIONS_ENABLED: 1
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v5
with:
python-version: 3.11
python-version-file: 'pyproject.toml'
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Build wheels
uses: pypa/cibuildwheel@v2.23.3
uses: pypa/cibuildwheel@v3.3.0
env:
CIBW_BUILD: "${{ matrix.python-version }}-win_amd64 ${{ matrix.python-version }}-manylinux_x86_64"
CIBW_BUILD_FRONTEND: build[uv]
Expand All @@ -62,7 +62,7 @@ jobs:
pip install twine
twine check --strict ./wheelhouse/*
- uses: actions/upload-artifact@v4
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
name: Upload artifact (wheels)
with:
name: libcosimpy-${{ github.ref_name }}-${{ runner.os }}-${{ matrix.python-version }}-wheel
Expand All @@ -82,14 +82,14 @@ jobs:
python -m build --sdist
twine check --strict ./dist/*
- uses: actions/upload-artifact@v4
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
name: Upload artifact (source)
with:
name: libcosimpy-${{ github.ref_name }}-source
path: ./dist/*.tar.gz

publish:
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
needs:
- code_quality
- build_wheels_and_test
Expand Down
4 changes: 4 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ class LibCosimpyConanDependency(ConanFile):
"libcosim/*:proxyfmu": True,
}

def configure(self):
self.options["*"].shared = False
self.options["libcosimc/*"].shared = True

def generate(self):
for dep in self.dependencies.values():
for dep_bin_dir in dep.cpp_info.bindirs:
Expand Down
8 changes: 4 additions & 4 deletions hatch_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ def initialize(self, version: str, build_data: dict[str, Any]) -> None:
frame = frame_info.frame
module = inspect.getmodule(frame)
if module and module.__name__.startswith("hatchling.build") and "config_settings" in frame.f_locals:
config_settings = frame.f_locals["config_settings"]
config_settings = frame.f_locals["config_settings"] or {}

package_list = config_settings.get("CONAN_BUILD")
if package_list:
build_packages = " ".join([f"-b {p}/*" for p in package_list.split(",")])
else:
build_packages = "-b missing"

assert os.system(f"conan install . -u {build_packages} -of build --format json --out-file graph.json") == 0, (
"Conan install failed"
)
assert (
os.system(f"conan install . -u {build_packages} -of build --format json -b b2/* --out-file graph.json") == 0
), "Conan install failed"

if "CONAN_UPLOAD_OSP" in os.environ:
print("Uploading packages..")
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ maintainers = [
]
description = "Python wrapper for the libcosim library"
readme = "README.md"
requires-python = ">=3.10, <3.14"
requires-python = ">=3.11, <3.15"
classifiers = [
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux"
Expand Down Expand Up @@ -62,7 +62,7 @@ test-command = "uv run --with pytest pytest {package}"
[tool.cibuildwheel.linux]
before-all = [
"yum install -y libatomic",
"yum install -y perl-IPC-Cmd perl-Digest-SHA",
"yum install -y perl-IPC-Cmd perl-Digest-SHA perl-Time-Piece",
]
manylinux-x86_64-image = "manylinux_2_28"

Expand Down
9 changes: 4 additions & 5 deletions src/libcosimpy/CosimAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
from dataclasses import dataclass
from typing import Optional

from . import CosimLibrary
from ._internal import wrap_function, get_last_error_message
from ._internal import wrap_function, get_last_error_message, libcosimc

if typing.TYPE_CHECKING:
from ctypes import _Pointer # pyright: ignore[reportPrivateUsage]
Expand Down Expand Up @@ -69,7 +68,7 @@ def __init__(
)

self.__ecco_add_power_bond = wrap_function(
lib=CosimLibrary.lib,
lib=libcosimc(),
funcname="cosim_ecco_add_power_bond",
argtypes=[POINTER(CosimAlgorithm), c_int, c_uint32, c_uint32, c_int, c_uint32, c_uint32],
restype=c_int,
Expand All @@ -78,7 +77,7 @@ def __init__(
@classmethod
def create_ecco_algorithm(cls, param: EccoParams) -> CosimAlgorithm:
ecco_algorithm_create = wrap_function(
lib=CosimLibrary.lib,
lib=libcosimc(),
funcname="cosim_ecco_algorithm_create",
argtypes=[
c_double,
Expand Down Expand Up @@ -156,7 +155,7 @@ def __del__(self):
# Release object in C when object is removed (if pointer exists)
if self.__ptr is not None:
algorithm_destroy = wrap_function(
lib=CosimLibrary.lib,
lib=libcosimc(),
funcname="cosim_algorithm_destroy",
argtypes=[POINTER(CosimAlgorithm)],
restype=c_int,
Expand Down
Loading