Skip to content

Commit

Permalink
Add pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei committed Jan 7, 2025
1 parent c515bdf commit 28b33a3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
11 changes: 11 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[project]
name = "ComfyUI"
version = "0.3.10"
readme = "README.md"
license = { file = "LICENSE" }
requires-python = ">=3.9"

[project.urls]
homepage = "https://www.comfy.org/"
repository = "https://github.com/comfyanonymous/ComfyUI"
documentation = "https://docs.comfy.org/"
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Pillow
scipy
tqdm
psutil
toml

#non essential dependencies:
kornia>=0.7.1
Expand Down
17 changes: 4 additions & 13 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import aiohttp
from aiohttp import web
import toml
import logging

import mimetypes
Expand All @@ -45,19 +46,9 @@ async def send_socket_catch_exception(function, message):
logging.warning("send error: {}".format(err))

def get_comfyui_version():
comfyui_version = "unknown"
repo_path = os.path.dirname(os.path.realpath(__file__))
try:
import pygit2
repo = pygit2.Repository(repo_path)
comfyui_version = repo.describe(describe_strategy=pygit2.GIT_DESCRIBE_TAGS)
except Exception:
try:
import subprocess
comfyui_version = subprocess.check_output(["git", "describe", "--tags"], cwd=repo_path).decode('utf-8')
except Exception as e:
logging.warning(f"Failed to get ComfyUI version: {e}")
return comfyui_version.strip()
""" Get the version of ComfyUI from the pyproject.toml file. """
with open("pyproject.toml", "r", encoding="utf-8") as f:
return toml.load(f)["project"]["version"]

@web.middleware
async def cache_control(request: web.Request, handler):
Expand Down

0 comments on commit 28b33a3

Please sign in to comment.