From e915b47ddab4985b9195e89825eb06e2c3eba51b Mon Sep 17 00:00:00 2001 From: WorldTeacher Date: Thu, 9 Jan 2025 15:15:18 +0100 Subject: [PATCH] updates --- .bumpversion.cfg | 3 ++ .version | 0 .vscode/tasks.json | 121 +++++++++++++++++++++------------------------ main_dev.py | 15 +----- pyproject.toml | 4 +- setup.py | 23 +++++++++ uv.lock | 37 +++++++++++++- 7 files changed, 123 insertions(+), 80 deletions(-) create mode 100644 .version create mode 100644 setup.py diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 1b6f5ee..67bb749 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -9,3 +9,6 @@ replace = __version__ = "{new_version}" [bumpversion:file:pyproject.toml] search = version = "{current_version}" replace = version = "{new_version}" +[bumpversion:file:.version] +search = {current_version} +replace = {new_version} diff --git a/.version b/.version new file mode 100644 index 0000000..e69de29 diff --git a/.vscode/tasks.json b/.vscode/tasks.json index a107d6e..815b7e6 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -2,26 +2,13 @@ "version": "2.0.0", "tasks": [ { - "label": "Build LibrarySystem (Debug)", + "label": "Build New Release", "type": "shell", - "command": "pyinstaller", - "args": [ - "--noconfirm", - "--onedir", - "--console", - "--icon", - "'${config:ApplicationIconPath}'", - "--name", - "LibrarySystem-debug", - "--contents-directory", - ".", - "--clean", - "--add-data", - "'${config:configPath};config/'", - "--add-data", - "'${config:iconsPath};icons/'", - "'${workspaceFolder}/main_dev.py'" + "dependsOn": [ + "Build LibrarySystem (Release)", + "Build LibrarySystem (Debug)" ], + "command": "cmd", "group": { "kind": "build", "isDefault": true @@ -32,28 +19,27 @@ "focus": false }, // "dependsOn": "Compress dist Folder Debug", - "problemMatcher": "$pyinstaller" + "problemMatcher": "$python" }, { - "label": "Build LibrarySystem (Release)", + "label": "Build LibrarySystem (Debug)", "type": "shell", - "command": "pyinstaller", + "command": "uv", "args": [ - "--noconfirm", - "--onedir", - "--windowed", - "--name", - "LibrarySystem", - "--contents-directory", - ".", - "--clean", - "--add-data", - "'${config:configPath};config/'", - "--add-data", - "'${config:iconsPath};icons/'", - "--icon", - "'${config:ApplicationIconPath}'", - "'${workspaceFolder}/main.py'" + "run", + "python", + "-m", + "nuitka", + "--standalone", + "--output-dir=dist", + "--include-package=PyQt6", + "--include-package=pygments", + "--include-data-dir=./config=config", + "--include-data-dir=./docs=docs", + "--include-data-dir=./icons=icons", + "--include-data-dir=./.venv/Lib/site-packages/PyQt6/Qt6/plugins=PyQt6/Qt/plugins", + "--windows-icon-from-ico=icons/icon.ico", + "main_dev.py" ], "group": { "kind": "build", @@ -64,8 +50,39 @@ "panel": "new", "focus": false }, - "dependsOn": "Compress dist Folder Release", - "problemMatcher": "$pyinstaller" + // "dependsOn": "Compress dist Folder Debug", + "problemMatcher": "$python" + }, + { + "label": "Build LibrarySystem (Release)", + "type": "shell", + "command": "uv", + "args": [ + "run", + "python", + "-m", + "nuitka", + "--standalone", + "--output-dir=dist", + "--include-package=PyQt6", + "--include-package=pygments", + "--include-data-dir=./config=config", + "--include-data-dir=./docs=docs", + "--include-data-dir=./icons=icons", + "--include-data-dir=./.venv/Lib/site-packages/PyQt6/Qt6/plugins=PyQt6/Qt/plugins", + "--windows-icon-from-ico=icons/icon.ico", + "main.py" + ], + "group": { + "kind": "build", + "isDefault": false + }, + "presentation": { + "reveal": "always", + "panel": "new", + "focus": false + }, + "problemMatcher": "$python" }, { "label": "Run LibrarySystem (live)", @@ -73,39 +90,13 @@ "command": "c:/Users/aky547/GitHub/LibrarySystem/.venv/Scripts/python.exe", "args": [ "'c:/Users/aky547/GitHub/LibrarySystem/main_dev.py'", - "--ic-logging" + ], "group": { "kind": "test", "isDefault": true }, "problemMatcher": "$python" - }, - { - "label": "Compress dist Folder Debug", - "type": "shell", - "command": "Compress-Archive", - "args": [ - "-Path", - "${workspaceFolder}/dist/LibrarySystem-debug/", - "-DestinationPath", - "${workspaceFolder}/output/LibrarySystem-debug.zip", - ], - "group": "build", - "presentation": "panel" - }, - { - "label": "Compress dist Folder Release", - "type": "shell", - "command": "Compress-Archive", - "args": [ - "-Path", - "${workspaceFolder}/dist/LibrarySystem/", - "-DestinationPath", - "${workspaceFolder}/output/LibrarySystem.zip", - ], - "group": "build", - "presentation": "panel" } ] } \ No newline at end of file diff --git a/main_dev.py b/main_dev.py index f79d0a8..f5fb7ac 100644 --- a/main_dev.py +++ b/main_dev.py @@ -1,15 +1,4 @@ -# from src.ui.main_ui import launch +from src.ui.main_ui import launch -from src.updater import Update -import os if __name__ == "__main__": - Update() - with open("config/.updater", "r") as f: - contents = f.read().splitlines() - command = [line for line in contents if "command" in line][0].split(":")[1] - if "~" in command: - command = command.replace("~", str(os.getcwd())) - os.system(command) - - # launch("--debug") - + launch("--debug") diff --git a/pyproject.toml b/pyproject.toml index 5c0b3ff..b7e0e25 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,9 @@ version = "0.2.0" description = "Add your description here" readme = "README.md" requires-python = ">=3.12" -dependencies = [] +dependencies = [ + "loguru>=0.7.3", +] [dependency-groups] dev = [ diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..be4b37a --- /dev/null +++ b/setup.py @@ -0,0 +1,23 @@ +import os + +with open("pyproject.toml", "r") as file: + lines = file.readlines() + for line in lines: + if "name" in line: + name = line.split("=")[1].strip().replace('"', "") + break +with open(".version", "r") as file: + version = file.read().strip() + + +def rename_folders(): + for folder in os.listdir("dist"): + if folder.endswith(".dist"): + if "-dev" in folder: + os.rename(f"dist/{folder}", f"dist/{name}-dev") + else: + os.rename(f"dist/{folder}", f"dist/{name}-{version}") + + +if __name__ == "__main__": + rename_folders() diff --git a/uv.lock b/uv.lock index 9e75ce4..114479e 100644 --- a/uv.lock +++ b/uv.lock @@ -34,10 +34,22 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/7c/fc/6a8cb64e5f0324877d503c854da15d76c1e50eb722e320b15345c4d0c6de/cffi-1.17.1-cp313-cp313-win_amd64.whl", hash = "sha256:f6a16c31041f09ead72d69f583767292f750d24913dadacf5756b966aacb3f1a", size = 182009 }, ] +[[package]] +name = "colorama" +version = "0.4.6" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335 }, +] + [[package]] name = "librarysystem" -version = "0.1.0" +version = "0.2.0" source = { virtual = "." } +dependencies = [ + { name = "loguru" }, +] [package.dev-dependencies] dev = [ @@ -45,10 +57,24 @@ dev = [ ] [package.metadata] +requires-dist = [{ name = "loguru", specifier = ">=0.7.3" }] [package.metadata.requires-dev] dev = [{ name = "nuitka", specifier = ">=2.5.9" }] +[[package]] +name = "loguru" +version = "0.7.3" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "colorama", marker = "sys_platform == 'win32'" }, + { name = "win32-setctime", marker = "sys_platform == 'win32'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/3a/05/a1dae3dffd1116099471c643b8924f5aa6524411dc6c63fdae648c4f1aca/loguru-0.7.3.tar.gz", hash = "sha256:19480589e77d47b8d85b2c827ad95d49bf31b0dcde16593892eb51dd18706eb6", size = 63559 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/0c/29/0348de65b8cc732daa3e33e67806420b2ae89bdce2b04af740289c5c6c8c/loguru-0.7.3-py3-none-any.whl", hash = "sha256:31a33c10c8e1e10422bfd431aeb5d351c7cf7fa671e3c4df004162264b28220c", size = 61595 }, +] + [[package]] name = "nuitka" version = "2.5.9" @@ -77,6 +103,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/13/a3/a812df4e2dd5696d1f351d58b8fe16a405b234ad2886a0dab9183fb78109/pycparser-2.22-py3-none-any.whl", hash = "sha256:c3702b6d3dd8c7abc1afa565d7e63d53a1d0bd86cdc24edd75470f4de499cfcc", size = 117552 }, ] +[[package]] +name = "win32-setctime" +version = "1.2.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/b3/8f/705086c9d734d3b663af0e9bb3d4de6578d08f46b1b101c2442fd9aecaa2/win32_setctime-1.2.0.tar.gz", hash = "sha256:ae1fdf948f5640aae05c511ade119313fb6a30d7eabe25fef9764dca5873c4c0", size = 4867 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e1/07/c6fe3ad3e685340704d314d765b7912993bcb8dc198f0e7a89382d37974b/win32_setctime-1.2.0-py3-none-any.whl", hash = "sha256:95d644c4e708aba81dc3704a116d8cbc974d70b3bdb8be1d150e36be6e9d1390", size = 4083 }, +] + [[package]] name = "zstandard" version = "0.23.0"