wintermute _ki
unread,Jan 8, 2026, 8:02:05 AM (6 days ago) Jan 8Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to cython-users
Hi together,
I have the following problem. The base for my small project is the directory structure as shown :
projekt_root/
├── setup.py
└── commons/
├── __init__.py
├── singleton.py
└── logger.py
The source code for the singleton.py and logger.py :
# commons/singleton.py
class CSingleton(object):
instances = {}
def __new__(clazz, *args, **kwargs):
if clazz not in clazz.instances:
clazz.instances[clazz] = super(CSingleton, clazz).__new__(clazz)
return clazz.instances[clazz]
# commons/logger.py
from logging import Logger, Formatter, INFO
from logging.handlers import RotatingFileHandler
from commons.singleton import CSingleton
class CLogger(CSingleton, Logger):
initialized = False
def __init__(self, log_format="%(asctime)s - %(levelname)s - %(funcName)s - %(message)s"):
if not self.initialized:
Logger.__init__(self, name="LeosDesk", level=INFO)
self.log_file = "resources/logfile.txt"
self.formatter = Formatter(log_format)
fileHandler = RotatingFileHandler(self.log_file)
fileHandler.setFormatter(self.formatter)
self.addHandler(fileHandler)
self.initialized = True
What steps do I need to take to compile both source files into a single shared library?
In my production environment, I only want to have the shared library and all the necessary init
files. No source code from singleton.py and logger.py. To create one file from both sources is a no go,
later I will add additional sources in the commons subdirectory. The production environment should
look as follows.
production_root/
└── commons/
├── __init__.py
└── shared library
How I have to do the implementation of the __init__.py and the setup.py file. I use python 3.10, setuptools 80.9
ans cython 3.2. I'm new in the user group, if a post exists, which solve my problem, than tell me this please.
Exists any small example projects for this kind of my problem ?
kindly regards,
henry