Skip to content

Commit

Permalink
Upgrade to Cython 3
Browse files Browse the repository at this point in the history
  • Loading branch information
wannesm committed Aug 25, 2023
1 parent fa74199 commit b14fc84
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion pysdd/compiler_c.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ __license__ = "APL"
"""

cimport sddapi_c
from . cimport sddapi_c

cdef extern from "compiler.h":
ctypedef struct SddCompilerOptions:
Expand Down
4 changes: 2 additions & 2 deletions pysdd/fnf_c.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ pysdd.fnf_c
:copyright: Copyright 2017-2018 KU Leuven and Regents of the University of California.
:license: Apache License, Version 2.0, see LICENSE for details.
"""
cimport sddapi_c
cimport compiler_c
from . cimport sddapi_c
from . cimport compiler_c

cdef extern from "fnf.h":
void free_fnf(compiler_c.Fnf* fnf)
Expand Down
4 changes: 2 additions & 2 deletions pysdd/io_c.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ pysdd.io_c
:copyright: Copyright 2017-2018 KU Leuven and Regents of the University of California.
:license: Apache License, Version 2.0, see LICENSE for details.
"""
cimport sddapi_c
cimport compiler_c
from . cimport sddapi_c
from . cimport compiler_c

cdef extern from "io.h":
compiler_c.Fnf* read_fnf(const char* filename);
Expand Down
12 changes: 6 additions & 6 deletions pysdd/sdd.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ SDD Python interface.
"""
cimport cython
cimport sddapi_c
cimport compiler_c
cimport io_c
cimport fnf_c
cimport weight_optimization_c
from . cimport sddapi_c
from . cimport compiler_c
from . cimport io_c
from . cimport fnf_c
from . cimport weight_optimization_c
from cpython cimport array
from cpython.mem cimport PyMem_Malloc, PyMem_Free

Expand Down Expand Up @@ -1665,7 +1665,7 @@ cdef class WmcManager:
"""
if len(weights) > 2 * self.node._manager.var_count():
raise Exception("Array of weights is longer than the number of variables in the manager.")
cdef long nb_lits = len(weights) / 2 # The array can be shorter than the number of variables
cdef long nb_lits = len(weights) // 2 # The array can be shorter than the number of variables
cdef sddapi_c.SddLiteral lit
cdef long i
for i in range(nb_lits):
Expand Down
4 changes: 2 additions & 2 deletions pysdd/weight_optimization_c.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ pysdd.weight_optimization_c
:copyright: Copyright 2017-2018 KU Leuven and Regents of the University of California.
:license: Apache License, Version 2.0, see LICENSE for details.
"""
cimport sddapi_c
from . cimport sddapi_c

cdef extern from "weight_optimizer.h":

void optimize_weights(sddapi_c.SddNode* sdd, sddapi_c.SddManager* mgr, int m_instances,
int n_optimize, int* ind_optimize, double* weights_optimize, int* counts_optimize,
int n_fix, int* ind_fix, double* weights_fix,
long double prior_sigma, long double l1_const, int max_iter, long double delta,
long double epsilon)
long double epsilon)
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,10 @@ def build_extensions(self):
raise ImportError('Cython not available')

# install_requires = ['numpy', 'cython']
install_requires = ['cython>=0.29.6']
install_requires = ['cython>=3.0.0']
setup_requires = ['setuptools>=18.0', 'cython>=0.29.6']
tests_require = ['pytest']
dev_require = tests_require + ['cython>=0.29.6']
dev_require = tests_require + ['cython>=3.0.0']

with (here / 'README.rst').open('r', encoding='utf-8') as f:
long_description = f.read()
Expand Down

0 comments on commit b14fc84

Please sign in to comment.