Skip to content

Commit 19389f1

Browse files
committed
prepare for 0.3
1 parent 6d35f96 commit 19389f1

File tree

8 files changed

+45
-11000
lines changed

8 files changed

+45
-11000
lines changed

MANIFEST.in

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
include README.md
2+
include LICENSE
3+
4+
# Ensure Cython sources and generated C are in sdist
5+
include tsnkit/simulation/cython/simulation_core.pyx
6+
include tsnkit/simulation/cython/simulation_core.c
7+
8+
# Exclude transient artifacts
9+
prune tsnkit.egg-info
10+
global-exclude *.py[cod] __pycache__
11+
global-exclude *.csv

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.3.0

doc/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
project = "tsnkit"
1919
copyright = "2023, Chuanyu"
2020
author = "Chuanyu"
21-
release = "0.1.0"
21+
release = "0.3.0"
2222

2323
# -- General configuration ---------------------------------------------------
2424
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "tsnkit"
3-
version = "0.2.4"
3+
version = "0.3.0"
44
authors = [
55
{ name="Chuanyu Xue", email="[email protected]" },
66
{ name="Elaine Hu", email="[email protected]" },

setup.py

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,52 @@
11
from setuptools import setup, Extension
2-
from Cython.Build import cythonize
3-
import numpy
42
import os
53

4+
try:
5+
# Cython is optional when building from an sdist that includes generated C
6+
from Cython.Build import cythonize # type: ignore
7+
HAVE_CYTHON = True
8+
except Exception:
9+
HAVE_CYTHON = False
10+
11+
import numpy
12+
613
# Create __init__.py for the cython package if it doesn't exist
714
cython_dir = "tsnkit/simulation/cython"
815
init_file = os.path.join(cython_dir, "__init__.py")
916
if not os.path.exists(init_file):
1017
with open(init_file, "w") as f:
1118
f.write("# Cython simulation extensions\n")
1219

13-
# Define Cython extensions
20+
src_pyx = "tsnkit/simulation/cython/simulation_core.pyx"
21+
src_c = "tsnkit/simulation/cython/simulation_core.c"
22+
source = src_pyx if os.path.exists(src_pyx) else src_c
23+
24+
# Define Cython/C extensions
1425
extensions = [
1526
Extension(
1627
"tsnkit.simulation.cython.simulation_core",
17-
["tsnkit/simulation/cython/simulation_core.pyx"],
28+
[source],
1829
include_dirs=[numpy.get_include()],
1930
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")],
20-
extra_compile_args=["/O2"] if os.name == "nt" else ["-O3", "-ffast-math"]
31+
extra_compile_args=["/O2"] if os.name == "nt" else ["-O3", "-ffast-math"],
2132
)
2233
]
2334

2435
setup(
2536
name="tsnkit-cython-extensions",
26-
ext_modules=cythonize(extensions, compiler_directives={
27-
'language_level': 3,
28-
'boundscheck': False,
29-
'wraparound': False,
30-
'initializedcheck': False,
31-
'cdivision': True,
32-
}),
37+
ext_modules=(
38+
cythonize(
39+
extensions,
40+
compiler_directives={
41+
"language_level": 3,
42+
"boundscheck": False,
43+
"wraparound": False,
44+
"initializedcheck": False,
45+
"cdivision": True,
46+
},
47+
)
48+
if HAVE_CYTHON and source.endswith(".pyx")
49+
else extensions
50+
),
3351
zip_safe=False,
3452
)

tsnkit/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
"""
66

77

8-
__version__ = "0.1.0"
8+
__version__ = "0.3.0"
99
__author__ = 'Chuanyu Xue'
1010
__credits__ = 'UConn CPS Lab'

0 commit comments

Comments
 (0)