-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
68 lines (59 loc) · 2.26 KB
/
Copy pathsetup.py
File metadata and controls
68 lines (59 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import os
import re
import sys
from setuptools import find_packages, setup
from setuptools.command.develop import develop
from setuptools.command.install import install
# Handle the notebook extension installation
def enable_visual_interface():
try:
import notebook
notebook.nbextensions.install_nbextension_python(
"checklist_plus.viewer", user=True, overwrite=True)
notebook.nbextensions.enable_nbextension_python(
"checklist_plus.viewer")
except ImportError:
print("Warning: notebook not installed, skipping visual interface setup")
def enable_visual_interface_shell_cmd(direction):
sys.path.append(direction)
enable_visual_interface()
class PostDevelopCommand(develop):
"""Post-installation for development mode."""
def run(self):
develop.run(self)
self.execute(enable_visual_interface_shell_cmd, (self.install_lib,), msg="Setting up visual interface")
class PostInstallCommand(install):
"""Post-installation for install mode."""
def run(self):
install.run(self)
self.execute(enable_visual_interface_shell_cmd, (self.install_lib,), msg="Setting up visual interface")
# Get package name from environment or default
pkg_name = os.getenv("PKG_NAME", "checklist_plus")
# Read version from pyproject.toml
def get_version():
try:
with open("pyproject.toml") as f:
content = f.read()
version_match = re.search(r'^version\s*=\s*"(.*?)"', content, re.M)
if version_match:
return version_match.group(1)
except FileNotFoundError:
raise RuntimeError("pyproject.toml not found")
except Exception as e:
raise RuntimeError(f"Error reading pyproject.toml: {e}")
setup(
name=pkg_name,
version=get_version(),
packages=find_packages(exclude=['js', 'node_modules', 'tests']),
url=f"https://github.com/cowana-ai/checklist-plus",
long_description=open("README.md", encoding="utf-8").read(),
long_description_content_type="text/markdown",
author="Chingis Owana",
author_email="your.email@example.com",
python_requires=">=3.9",
cmdclass={
'develop': PostDevelopCommand,
'install': PostInstallCommand,
},
# All other metadata now comes from pyproject.toml
)