Skip to content

Commit fabb713

Browse files
authored
Merge pull request #52 from CovertLab/name_change
Rename arrow module to stochastic_arrow
2 parents fdf3db7 + 4bd8eae commit fabb713

28 files changed

+192
-58
lines changed

.github/workflows/pytest.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Modified from GitHub Actions template
2+
3+
name: Pytest
4+
5+
on:
6+
push:
7+
branches: [master]
8+
pull_request:
9+
branches: [master]
10+
11+
jobs:
12+
test-on-ubuntu:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
python-version: ['3.9', '3.10', '3.11']
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: Setup Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
cache: 'pip'
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install pytest
28+
pip install numpy
29+
pip install -r requirements.txt
30+
- name: Compile Cython
31+
run: |
32+
make clean compile
33+
- name: Test with pytest
34+
run: |
35+
pytest
36+
test-on-windows:
37+
runs-on: windows-latest
38+
strategy:
39+
matrix:
40+
python-version: ['3.9', '3.10', '3.11']
41+
steps:
42+
- uses: actions/checkout@v3
43+
- name: Setup Python ${{ matrix.python-version }}
44+
uses: actions/setup-python@v4
45+
with:
46+
python-version: ${{ matrix.python-version }}
47+
cache: 'pip'
48+
- name: Install dependencies
49+
run: |
50+
python -m pip install --upgrade pip
51+
pip install pytest
52+
pip install numpy
53+
pip install -r requirements.txt
54+
- name: Compile Cython
55+
run: |
56+
make clean compile
57+
- name: Test with pytest
58+
run: |
59+
pytest
60+
test-on-mac:
61+
runs-on: macos-latest
62+
strategy:
63+
matrix:
64+
python-version: ['3.9', '3.10', '3.11']
65+
steps:
66+
- uses: actions/checkout@v3
67+
- name: Setup Python ${{ matrix.python-version }}
68+
uses: actions/setup-python@v4
69+
with:
70+
python-version: ${{ matrix.python-version }}
71+
cache: 'pip'
72+
- name: Install dependencies
73+
run: |
74+
python -m pip install --upgrade pip
75+
pip install pytest
76+
pip install numpy
77+
pip install -r requirements.txt
78+
- name: Compile Cython
79+
run: |
80+
make clean compile
81+
- name: Test with pytest
82+
run: |
83+
pytest

.gitignore

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

