Skip to content

Commit 35acc73

Browse files
authored
Streamline build process (#30)
* fix deprecation wanring and >=py3.10 * improve deps management * improve image build
1 parent 0142499 commit 35acc73

File tree

9 files changed

+83
-135
lines changed

9 files changed

+83
-135
lines changed

.github/workflows/container.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,20 @@ jobs:
3030
- name: Checkout repository
3131
uses: actions/checkout@v3
3232

33+
- name: Set up Python
34+
uses: actions/setup-python@v4
35+
with:
36+
python-version: "3.x"
37+
38+
- name: Install dependencies
39+
run: |
40+
python -m pip install --upgrade pip
41+
pip install -U setuptools wheel
42+
43+
- name: Build
44+
run: |
45+
python setup.py sdist bdist_wheel
46+
3347
- name: Set up QEMU
3448
uses: docker/setup-qemu-action@v2
3549

Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
FROM docker.io/python:3.11.3-slim
22

3+
ENV MPLCONFIGDIR /tmp
4+
RUN pip install --upgrade wheel pip
5+
36
WORKDIR /build
4-
COPY . .
57

6-
RUN pip install -e .
8+
COPY dist/scalr_ngine-*.whl .
9+
RUN pip install scalr_ngine-*.whl
710

811
WORKDIR /app
912

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ clean:
33
rm -rf *.dist-info
44
rm -rf dist
55
rm -rf build
6+
find -name '__pycache__' -exec rm -fr {} || true \;
67

78
build: clean
89
python3 setup.py sdist bdist_wheel
@@ -18,3 +19,6 @@ docs-publish:
1819

1920
test:
2021
tox
22+
23+
update:
24+
pip-compile -U --no-header --no-annotate --strip-extras --resolver backtracking

docker/config.yml

Lines changed: 3 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
---
2-
# NOTE: the name is used to prefix and identify resources by a tag.
3-
# If changed, existing resources become unmanaged and must be deleted manually.
42
name: app
53
enabled: false
64
dry_run: false
@@ -10,131 +8,7 @@ max_step_down: 1
108
scale_down_selection: oldest
119
cooldown_timeout: 60
1210

13-
policies:
14-
[]
15-
16-
## Query a web endpoint.
17-
## A JSON return o {"metric": <int>} is expected in this case
18-
# - name: my check over web
19-
# target: 5
20-
# source: web
21-
# query: http://localhost:8000/target.json
22-
# config:
23-
# headers:
24-
# Authorization: Bearer xyz
25-
# key: metric
26-
27-
# - name: random one to ten
28-
# target: 5
29-
# source: random
30-
# config:
31-
# start: 1
32-
# stop: 10
33-
34-
# - name: Scaling up at 7 a.m. by factor 3
35-
# source: time
36-
# target: 3
37-
# config:
38-
# start_time: "06:58"
39-
# end_time: "07:00"
40-
# metric: 1
41-
42-
# - name: Scaling down during night by factor 0.1
43-
# source: time
44-
# target: 1
45-
# config:
46-
# start_time: "22:00"
47-
# end_time: "06:59"
48-
# metric: 10
49-
11+
policies: []
5012
cloud:
51-
{}
52-
### Cloudscale.ch
53-
# kind: cloudscale_ch
54-
# launch_config:
55-
# flavor: flex-2
56-
# image: debian-10
57-
# zone: lpg1
58-
# tags:
59-
# project: gemini
60-
# ssh_keys:
61-
# - ssh-ed25519 AAAAC3N
62-
# user_data: |
63-
# #cloud-config
64-
# manage_etc_hosts: true
65-
# package_update: true
66-
# package_upgrade: true
67-
# packages:
68-
# - nginx
69-
70-
### Exoscale
71-
# kind: exoscale
72-
# launch_config:
73-
# service_offering: Micro
74-
# template: Linux Debian 11 (Bullseye) 64-bit
75-
# zone: ch-dk-2
76-
# ssh_key: resmo@diode
77-
# tags:
78-
# project: gemini
79-
# root_disk_size: 20
80-
# user_data: |
81-
# #cloud-config
82-
# manage_etc_hosts: true
83-
# packages:
84-
# - nginx
85-
86-
# ### Hetzner Cloud
87-
# kind: hcloud
88-
# launch_config:
89-
# server_type: cx11
90-
# image: debian-10
91-
# labels:
92-
# project: gemini
93-
# location: fsn1
94-
# ssh_keys:
95-
# - resmo
96-
# user_data: |
97-
# #cloud-config
98-
# manage_etc_hosts: true
99-
# package_update: true
100-
# package_upgrade: true
101-
# packages:
102-
# - nginx
103-
104-
# ### Cloudstack
105-
# kind: cloudstack
106-
# launch_config:
107-
# service_offering: Micro
108-
# template: Linux Debian 10 (Buster) 64-bit
109-
# security_groups:
110-
# - default
111-
# zone: de-muc-1
112-
# ssh_key: rmoser-puzzle
113-
# tags:
114-
# project: gemini
115-
# root_disk_size: 20
116-
# user_data: |
117-
# #cloud-config
118-
# manage_etc_hosts: true
119-
# package_update: true
120-
# package_upgrade: true
121-
# packages:
122-
# - nginx
123-
124-
# ### Digital Ocean
125-
# kind: digitalocean
126-
# launch_config:
127-
# size: s-1vcpu-1gb
128-
# image: debian-10-x64
129-
# region: ams3
130-
# ssh_keys:
131-
# - 'b5:be:e8:...'
132-
# tags:
133-
# - 'project:gemini'
134-
# user_data: |
135-
# #cloud-config
136-
# manage_etc_hosts: true
137-
# package_update: true
138-
# package_upgrade: true
139-
# packages:
140-
# - nginx
13+
kind: unset
14+
launch_config: {}

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[build-system]
2+
requires = [
3+
"setuptools>=42",
4+
"wheel"
5+
]
6+
build-backend = "setuptools.build_meta"

requirements.in

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
cloudscale-sdk
2+
cs
3+
hcloud
4+
prometheus-api-client
5+
prometheus-client
6+
pydantic-yaml
7+
pydantic
8+
python-digitalocean
9+
python-dotenv
10+
python-json-logger
11+
PyYAML
12+
requests
13+
schedule
14+
backports.zoneinfo;python_version<"3.9"

requirements.txt

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,46 @@
1+
backports-zoneinfo==0.2.1 ; python_version < "3.9"
2+
certifi==2022.12.7
3+
charset-normalizer==3.1.0
14
cloudscale-sdk==0.7.0
5+
contourpy==1.0.7
26
cs==3.0.0
7+
cycler==0.11.0
8+
dateparser==1.1.8
9+
deprecated==1.2.13
10+
fonttools==4.39.3
311
hcloud==1.19.0
12+
httmock==1.4.0
13+
idna==3.4
14+
importlib-metadata==6.6.0
15+
importlib-resources==5.12.0
16+
jsonpickle==3.0.1
17+
kiwisolver==1.4.4
18+
matplotlib==3.7.1
19+
numpy==1.24.3
20+
packaging==23.1
21+
pandas==2.0.1
22+
pillow==9.5.0
423
prometheus-api-client==0.5.3
524
prometheus-client==0.16.0
6-
pydantic-yaml==0.11.2
725
pydantic==1.10.7
26+
pydantic-yaml==0.11.2
27+
pyparsing==3.0.9
28+
python-dateutil==2.8.2
829
python-digitalocean==1.17.0
930
python-dotenv==1.0.0
1031
python-json-logger==2.0.7
11-
PyYAML==6.0
32+
pytz==2023.3
33+
pytz-deprecation-shim==0.1.0.post0
34+
pyyaml==6.0
35+
regex==2023.5.2
1236
requests==2.29.0
1337
schedule==1.2.0
38+
six==1.16.0
39+
types-deprecated==1.2.9.2
40+
typing-extensions==4.5.0
41+
tzdata==2023.3
42+
tzlocal==4.3
43+
urllib3==1.26.15
44+
wrapt==1.15.0
45+
xdg==6.0.0
46+
zipp==3.15.0

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ ignore = E261,E301,E302,E402,E731
33
max-line-length = 160
44

55
[metadata]
6-
license_file = LICENSE
6+
license_files = LICENSE

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
],
4141
install_requires=install_requires,
4242
tests_require=tests_require,
43-
python_requires=">=3.8",
43+
python_requires=">=3.10",
4444
entry_points={
4545
"console_scripts": [
4646
"scalr-ngine = scalr.app:main",

0 commit comments

Comments
 (0)