File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,23 +11,21 @@ build-backend = "setuptools.build_meta"
1111
1212[project ]
1313name = " matej-libs"
14- version = " 0.12.3 "
14+ version = " 0.12.4 "
1515authors = [{name = " Matej Vitek" , email = " matej.vitek.business@gmail.com" }]
16+ license = " GPL-3.0-or-later"
17+ license-files = [" LICENSE" ]
1618requires-python = " >=3.12"
1719dependencies = [" numpy" ]
1820description = " Collection of Python utility libraries."
1921readme = " README.md"
2022classifiers = [
2123 " Programming Language :: Python :: 3" ,
22- " License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)" ,
2324 " Operating System :: OS Independent" ,
2425 " Development Status :: 3 - Alpha" ,
2526 " Intended Audience :: Developers" ,
2627]
2728
28- [tool .setuptools ] # TODO: This is needed until they fix twine packaging and uploading.
29- license-files = [] # Try removing on next build.
30-
3129[project .optional-dependencies ]
3230web = [" requests" ]
3331config = [" ruamel.yaml" ]
Original file line number Diff line number Diff line change 2525
2626
2727try :
28- __version__ = importlib .metadata .version (__package__ or __name__ )
28+ __version__ = importlib .metadata .version ('matej-libs' )
2929except importlib .metadata .PackageNotFoundError :
3030 from pathlib import Path
3131 import re
32- with (Path (__file__ ).resolve ().parent .parent .parent / 'pyproject.toml' ).open ('r' , encoding = 'utf-8' ) as f :
33- __version__ = re .search (r'version\s*=\s*[\'"]?([^\'"]*)[\'"]?' , f .read ()).group (1 )
32+
33+ _current_dir = Path (__file__ ).resolve ().parent
34+ _toml_path = None
35+
36+ # Walk up the tree up to 4 levels looking for pyproject.toml
37+ for _ in range (4 ):
38+ if (_current_dir / 'pyproject.toml' ).is_file ():
39+ _toml_path = _current_dir / 'pyproject.toml'
40+ break
41+ _current_dir = _current_dir .parent
42+
43+ if _toml_path :
44+ with _toml_path .open ('r' , encoding = 'utf-8' ) as f :
45+ __version__ = re .search (r'version\s*=\s*[\'"]?([^\'"]*)[\'"]?' , f .read ()).group (1 )
46+ else :
47+ __version__ = 'unknown'
3448
3549
3650@contextmanager
You can’t perform that action at this time.
0 commit comments