From a775e6d43b823519f16477805d72442587ee6110 Mon Sep 17 00:00:00 2001 From: slashtechno <77907286+slashtechno@users.noreply.github.com> Date: Fri, 8 Mar 2024 18:56:10 -0600 Subject: [PATCH] Convert to a semi-standard pyproject.toml --- pyproject.toml | 116 ++++++++++++++-------------------------- pyproject.toml.old | 91 +++++++++++++++++++++++++++++++ rye/.python-version | 1 + rye/README.md | 3 ++ rye/pyproject.toml | 24 +++++++++ rye/src/rye/__init__.py | 2 + 6 files changed, 161 insertions(+), 76 deletions(-) create mode 100644 pyproject.toml.old create mode 100644 rye/.python-version create mode 100644 rye/README.md create mode 100644 rye/pyproject.toml create mode 100644 rye/src/rye/__init__.py diff --git a/pyproject.toml b/pyproject.toml index 915565c..02703a9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,91 +1,55 @@ -[tool.poetry] +[project] name = "wyzely-detect" version = "0.2.1" description = "Recognize faces/objects in a video stream (from a webcam or a security camera) and send notifications to your devices" -authors = ["slashtechno <77907286+slashtechno@users.noreply.github.com>"] -repository = "https://github.com/slashtechno/wyzely-detect" +authors = [{name = "slashtechno", email = "77907286+slashtechno@users.noreply.github.com"}] keywords = ["object-detection", "face-detection", "wyze", "security", "yolov8", "unified-push"] -license = "MIT" +license = {file = "LICENSE"} readme = "README.md" -packages = [{include = "wyzely_detect"}] +requires-python = ">=3.10, <3.12" -[tool.poetry.dependencies] - -# Works on 3.10 and 3.11, at least in my testing -python = ">=3.10, <3.12" - -python-dotenv = "^1.0.0" -httpx = "^0.25.0" -opencv-python = "^4.8.1.78" -ultralytics = "^8.0.190" -hjson = "^3.1.0" -numpy = "^1.23.2" - -# https://github.com/python-poetry/poetry/issues/6409#issuecomment-1911735833 -# To install with GPU, use poetry install -E cuda --with gpu -torch = {version = "2.1.*", source = "pytorch-cpu", markers = "extra!='cuda'" } - -# https://stackoverflow.com/a/76477590/18270659 -# https://discfuss.tensorflow.org/t/tensorflow-io-gcs-filesystem-with-windows/18849/4 -# https://github.com/python-poetry/poetry/issues/8271#issuecomment-1712020965 -# Might be able to remove this version constraint later -# Working versions: -# Python version 3.10.12 and 3.10.5 both work -# CUDA version - 12.2 -# cuDNN version - 8.8.1 -# Installed from Nvidia website - nvidia-cuda-toolkit is not installed, but default PopOS drivers are installed -absl-py = "^2.1.0" -tensorflow = {version = "^2.13.0", markers = "extra!='cuda'"} -tensorflow-macos = { version = "^2.13.0", platform = "darwin", markers = "platform_machine=='arm64'" } -tensorflow-intel = { version = "^2.13.0", platform = "win32" } -tensorflow-io-gcs-filesystem = [ - { version = "< 0.32.0", markers = "platform_system == 'Windows'" } +dependencies = [ + "python-dotenv>=1.0.0,<2.0.0", + "httpx>=0.25.0,<0.26.0", + "opencv-python>=4.8.1.78,<4.9.0", + "ultralytics>=8.0.190,<9.0.0", + "hjson>=3.1.0,<4.0.0", + "numpy>=1.23.2,<2.0.0", + "torch>=2.1.0,<2.2.0; extra!='cuda'", + "absl-py>=2.1.0,<3.0.0", + "tensorflow>=2.13.0,<2.14.0; extra!='cuda'", + "tensorflow-macos>=2.13.0,<2.14.0; platform_machine=='arm64'", + "tensorflow-intel>=2.13.0,<2.14.0; platform_system=='Windows'", + "tensorflow-io-gcs-filesystem<0.32.0; platform_system=='Windows'", + "deepface>=0.0.79,<0.1.0", + "prettytable>=3.9.0,<4.0.0" ] +[project.optional-dependencies] +gpu = [ + "torch (>=2.1.0,<2.2.0); extra=='cuda'", + "tensorflow (>=2.14.0,<2.15.0); extra=='cuda'" +] -deepface = "^0.0.79" -prettytable = "^3.9.0" - - -[tool.poetry.group.gpu] -optional = true - -[tool.poetry.group.gpu.dependencies] -torch = {version = "2.1.*", source = "pytorch-cu121", markers = "extra=='cuda'"} -tensorflow = {version = "^2.14.0", extras = ["and-cuda"], markers = "extra=='cuda'"} - -[tool.poetry.extras] -# Might be better to rename this to nocpu since it's more accurate -cuda = [] - -[[tool.poetry.source]] -name = "pytorch-cpu" -url = "https://download.pytorch.org/whl/cpu" -priority = "explicit" - -[[tool.poetry.source]] -name = "pytorch-cu121" -url = "https://download.pytorch.org/whl/cu121" -priority = "explicit" - -[tool.poetry.group.dev.dependencies] -black = "^23.9.1" -ruff = "^0.0.291" -ipykernel = "^6.25.2" -nbconvert = "^7.9.2" +[project.dev-dependencies] +black = ">=23.9.1,<24.0.0" +ruff = ">=0.0.291,<0.1.0" +ipykernel = ">=6.25.2,<7.0.0" +nbconvert = ">=7.9.2,<8.0.0" +[project.urls] +Repository = "https://github.com/slashtechno/wyzely-detect" [build-system] -requires = ["poetry-core"] -build-backend = "poetry.core.masonry.api" +requires = ["hatchling"] +build-backend = "hatchling.build" +[tool.rye] +managed = true +dev-dependencies = [] -[tool.ruff] -# More than the default (88) of `black` to make comments less of a headache -# Where possible, `black` will attempt to format to 88 characters -# However, setting ruff to 135 will allow for longer lines that can't be auto-formatted -line-length = 135 -extend-select= ["FIX002"] +[tool.hatch.metadata] +allow-direct-references = true -[tool.poetry.scripts] -wyzely-detect = "wyzely_detect.__main__:main" \ No newline at end of file +[tool.hatch.build.targets.wheel] +packages = ["src/rye"] \ No newline at end of file diff --git a/pyproject.toml.old b/pyproject.toml.old new file mode 100644 index 0000000..e6a7280 --- /dev/null +++ b/pyproject.toml.old @@ -0,0 +1,91 @@ +[tool.poetry] +name = "wyzely-detect" +version = "0.2.1" +description = "Recognize faces/objects in a video stream (from a webcam or a security camera) and send notifications to your devices" +authors = ["slashtechno <77907286+slashtechno@users.noreply.github.com>"] +repository = "https://github.com/slashtechno/wyzely-detect" +keywords = ["object-detection", "face-detection", "wyze", "security", "yolov8", "unified-push"] +license = "MIT" +readme = "README.md" +packages = [{include = "wyzely_detect"}] + +[tool.poetry.dependencies] + +# Works on 3.10 and 3.11, at least in my testing +python = ">=3.10, <3.12" + +python-dotenv = "^1.0.0" +httpx = "^0.25.0" +opencv-python = "^4.8.1.78" +ultralytics = "^8.0.190" +hjson = "^3.1.0" +numpy = "^1.23.2" + +# https://github.com/python-poetry/poetry/issues/6409#issuecomment-1911735833 +# To install with GPU, use poetry install -E cuda --with gpu +torch = {version = "2.1.*", source = "pytorch-cpu", markers = "extra!='cuda'" } + +# https://stackoverflow.com/a/76477590/18270659 +# https://discfuss.tensorflow.org/t/tensorflow-io-gcs-filesystem-with-windows/18849/4 +# https://github.com/python-poetry/poetry/issues/8271#issuecomment-1712020965 +# Might be able to remove this version constraint later +# Working versions: +# Python version 3.10.12 and 3.10.5 both work +# CUDA version - 12.2 +# cuDNN version - 8.8.1 +# Installed from Nvidia website - nvidia-cuda-toolkit is not installed, but default PopOS drivers are installed +absl-py = "^2.1.0" +tensorflow = {version = "^2.13.0", markers = "extra!='cuda'"} +tensorflow-macos = { version = "^2.13.0", platform = "darwin", markers = "platform_machine=='arm64'" } +tensorflow-intel = { version = "^2.13.0", platform = "win32" } +tensorflow-io-gcs-filesystem = [ + { version = "< 0.32.0", markers = "platform_system == 'Windows'" } +] + + +deepface = "^0.0.79" +prettytable = "^3.9.0" + + +[tool.poetry.group.gpu] +optional = true + +[tool.poetry.group.gpu.dependencies] +torch = {version = "2.1.*", source = "pytorch-cu121", markers = "extra=='cuda'"} +tensorflow = {version = "^2.14.0", extras = ["and-cuda"], markers = "extra=='cuda'"} + +[tool.poetry.extras] +# Might be better to rename this to nocpu since it's more accurate +cuda = [] + +[[tool.poetry.source]] +name = "pytorch-cpu" +url = "https://download.pytorch.org/whl/cpu" +priority = "explicit" + +[[tool.poetry.source]] +name = "pytorch-cu121" +url = "https://download.pytorch.org/whl/cu121" +priority = "explicit" + +[tool.poetry.group.dev.dependencies] +black = "^23.9.1" +ruff = "^0.0.291" +ipykernel = "^6.25.2" +nbconvert = "^7.9.2" + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" + + +[tool.ruff] +# More than the default (88) of `black` to make comments less of a headache +# Where possible, `black` will attempt to format to 88 characters +# However, setting ruff to 135 will allow for longer lines that can't be auto-formatted +line-length = 135 +extend-select= ["FIX002"] + +[tool.poetry.scripts] +wyzely-detect = "wyzely_detect.__main__:main" \ No newline at end of file diff --git a/rye/.python-version b/rye/.python-version new file mode 100644 index 0000000..c84ccce --- /dev/null +++ b/rye/.python-version @@ -0,0 +1 @@ +3.10.5 diff --git a/rye/README.md b/rye/README.md new file mode 100644 index 0000000..76874cf --- /dev/null +++ b/rye/README.md @@ -0,0 +1,3 @@ +# rye + +Describe your project here. \ No newline at end of file diff --git a/rye/pyproject.toml b/rye/pyproject.toml new file mode 100644 index 0000000..366205c --- /dev/null +++ b/rye/pyproject.toml @@ -0,0 +1,24 @@ +[project] +name = "rye" +version = "0.1.0" +description = "Add your description here" +authors = [ + { name = "slashtechno", email = "77907286+slashtechno@users.noreply.github.com" } +] +dependencies = [] +readme = "README.md" +requires-python = ">= 3.10" + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.rye] +managed = true +dev-dependencies = [] + +[tool.hatch.metadata] +allow-direct-references = true + +[tool.hatch.build.targets.wheel] +packages = ["src/rye"] \ No newline at end of file diff --git a/rye/src/rye/__init__.py b/rye/src/rye/__init__.py new file mode 100644 index 0000000..5e47dc9 --- /dev/null +++ b/rye/src/rye/__init__.py @@ -0,0 +1,2 @@ +def hello() -> str: + return "Hello from rye!" \ No newline at end of file