I've only been leaning Swift for about six months, but thanks to some amazing help from @SDGGiesbrecht, I've come a long way.
I've been looking for a package or framework to fulfill a particular purpose I have, and haven't had a lot of luck finding anything that will work for me in Obj-C or even C++, but there seems to be a couple options in Python, and thanks to PythonKit, it looks like they might actually be usable in my Swift app.
I don't know Python at all, but looking at the documentation for PythonKit, it looks similar enough to Swift that I think I can work out what I need to do. But I'm missing a step in getting the module I want to work with set up, I think?
First of all, I assume ultimately I need these files in my Bundle instead of in the repository I downloaded, correct? Is there anything specific I should do to compile them before adding them to the Bundle?
Second, I know how to use a specific .py
file:
func testImport() {
let sys = Python.import("sys")
sys.path.append("/path/to/mymodule/")
let myModule = Python.import("mymodule") // where mymodule is mymodule.py
}
but the module I want to work with is comprised of many .py
files. __init__.py
seems a likely suspect, but it doesn't seem to have the functions I want, nor does it import them from the other .py
files, and since I don't know Python, I'm not sure how self-contained each .py
file is. Will it have functions that will call functions contained in other .py
files? If so, do I need to import or load those as well?
I haven't had any luck finding a tutorial for this that assumes no real starting knowledge of Python. Any pointers would be appreciated.