Skip to content

Commit 608499a

Browse files
committed
ci=> actions, modernize package
badge
1 parent e6ad968 commit 608499a

File tree

17 files changed

+94
-56
lines changed

17 files changed

+94
-56
lines changed

.coveragerc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ exclude_lines =
1717
logging.warning
1818
logging.error
1919
logging.critical
20-
if __name__ == .__main__.:
20+
if __name__ == .__main__.:

.flake8

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[flake8]
2+
max-line-length = 132
3+
exclude = .git,__pycache__,.eggs/,doc/,docs/,build/,dist/,archive/
4+
per-file-ignores =
5+
__init__.py:F401

.github/FUNDING.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# These are supported funding model platforms
2+
3+
github: [scivision]
4+
ko_fi: scivision

.github/workflows/ci_python.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: ci_python
2+
3+
on:
4+
push:
5+
paths:
6+
- "**.py"
7+
pull_request:
8+
paths:
9+
- "**.py"
10+
11+
jobs:
12+
13+
linux:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
python-version: [3.5, '3.x']
18+
steps:
19+
- uses: actions/checkout@v1
20+
- uses: actions/setup-python@v1
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
- run: pip install .[tests,lint]
24+
- run: flake8
25+
- run: mypy .
26+
- run: pytest
27+
working-directory: tests

DemoLineclip.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env python
2-
import numpy as np
32
from pylineclip import cohensutherland
4-
3+
from pytest import approx
54
"""
65
make box with corners LL/UR (1,3) (4,5)
76
and line segment with ends (0,0) (4,6)
@@ -10,19 +9,16 @@
109

1110
def main():
1211
# %% LOWER to UPPER test
13-
x1, y1, x2, y2 = cohensutherland(1, 5, 4, 3,
14-
0, 0, 4, 6)
12+
x1, y1, x2, y2 = cohensutherland(1, 5, 4, 3, 0, 0, 4, 6)
1513

16-
np.testing.assert_array_almost_equal([x1, y1, x2, y2], [2, 3, 3.3333333333333, 5])
14+
assert [x1, y1, x2, y2] == approx([2, 3, 3.3333333333333, 5])
1715
# %% no intersection test
18-
x1, y1, x2, y2 = cohensutherland(1, 5, 4, 3,
19-
0, 0.1, 0, 0.1)
16+
x1, y1, x2, y2 = cohensutherland(1, 5, 4, 3, 0, 0.1, 0, 0.1)
2017

2118
assert x1 is None and y1 is None and x2 is None and y2 is None
2219
# %% left to right test
23-
x1, y1, x2, y2 = cohensutherland(1, 5, 4, 3,
24-
0, 4, 5, 4)
25-
np.testing.assert_array_almost_equal([x1, y1, x2, y2], [1, 4, 4, 4])
20+
x1, y1, x2, y2 = cohensutherland(1, 5, 4, 3, 0, 4, 5, 4)
21+
assert [x1, y1, x2, y2] == [1, 4, 4, 4]
2622

2723

2824
if __name__ == '__main__':

LICENSE renamed to LICENSE.txt

File renamed without changes.

README.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
[![Travis CI](https://travis-ci.org/scivision/lineclipping-python-fortran.svg?branch=master)](https://travis-ci.org/scivision/lineclipping-python-fortran)
2-
[![Coverage Status](https://coveralls.io/repos/github/scivision/lineclipping-python-fortran/badge.svg?branch=master)](https://coveralls.io/github/scivision/lineclipping-python-fortran?branch=master)
3-
[![AppVeyor](https://ci.appveyor.com/api/projects/status/cr0omkhjvgwcyxiy?svg=true)](https://ci.appveyor.com/project/scivision/lineclipping-python-fortran)
1+
[![Actions Status](https://github.com/scivision/lineclipping-python-fortran/workflows/ci_python/badge.svg)](https://github.com/scivision/lineclipping-python-fortran/actions)
2+
3+
44
[![PyPi versions](https://img.shields.io/pypi/pyversions/pylineclip.svg)](https://pypi.python.org/pypi/pylineclip)
55
[![PyPi Download stats](http://pepy.tech/badge/pylineclip)](http://pepy.tech/project/pylineclip)
66

@@ -11,24 +11,30 @@
1111
output intersections or `NaN` if no intersection.
1212
- `lineClipping.py` Cohen-Sutherland line clipping algorithm for Python.
1313
Input scalars, output intersection length, or `None` if no intersection.
14-
15-
14+
15+
1616
Julia line clipping is at https://github.com/scivision/lineclipping-julia
1717

1818
## Install
1919

20-
### Python
20+
To install the latest release:
21+
22+
```sh
23+
pip install pylineclip
24+
```
25+
2126

22-
python -m pip install -e .
2327

2428
### Fortran
2529

2630
If you want to use the Fortran Cohen-Sutherland line clipping modules
2731
directly (optional):
2832

29-
cd bin
30-
cmake ..
31-
make
33+
```sh
34+
meson build
35+
36+
meson test -C build
37+
```
3238

3339
## Usage
3440

@@ -48,7 +54,7 @@ If no intersection, `(None, None, None, None)` is returned.
4854

4955
### Fortran
5056

51-
lineclipping.f90 has two subroutines.
57+
lineclipping.f90 has two subroutines.
5258
Pick Ccohensutherland if you're calling from C/C++/Python, which cannot tolerate assummed-shape arrays.
5359
It's a slim wrapper to cohensutherland which is elemental (can handle scalar or any rank array).
5460

@@ -67,7 +73,7 @@ The arguments are:
6773

6874
INOUT
6975
-----
70-
x1,y1,x2,y2:
76+
x1,y1,x2,y2:
7177
in - endpoints of line
7278
out - intersection points with box. If no intersection, all NaN
7379

.appveyor.yml renamed to archive/.appveyor.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,3 @@ test_script:
2828
- ctest -V
2929
- cd ..
3030
- pytest -rsv
31-

.travis.yml renamed to archive/.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ python:
1111

1212
os:
1313
- linux
14-
14+
1515
env: FC=gfortran-6
1616

1717
addons:
@@ -40,4 +40,3 @@ after_success:
4040
pytest --cov
4141
coveralls;
4242
fi
43-

build/bin/.ignore

Whitespace-only changes.

0 commit comments

Comments
 (0)