Metadata-Version: 2.4
Name: project-version-finder
Version: 0.1.1
Summary: Find __version__ for __init__.py
Project-URL: repository, https://codeberg.org/Pusher2531/project-version-finder.git
Author-email: Doug Sojourner <doug@sojournings.org>
License: GNU General Public License v3 (GPLv3)
Keywords: development,installed,typed,version
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: <4.0,>=3.7
Requires-Dist: importlib-metadata; python_version < '3.11'
Requires-Dist: importlib; python_version >= '3.11'
Requires-Dist: pathlib
Requires-Dist: tomlkit
Description-Content-Type: text/markdown

Project-Version-Finder

Simple package to provide version informaion. The stratagy is  
* first look in pyproject.toml (since that's best if we are doing development, and it could be installed (with an old version) when we are working on it).  
* second, use modulelib.metadata, which works if it is installed  
* and as a last resort, look for a version.py file in the same directory as __init__.py. This is REQUIRED if you wish to support python versions < 3.8.  

All you should need is  
```py
from project_version_finder import get_version

fn dummy():
    pass
	
__version__ = get_version('project-name', dummy.__globals__['__file__'])
```
(and make project-version-finder a dependancy of your project). The second argment to get_version is the path (as a string) to some file in your package directory. One way to get that path without hard coding it is by getting it from a function defined in your __init__.py file, or, as shown here, by defining a dummy function for that purpose.

It isn't fool proof, but since you provide the project name, if it finds the wrong pyproject.toml it should only fail if that happens to be for a different project with the same name.

[Repository](https://codeberg.org/Pusher2531/project-version-finder.git)  
[PyPI](https://pypi.org/project/project-version-finder/)  

