You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23-6Lines changed: 23 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,12 +2,14 @@
2
2
3
3
This Swift module uses LoopAlgorithm to create C functions for generating predictions and prediction dates from JSON data.
4
4
5
-
How?
6
-
I create a foreign function interface (FFI) in Swift by using the unofficial @_cdecl Swift function. This interfaces the Swift code with C. Then we can create a dynamic library, import it into a Python (or other) repositories, and use for example ctypes to compile the C code.
5
+
This is achieved by creating a foreign function interface (FFI) in Swift by using the unofficial @_cdecl Swift function. This interfaces the Swift code with C. Then we can create a dynamic library, import it into a Python (or other) repositories, and use for example ctypes to compile the C code.
6
+
7
7
8
8
9
9
## Installation
10
10
11
+
### TODO: Remove this and add examples with pypi / local builds instead
12
+
11
13
1. Clone the repository
12
14
2. Build the dynamic library:
13
15
@@ -24,14 +26,26 @@ Output should be something like: /release/libLoopAlgorithmToPython.dylib
24
26
Copy that file into your repository.
25
27
26
28
27
-
## Exposed functions
29
+
## Repository Overview
30
+
31
+
### Exposed functions
28
32
29
33
You can find the C-exposed functions in the file `LoopAlgorithmToPython.swift`.
30
34
35
+
### Python API
36
+
37
+
Python API functions are located in `loop_to_python_api/api.py`.
38
+
39
+
### Tests and test data
40
+
41
+
`python_tests/` contains examples of executing all the functions as well as example files providing templates on how to structure the input files.
31
42
32
43
33
44
## Usage in Python
34
45
46
+
### TODO: Remove this and add examples for pypi usage instead
47
+
48
+
35
49
Here's how you can use the dynamic library (`libLoopAlgorithmToPython.dylib`) in Python to call the exposed functions:
36
50
37
51
```
@@ -106,17 +120,17 @@ To do:
106
120
-[X] add the dlib build script
107
121
- build to python folder
108
122
- add readme
109
-
-[] write python functions api
123
+
-[X] write python functions api
110
124
-[ ] write tests with example files
111
125
-[ ] create pypi package
112
126
-[ ] add a build script
113
127
- automatically run tests on push
114
128
- automatically build new dlib on push
115
-
-[] clean up code swift
129
+
-[X] clean up code swift
116
130
-[ ] clean up code python
117
131
-[ ] update readme with new changes
118
132
- explanation, separating between python and swift code
119
-
- example usage of the api (with signal handlers)
133
+
- example usage of the api (with signal handlers), and example inputs (refer to test files)
120
134
- refer to example input files
121
135
- build, venv, run commands
122
136
- pypi
@@ -138,3 +152,6 @@ After making changes in the Swift code, rebuild the dynamic library by running `
0 commit comments