Skip to content

Commit b2f25fd

Browse files
committed
Reorganize code into src folder to avoid import issues
1 parent b6c46a1 commit b2f25fd

27 files changed

+19
-29
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -108,22 +108,7 @@ jobs:
108108
CIBW_FREE_THREADED_SUPPORT: ${{ matrix.free_threaded_support }}
109109
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }}
110110
CIBW_TEST_REQUIRES: pytest psutil
111-
CIBW_TEST_COMMAND: |
112-
mkdir tmp_test_dir
113-
cp -r {project}/stochastic_arrow/test tmp_test_dir/test
114-
cp -r {project}/data tmp_test_dir/data
115-
cd tmp_test_dir
116-
pytest
117-
CIBW_TEST_COMMAND_WINDOWS: |
118-
echo "Starting tests on Windows";
119-
mkdir tmp_test_dir;
120-
echo "Copying test directory";
121-
xcopy /E /I /Y stochastic_arrow\test tmp_test_dir\test;
122-
echo "Copying data directory";
123-
xcopy /E /I /Y stochastic_arrow\data tmp_test_dir\data;
124-
cd tmp_test_dir;
125-
echo "Running pytest on Windows";
126-
pytest -v
111+
CIBW_TEST_COMMAND: pytest -v {project}/test
127112
CIBW_ENVIRONMENT: USE_CYTHON=1
128113
uses: pypa/cibuildwheel@v2.22.0
129114

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ profile
1010
/.idea/
1111
/tmp/
1212

13-
stochastic_arrow/arrowhead.c
14-
stochastic_arrow/arrowhead.*.pyd
15-
stochastic_arrow/*.html
13+
src/stochastic_arrow/arrowhead.c
14+
src/stochastic_arrow/arrowhead.*.pyd
15+
src/stochastic_arrow/*.html
1616

1717
arrow.egg-info/
1818
stochastic_arrow.egg-info/

MANIFEST.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
include stochastic_arrow/obsidian.h
2-
include stochastic_arrow/mersenne.h
1+
include src/stochastic_arrow/obsidian.h
2+
include src/stochastic_arrow/mersenne.h

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
.DEFAULT_GOAL := compile
33

44
clean:
5-
### Files for older versions of stochastic_arrow are in arrow folder
5+
### Files for older versions of stochastic_arrow are in arrow or stochastic_arrow folder
66
rm -rf arrow/arrowhead*.so arrow/arrowhead.c arrow/arrowhead.html
77
rm -rf stochastic_arrow/arrowhead*.so stochastic_arrow/arrowhead.c stochastic_arrow/arrowhead.html build/ dist/ MANIFEST .pytest_cache/ stochastic_arrow.egg-info/
8+
### Newer versions of stochastic_arrow are in src/stochastic_arrow folder
9+
rm -rf src/stochastic_arrow/arrowhead*.so src/stochastic_arrow/arrowhead.c src/stochastic_arrow/arrowhead.html src/stochastic_arrow.egg-info/
810
find . -name "*.pyc" -delete
911
find . -name "__pycache__" -delete
1012

File renamed without changes.

setup.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import os
2-
from setuptools import Extension, setup
2+
from setuptools import Extension, find_packages, setup
33
import sys
44
import numpy as np
55

@@ -20,28 +20,31 @@
2020

2121
ext = '.pyx' if USE_CYTHON else '.c'
2222

23+
arrow_dir = os.path.join('src', 'stochastic_arrow')
24+
2325
cython_extensions = [
2426
Extension('stochastic_arrow.arrowhead',
2527
sources=[
26-
'stochastic_arrow/mersenne.c',
27-
'stochastic_arrow/obsidian.c',
28-
'stochastic_arrow/arrowhead'+ext,],
29-
include_dirs=['stochastic_arrow', np.get_include()],
28+
os.path.join(arrow_dir, 'mersenne.c'),
29+
os.path.join(arrow_dir, 'obsidian.c'),
30+
os.path.join(arrow_dir, 'arrowhead'+ext),],
31+
include_dirs=[arrow_dir, np.get_include()],
3032
define_macros=[('NPY_NO_DEPRECATED_API', 'NPY_1_7_API_VERSION')],
3133
)]
3234

3335
if USE_CYTHON:
3436
from Cython.Build import cythonize
3537
cython_extensions = cythonize(
3638
cython_extensions,
37-
include_path=['stochastic_arrow'],
39+
include_path=[arrow_dir],
3840
annotate=True, # to get an HTML code listing
3941
)
4042

4143
setup(
4244
name='stochastic-arrow',
4345
version='1.0.0',
44-
packages=['stochastic_arrow'],
46+
packages=find_packages('src'),
47+
package_dir={'': 'src'},
4548
author='Ryan Spangler, John Mason, Jerry Morrison, Chris Skalnik, Travis Ahn-Horst, Sean Cheah',
4649
author_email='ryan.spangler@gmail.com',
4750
url='https://github.com/CovertLab/arrow',

0 commit comments

Comments
 (0)