-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsetup.py
More file actions
31 lines (24 loc) · 876 Bytes
/
setup.py
File metadata and controls
31 lines (24 loc) · 876 Bytes
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
from typing import Any
from setuptools import setup, find_packages
import os
def get_metadata() -> Any:
"""Simple parser for pyproject.toml"""
with open("pyproject.toml", "r") as f:
lines = f.readlines()
# Simple parsing for the specific keys you need
metadata = {}
for line in lines:
line = line.strip()
if "=" in line and not line.startswith("#"):
key, value = line.split("=", 1)
key = key.strip()
value = value.strip().strip('"').strip("'") # Remove quotes if present
metadata[key] = value
return metadata["name"], metadata["version"]
name, version = get_metadata()
# We enable with this examples in dev mode
setup(
name=name,
version=version,
packages=find_packages(include=["mloda*", "mloda_plugins*"] + (["docs"] if os.getenv("ML_DEV_MODE") else [])),
)