From 9d890adef8104685d77ce0bb5ed97d99acb74cc8 Mon Sep 17 00:00:00 2001 From: Erik Frojdh Date: Fri, 2 Jun 2023 09:34:28 +0200 Subject: [PATCH] adding python src and renamin _ext --- Makefile | 2 +- creader/__init__.py | 1 + setup.py | 2 +- src/creader_module.c | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 creader/__init__.py diff --git a/Makefile b/Makefile index ec3bd70..6039c44 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ debug: ## Build extension with debug prints and assertions python setup.py build_ext --inplace -UNDEBUG -DCR_VERBOSE clean: ## Remove the build folder and the shared library - rm -rf build/ creader.cpython* + rm -rf build/ _creader.cpython* test: ## Run unit tests using pytest python -m pytest diff --git a/creader/__init__.py b/creader/__init__.py new file mode 100644 index 0000000..88a46e7 --- /dev/null +++ b/creader/__init__.py @@ -0,0 +1 @@ +from _creader import * \ No newline at end of file diff --git a/setup.py b/setup.py index 83fd368..8d19abc 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ import setuptools import numpy as np -c_ext = setuptools.Extension("creader", +c_ext = setuptools.Extension("_creader", sources = [ "src/creader_module.c", "src/cluster_reader.c", diff --git a/src/creader_module.c b/src/creader_module.c index 0a731b0..7db53ce 100644 --- a/src/creader_module.c +++ b/src/creader_module.c @@ -70,7 +70,7 @@ static PyMethodDef creader_methods[] = { // Module defenition static struct PyModuleDef creader_def = { PyModuleDef_HEAD_INIT, - "creader", + "_creader", module_docstring, -1, creader_methods, // m_methods @@ -81,7 +81,7 @@ static struct PyModuleDef creader_def = { }; // Initialize module and add classes -PyMODINIT_FUNC PyInit_creader(void) { +PyMODINIT_FUNC PyInit__creader(void) { PyObject *m = PyModule_Create(&creader_def); if (m == NULL)