I would like to have a root path variable that I can use on kronus.py
so I can correctly use the database file in my media folder.
I know i can use something like this:
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
But my question is, where should I put such code so I can then access my ROOT_DIR
variable?
This is the project structure:
kronus
├── LICENSE
├── pyproject.toml
├── README.md
├── setup.cfg
├── media
│ └── database.db
├── src
│ └── kronus
│ ├── exception.py
│ ├── __init__.py
│ ├── kronus.py
│ ├── kronus_uteis.py
└── tests
And this is my setup.cfg
file:
[metadata]
name = kronus
version = attr: kronus.__version__
author = attr: kronus.__author__
author_email = ran-n@tutanota.com
license = attr: kronus.__license__
description = Timestamp module
long_description = file: README.md
long_description_content_type = text/markdown
url = https://wwww.github.com/Ran-n/kronus
project_urls =
Bug Tracker = https://wwww.github.com/Ran-n/kronus/issues
classifiers =
Development Status :: 3 - Alpha
Environment :: Console
Intended Audience :: Developers
License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Operating System :: OS Independent
Programming Language :: Python :: 3.8
Topic :: Software Development :: Libraries
Topic :: Text Processing :: General
Natural Language :: Galician
Natural Language :: Portuguese
Natural Language :: English
Natural Language :: Spanish
[options]
python_requires = >= 3.10.1
package_dir =
= src
packages = find:
[options.packages.find]
where = src