13-
arrow/arrowhead.c
14-
arrow/*.html
13+
stochastic_arrow/arrowhead.c
14+
stochastic_arrow/arrowhead.*.pyd
15+
stochastic_arrow/*.html
1516

1617
arrow.egg-info/
1718
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 arrow/obsidian.h
2-
include arrow/mersenne.h
1+
include stochastic_arrow/obsidian.h
2+
include stochastic_arrow/mersenne.h

Makefile

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

44
clean:
5-
rm -rf arrow/arrowhead*.so arrow/arrowhead.c arrow/arrowhead.html build/ dist/ MANIFEST .pytest_cache/ stochastic_arrow.egg-info/
5+
### Files for older versions of stochastic_arrow are in arrow folder
6+
rm -rf arrow/arrowhead*.so arrow/arrowhead.c arrow/arrowhead.html
7+
rm -rf stochastic_arrow/arrowhead*.so stochastic_arrow/arrowhead.c stochastic_arrow/arrowhead.html build/ dist/ MANIFEST .pytest_cache/ stochastic_arrow.egg-info/
68
find . -name "*.pyc" -delete
79
find . -name "__pycache__" -delete
810

README.md

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,21 @@ Add the following to your `requirements.txt`, or run
2121

2222
stochastic-arrow
2323

24+
**NOTE:** If upgrading from a version older than 1.0.0, check if the [`arrow`](https://github.com/arrow-py/arrow) datetime package is installed. If so, uninstall `arrow` before upgrading `stochastic-arrow`, then reinstall `arrow`.
25+
26+
> pip show arrow
27+
> pip uninstall arrow
28+
> pip install stochastic-arrow
29+
> pip install arrow
30+
2431
## Usage
2532

26-
The `arrow` library presents a single class as an interface,
33+
The `stochastic_arrow` library presents a single class as an interface,
2734
`StochasticSystem`, which operates on a set of reactions (encoded as a `numpy`
2835
matrix of stoichiometrix coefficients) and associated reaction rates:
2936

3037
```python
31-
from arrow import StochasticSystem
38+
from stochastic_arrow import StochasticSystem
3239
import numpy as np
3340

3441
# Each row is a reaction and each column is a molecular species (or other
@@ -79,14 +86,14 @@ derived from the list of events and the stoichiometric matrix, along with the in
7986
state. `reenact_events` will do this for you:
8087

8188
```python
82-
from arrow import reenact_events
89+
from stochastic_arrow import reenact_events
8390

84-
history = reenact_events(stoichiometry, result['events'], state)
91+
history = reenact_events(stoichiometric_matrix, result['events'], state)
8592
```
8693

8794
## Testing
8895

89-
`arrow` uses [pytest](https://docs.pytest.org/en/latest/). To test it:
96+
`stochastic_arrow` uses [pytest](https://docs.pytest.org/en/latest/). To test it:
9097

9198
> make clean compile
9299
> pytest
@@ -95,26 +102,30 @@ history = reenact_events(stoichiometry, result['events'], state)
95102

96103
There are more command line features in test_arrow:
97104

98-
> python -m arrow.test.test_arrow --complexation
105+
> python -m stochastic_arrow.test.test_arrow --complexation
99106

100-
> python -m arrow.test.test_arrow --plot
107+
> python -m stochastic_arrow.test.test_arrow --plot
101108

102-
> python -m arrow.test.test_arrow --obsidian
109+
> python -m stochastic_arrow.test.test_arrow --obsidian
103110

104-
> python -m arrow.test.test_arrow --memory
111+
> python -m stochastic_arrow.test.test_arrow --memory
105112

106-
> python -m arrow.test.test_arrow --time
113+
> python -m stochastic_arrow.test.test_arrow --time
107114

108115
More examples:
109116

110-
> python -m arrow.test.test_hang
117+
> python -m stochastic_arrow.test.test_hang
111118

112-
> pytest -m arrow/test/test_arrow.py
119+
> pytest -m stochastic_arrow/test/test_arrow.py
113120

114121
> pytest -k flagella
115122

116123
## Changelog
117124

125+
### Version 1.0.0
126+
127+
* Rename module to `stochastic_arrow` to avoid name conflict (Issue #51). **All users must update their import statements to use `stochastic_arrow` instead of `arrow`.**
128+
118129
### Version 0.5.2
119130

120131
* Update to Cython 0.29.34. (Cython 3.0.0 is now in beta.)

setup.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
_ = setuptools
1414

1515

16-
with open("README.md", 'r') as readme:
16+
with open("README.md", 'r', encoding="utf-8") as readme:
1717
long_description = readme.read()
1818

1919
current_dir = os.getcwd()
20-
arrow_dir = os.path.join(current_dir, 'arrow')
20+
arrow_dir = os.path.join(current_dir, 'stochastic_arrow')
2121

2222
# Compile the Cython code to C for development builds:
2323
# USE_CYTHON=1 python setup.py build_ext --inplace
@@ -30,25 +30,28 @@
3030
ext = '.pyx' if USE_CYTHON else '.c'
3131

3232
cython_extensions = [
33-
Extension('arrow.arrowhead',
34-
sources=['arrow/mersenne.c', 'arrow/obsidian.c', 'arrow/arrowhead'+ext,],
35-
include_dirs=['arrow', np.get_include()],
33+
Extension('stochastic_arrow.arrowhead',
34+
sources=[
35+
'stochastic_arrow/mersenne.c',
36+
'stochastic_arrow/obsidian.c',
37+
'stochastic_arrow/arrowhead'+ext,],
38+
include_dirs=['stochastic_arrow', np.get_include()],
3639
define_macros=[('NPY_NO_DEPRECATED_API', 'NPY_1_7_API_VERSION')],
3740
)]
3841

3942
if USE_CYTHON:
4043
from Cython.Build import cythonize
4144
cython_extensions = cythonize(
4245
cython_extensions,
43-
include_path=['arrow'],
46+
include_path=['stochastic_arrow'],
4447
annotate=True, # to get an HTML code listing
4548
)
4649

4750
setup(
4851
name='stochastic-arrow',
49-
version='0.5.2',
50-
packages=['arrow'],
51-
author='Ryan Spangler, John Mason, Jerry Morrison, Chris Skalnik, Travis Ahn-Horst',
52+
version='1.0.0',
53+
packages=['stochastic_arrow'],
54+
author='Ryan Spangler, John Mason, Jerry Morrison, Chris Skalnik, Travis Ahn-Horst, Sean Cheah',
5255
author_email='[email protected]',
5356
url='https://github.com/CovertLab/arrow',
5457
license='MIT',
File renamed without changes.
File renamed without changes.

arrow/analysis/distributions.py renamed to stochastic_arrow/analysis/distributions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def _last_where(bool_array):
9696
if __name__ == '__main__':
9797
import matplotlib.pyplot as plt
9898

99-
from arrow.analysis.plotting import plot_full_history
99+
from stochastic_arrow.analysis.plotting import plot_full_history
100100

101101
(fig, axes) = plt.subplots(constrained_layout = True)
102102

File renamed without changes.

0 commit comments

Comments
 (0)