Skip to content

Commit f8a656e

Browse files
iripiristv0g
authored andcommitted
introduced pyproject.toml
Signed-off-by: iripiri <[email protected]>
1 parent a888c6a commit f8a656e

File tree

4 files changed

+60
-72
lines changed

4 files changed

+60
-72
lines changed

Dockerfile

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1-
FROM python:3.11
1+
# build stage
2+
FROM python:3.11 AS builder
23

3-
COPY requirements.txt /tmp
4-
RUN pip3 install -r /tmp/requirements.txt
4+
WORKDIR /build
5+
COPY . .
56

6-
COPY . /tmp/controller
7-
RUN cd /tmp/controller && \
8-
python3 setup.py sdist && \
9-
pip3 install dist/*.tar.gz && \
10-
rm -rf /tmp/controller
7+
COPY requirements.txt /tmp/
8+
RUN pip install --no-cache-dir -r /tmp/requirements.txt
119

12-
ENTRYPOINT [ "villas-controller" ]
10+
RUN python3 setup.py sdist && \
11+
pip install dist/*.tar.gz --target /install
12+
13+
# minimal runtime image
14+
FROM python:3.11-slim AS runtime
15+
16+
COPY --from=builder /install /usr/local/lib/python3.11/site-packages
17+
COPY etc/*.json etc/*.yaml /etc/villas/controller/
18+
COPY villas-controller.service /etc/systemd/system/
19+
20+
ENTRYPOINT ["villas-controller"]

pyproject.toml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
[build-system]
2+
requires = ["setuptools>=61", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "villas-controller"
7+
dynamic = ["version"]
8+
description = "A controller/orchestration API for real-time power system simulators"
9+
readme = "README.md"
10+
requires-python = ">=3.7"
11+
authors = [
12+
{ name="Steffen Vogel", email="[email protected]" }
13+
]
14+
dependencies = [
15+
"dotmap",
16+
"kombu",
17+
"termcolor",
18+
"psutil",
19+
"requests",
20+
"villas-node>=0.10.2",
21+
"kubernetes",
22+
"xdg",
23+
"PyYAML",
24+
"tornado",
25+
"jsonschema>=4.1.0",
26+
"pyusb"
27+
]
28+
29+
[project.license]
30+
text = "Apache-2.0"
31+
32+
[tool.setuptools.dynamic]
33+
version = { attr = "villas.controller.__version__" }
34+
35+
[tool.setuptools.packages.find]
36+
include = ["villas*"]
37+
38+
[project.scripts]
39+
villas-controller = "villas.controller.main:main"
40+
villas-ctl = "villas.controller.main:main"

setup.py

Lines changed: 2 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,9 @@
1-
from setuptools import setup, find_namespace_packages
1+
from setuptools import setup
22
from glob import glob
33

4-
import os
5-
import re
6-
7-
8-
def get_version():
9-
here = os.path.abspath(os.path.dirname(__file__))
10-
init_file = os.path.join(here, "villas", "controller", "__init__.py")
11-
12-
with open(init_file, "r") as f:
13-
content = f.read()
14-
15-
match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", content, re.M)
16-
if match:
17-
return match.group(1)
18-
19-
raise RuntimeError("Version not found")
20-
21-
22-
with open('README.md') as f:
23-
long_description = f.read()
24-
254
setup(
26-
name='villas-controller',
27-
version=get_version(),
28-
description='A controller/orchestration API for real-time '
29-
'power system simulators',
30-
long_description=long_description,
31-
long_description_content_type='text/markdown',
32-
url='https://www.fein-aachen.org/projects/villas-controller/',
33-
author='Steffen Vogel',
34-
author_email='[email protected]',
35-
license='Apache License 2.0',
36-
keywords='simulation controller villas',
37-
classifiers=[
38-
'Development Status :: 3 - Alpha',
39-
'License :: OSI Approved :: Apache Software License',
40-
'Programming Language :: Python :: 3'
41-
],
42-
packages=find_namespace_packages(include=['villas.*']),
43-
install_requires=[
44-
'dotmap',
45-
'kombu',
46-
'termcolor',
47-
'psutil',
48-
'requests',
49-
'villas-node>=0.10.2',
50-
'kubernetes',
51-
'xdg',
52-
'PyYAML',
53-
'tornado',
54-
'jsonschema>=4.1.0',
55-
'psutil',
56-
'pyusb'
57-
],
585
data_files=[
596
('/etc/villas/controller', glob('etc/*.{json,yaml}')),
607
('/etc/systemd/system', ['villas-controller.service'])
61-
],
62-
entry_points={
63-
'console_scripts': [
64-
'villas-ctl=villas.controller.main:main',
65-
'villas-controller=villas.controller.main:main'
66-
],
67-
},
68-
include_package_data=True
8+
]
699
)

villas/controller/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.4.0"
1+
__version__ = "0.4.1"

0 commit comments

Comments
 (0)