add version.py

add pyproject.toml

add .hatch to gitignore
This commit is contained in:
onyx-and-iris 2022-10-28 16:57:06 +01:00
parent 67fe16e97f
commit c4ee2347ba
5 changed files with 56 additions and 1 deletions

1
.gitignore vendored
View File

@ -43,6 +43,7 @@ venv/
ENV/
env.bak/
venv.bak/
.hatch
# Test/config
quick.py

View File

@ -1,3 +1,4 @@
from .version import version as __version__
from .enum import Subs
from .events import EventClient
from .reqs import ReqClient

1
obsws_python/version.py Normal file
View File

@ -0,0 +1 @@
version = "1.2.0"

43
pyproject.toml Normal file
View File

@ -0,0 +1,43 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "obsws-python"
dynamic = ["version"]
description = "A Python SDK for OBS Studio WebSocket v5.0"
readme = "README.md"
license = "GPL-3.0-only"
requires-python = ">=3.10"
authors = [
{ name = "Adem Atikturk", email = "aatikturk@gmail.com" },
]
dependencies = [
"tomli >= 2.0.1;python_version < '3.11'",
"websocket-client",
]
[project.optional-dependencies]
dev = [
"black",
"isort",
"pytest",
"pytest-randomly",
]
[project.urls]
Homepage = "https://github.com/aatikturk/obsws-python"
[tool.hatch.version]
path = "obsws_python/version.py"
[tool.hatch.build.targets.sdist]
include = [
"/obsws_python",
]
[tool.hatch.envs.e.scripts]
events = "py {root}\\examples\\events\\."
hotkeys = "py {root}\\examples\\hotkeys\\."
levels = "py {root}\\examples\\levels\\."
scene_rotate = "py {root}\\examples\\scene_rotate\\."

View File

@ -5,7 +5,16 @@ from setuptools import find_packages, setup
HERE = pathlib.Path(__file__).parent
VERSION = "1.2.0"
def get_version():
versionpath = pathlib.Path(HERE) / "obsws_python" / "version.py"
with open(versionpath) as f:
for line in f:
if line.startswith("version"):
versionstring = line.split('"')[1]
return versionstring
VERSION = get_version()
PACKAGE_NAME = "obsws-python"
AUTHOR = "Adem Atikturk"
AUTHOR_EMAIL = "aatikturk@gmail.com"