Skip to content
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
5 changes: 0 additions & 5 deletions .bumpversion.cfg

This file was deleted.

11 changes: 8 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches:
- master
tags:
- '*'
- 'v*'

# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
# Only cancels-in-progress on PRs (head_ref only defined in PR, fallback run_id always unique)
Expand All @@ -21,6 +21,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # setuptools-scm needs tags to compute the version

- uses: actions/setup-python@v5
with:
Expand All @@ -45,6 +47,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # setuptools-scm needs tags to compute the version

- name: Build wheels
uses: pypa/cibuildwheel@v2.22.0
Expand All @@ -64,6 +68,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # setuptools-scm needs tags to compute the version

- name: Build sdist
run: pipx run build --sdist
Expand All @@ -80,7 +86,7 @@ jobs:
environment: pypi
permissions:
id-token: write
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4
with:
Expand All @@ -101,4 +107,3 @@ jobs:
- uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
password: ${{ secrets.PYPI_API_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST
src/diffcp/_version.py

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ python_add_library(_diffcp MODULE cpp/src/wrapper.cpp cpp/src/deriv.cpp cpp/src/
target_link_libraries(_diffcp PRIVATE pybind11::headers)
target_include_directories(_diffcp PRIVATE cpp/external/eigen/)
target_include_directories(_diffcp PRIVATE cpp/include/)


set_target_properties(_diffcp PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF)

# This is passing in the version as a define just as an example
target_compile_definitions(_diffcp PRIVATE VERSION_INFO=${PROJECT_VERSION})
Expand Down
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
develop:
rm -f *.so
python setup.py clean --all
python setup.py develop
uv sync --extra test
30 changes: 28 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@

[project]
name = "diffcp"
version = "1.1.8"
dynamic = ["version"]
description = "A library to compute gradients for convex optimization problems"
requires-python = ">= 3.10"

readme = "README.md"

dependencies = [
"cvxpy>=1.6.3",
"numpy >= 2.0",
"scipy >= 1.10",
"scs >= 3.0.0",
"threadpoolctl >= 1.1",
]
urls = {Homepage = "https://github.com/cvxgrp/diffcp/"}
Expand All @@ -17,13 +19,24 @@ license = {text = "Apache License, Version 2.0"}
[build-system]
requires = [
"scikit-build-core",
"setuptools-scm >= 8",
"pybind11>=2.4",
]
build-backend = "scikit_build_core.build"

[project.optional-dependencies]
cvxpy = [
"cvxpy >= 1.6.3",
]
clarabel = [
"clarabel >= 0.5.1",
]
ecos = [
"ecos >= 2.0.10",
]
test = [
"clarabel >= 0.5.1",
"cvxpy >= 1.6.3",
"scs >= 3.0.0",
"pytest>=8.3.5",
"ecos >= 2.0.10",
Expand All @@ -33,3 +46,16 @@ test = [
wheel.expand-macos-universal-tags = true
wheel.packages = ["src/diffcp"]

[tool.scikit-build.sdist]
include = ["src/diffcp/_version.py"]

[tool.scikit-build.metadata.version]
provider = "scikit_build_core.metadata.setuptools_scm"

[tool.setuptools_scm]
version_file = "src/diffcp/_version.py"
version_scheme = "semver-pep440-release-branch"
fallback_version = "0.0.0"

[tool.setuptools_scm.scm.git]
describe_command = ["git", "describe", "--dirty", "--tags", "--long", "--match", "v*"]
10 changes: 9 additions & 1 deletion src/diffcp/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
__version__ = "1.1.8"
try:
from diffcp._version import version as __version__
except ImportError:
from importlib.metadata import PackageNotFoundError, version

try:
__version__ = version("diffcp")
except PackageNotFoundError:
__version__ = "0.0.0+unknown"

from diffcp.cone_program import solve_and_derivative, \
solve_and_derivative_batch, \
Expand Down
Loading