Example Package with Nim
This is a simple example package with Nim module.
Build steps
NOTE: These build steps are using Linux/macOS or similar. For Windows, the Nim
module will be compiled to mymodule.pyd instead of mymodule.so.
cd py_module_nim/example_pkg/
nimble install nimpy
nim compile --threads:on --app:lib --out:mymodule.so mymodule
cd ..
virtualenv venv
source venv/bin/activate
python setup.py sdist bdist_wheel
Publish steps
cd py_module_nim/
pip install twine
twine upload dist/*
Example using package
Write the following Python script to file named try.py:
from example_nim_pkg import mymodule
print(mymodule.greet("World"))
Install the example-nim-pkg-stever package and run the script:
pip install example-nim-pkg-stever
python try.py
Metadata
Release files for example-nim-pkg-stever 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| example_nim_pkg_stever-0.0.3-cp37-cp37m-win_amd64.whl | CPython 3.7 | CPython 3.7 pymalloc | Windows x86-64 | Details |
Release files / example_nim_pkg_stever-0.0.3-cp37-cp37m-win_amd64.whl
| Download URL | example_nim_pkg_stever-0.0.3-cp37-cp37m-win_amd64.whl |
|---|---|
| Size | 147.9 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Windows x86-64 |
|
SHA-256 checksum How to use checksums |
758c8e17f390dad4aa17459fb11a6ceb01c8b8918bab8173b27973349d3fee1e
|
|
BLAKE2b-256 checksum How to use checksums |
a4d47fc9ad4cbafdc89e1413acf272a71f41cf4a638dc0e60a3c35dcd432ca2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.7
|