File tree Expand file tree Collapse file tree 4 files changed +12
-8
lines changed
Expand file tree Collapse file tree 4 files changed +12
-8
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1010class Toolbar :
1111 def __init__ (self , request ):
1212 self .request = request
13- self .version = settings .ADMIN_TOOLBAR_VERSION
13+ self .version = settings .APP_VERSION
1414
1515 def should_render (self ):
1616 if settings .DEBUG :
Original file line number Diff line number Diff line change 33by the PLAIN_SETTINGS_MODULE environment variable.
44"""
55
6- from .utils import get_app_name_from_pyproject
6+ from .utils import get_app_info_from_pyproject
77
88# MARK: Core Settings
99
1010DEBUG : bool = False
1111
12- APP_NAME : str = get_app_name_from_pyproject ()
12+ name , version = get_app_info_from_pyproject ()
13+ APP_NAME : str = name
14+ APP_VERSION : str = version
1315
1416# List of strings representing installed packages.
1517INSTALLED_PACKAGES : list [str ] = []
Original file line number Diff line number Diff line change 22from pathlib import Path
33
44
5- def get_app_name_from_pyproject ():
6- """Get the project name from the nearest pyproject.toml file."""
5+ def get_app_info_from_pyproject ():
6+ """Get the project name and version from the nearest pyproject.toml file."""
77 current_path = Path .cwd ()
88
99 # Walk up the directory tree looking for pyproject.toml
@@ -13,8 +13,11 @@ def get_app_name_from_pyproject():
1313 try :
1414 with pyproject_path .open ("rb" ) as f :
1515 pyproject = tomllib .load (f )
16- return pyproject .get ("project" , {}).get ("name" , "App" )
16+ project = pyproject .get ("project" , {})
17+ name = project .get ("name" , "App" )
18+ version = project .get ("version" , "dev" )
19+ return name , version
1720 except (tomllib .TOMLDecodeError , OSError ):
1821 continue
1922
20- return "App"
23+ return "App" , "dev"
You can’t perform that action at this time.
0 commit comments