Skip to content

Commit fe322ff

Browse files
authored
Merge pull request #146 from knopki/fix/refactoring
Refactoring, speed improvements, optional dependencies
2 parents a10fef8 + c1aad70 commit fe322ff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+573
-1028
lines changed

.flake8

Lines changed: 0 additions & 15 deletions
This file was deleted.

.github/workflows/linter.yml

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,49 +6,47 @@ on: # yamllint disable-line rule:truthy rule:comments
66
# allow this workflow to be called from other workflows
77
workflow_call:
88

9+
permissions:
10+
contents: read # access to check out code and install dependencies
11+
12+
env:
13+
UV_SYSTEM_PYTHON: 1
14+
915
jobs:
1016
lint:
1117
name: Lint Code Base
1218
runs-on: ubuntu-latest
13-
strategy:
14-
matrix:
15-
python-version: ["3.9"]
1619

1720
steps:
1821
- name: Checkout repository
1922
uses: actions/checkout@v4
20-
if: ${{ !env.ACT }} # skip during local actions testing
2123
with:
2224
fetch-depth: 0
2325

24-
- name: Setup Python
25-
uses: actions/setup-python@v5
26+
- name: Install uv
27+
uses: astral-sh/setup-uv@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca
2628
with:
27-
python-version: ${{ matrix.python-version }}
28-
cache: pip
29-
cache-dependency-path: pyproject.toml
30-
31-
- name: Install dependencies
32-
run: |
33-
python -m pip install --upgrade pip
34-
pip install .[lint]
29+
enable-cache: true
30+
cache-dependency-glob: "pyproject.toml"
3531

36-
- name: Autoflake
37-
run: autoflake -c -r yascheduler
32+
- name: Set up Python
33+
uses: actions/setup-python@v5
34+
with:
35+
python-version-file: "pyproject.toml"
3836

39-
- name: Black
40-
run: black --check --diff yascheduler
37+
- name: Install the project
38+
run: uv pip install -e .[dev,azure,hetzner,upcloud]
4139

42-
- name: isort
43-
run: isort -c --diff **/*.py
40+
- name: Check formatting
41+
run: |
42+
ruff format --check --diff
4443
45-
- name: flake8
44+
- name: Ruff check
4645
run: |
47-
flake8 yascheduler
46+
ruff check --exit-non-zero-on-fix
4847
49-
- name: pylint
50-
# only errors now
51-
run: pylint -E yascheduler
48+
- uses: jakebailey/pyright-action@b5d50e5cde6547546a5c4ac92e416a8c2c1a1dfe
5249

5350
- name: pyupgrade
54-
run: pyupgrade --py39-plus --keep-percent-format
51+
run: |
52+
pyupgrade --py39-plus **.py

.github/workflows/pr.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ on:
66
pull_request:
77
types: [opened, reopened, synchronize]
88

9+
permissions:
10+
contents: read # access to check out code and install dependencies
11+
12+
env:
13+
UV_SYSTEM_PYTHON: 1
14+
915
jobs:
1016
lint:
1117
uses: ./.github/workflows/linter.yml
@@ -17,19 +23,20 @@ jobs:
1723
steps:
1824
- name: Checkout repository
1925
uses: actions/checkout@v4
20-
if: ${{ !env.ACT }} # skip during local actions testing
2126

22-
- name: Setup Python
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca
29+
with:
30+
enable-cache: true
31+
cache-dependency-glob: "pyproject.toml"
32+
33+
- name: Set up Python
2334
uses: actions/setup-python@v5
2435
with:
25-
python-version: 3.13
26-
cache: pip
27-
cache-dependency-path: pyproject.toml
36+
python-version-file: "pyproject.toml"
2837

29-
- name: Install dependencies
30-
run: |
31-
python -m pip install --upgrade pip
32-
pip install .[release]
38+
- name: Install the project
39+
run: uv pip install -e .[dev]
3340

3441
- name: Build
35-
run: flit build
42+
run: python -m build

.github/workflows/push.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ on:
77
branches:
88
- master
99

10+
permissions:
11+
contents: read # access to check out code and install dependencies
12+
13+
env:
14+
UV_SYSTEM_PYTHON: 1
15+
1016
jobs:
1117
release:
1218
name: Bump version and create draft release
@@ -19,21 +25,22 @@ jobs:
1925
steps:
2026
- name: Checkout repository
2127
uses: actions/checkout@v4
22-
if: ${{ !env.ACT }} # skip during local actions testing
2328
with:
2429
fetch-depth: 0
2530

26-
- name: Setup Python
31+
- name: Install uv
32+
uses: astral-sh/setup-uv@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca
33+
with:
34+
enable-cache: true
35+
cache-dependency-glob: "pyproject.toml"
36+
37+
- name: Set up Python
2738
uses: actions/setup-python@v5
2839
with:
29-
python-version: 3.13
30-
cache: pip
31-
cache-dependency-path: pyproject.toml
40+
python-version-file: "pyproject.toml"
3241

33-
- name: Install dependencies
34-
run: |
35-
python -m pip install --upgrade pip
36-
pip install .[release]
42+
- name: Install the project
43+
run: uv pip install -e .[dev]
3744

3845
- name: Create bump and changelog
3946
id: cz
@@ -50,7 +57,7 @@ jobs:
5057
run: echo "Bumped to version ${{ steps.cz.outputs.version }}"
5158

5259
- name: Build
53-
run: flit build
60+
run: python -m build
5461

5562
- name: Stop if no bump
5663
id: no-bump

.github/workflows/release.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ on:
88

99
workflow_dispatch:
1010

11+
permissions:
12+
contents: read # access to check out code and install dependencies
13+
14+
env:
15+
UV_SYSTEM_PYTHON: 1
16+
1117
jobs:
1218
pypi-publish:
1319
runs-on: ubuntu-latest
@@ -22,24 +28,25 @@ jobs:
2228
steps:
2329
- name: Checkout repository
2430
uses: actions/checkout@v4
25-
if: ${{ !env.ACT }} # skip during local actions testing
2631
with:
2732
fetch-depth: 0
2833

29-
- name: Setup Python
34+
- name: Install uv
35+
uses: astral-sh/setup-uv@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca
36+
with:
37+
enable-cache: true
38+
cache-dependency-glob: "pyproject.toml"
39+
40+
- name: Set up Python
3041
uses: actions/setup-python@v5
3142
with:
32-
python-version: 3.13
33-
cache: pip
34-
cache-dependency-path: pyproject.toml
43+
python-version-file: "pyproject.toml"
3544

36-
- name: Install dependencies
37-
run: |
38-
python -m pip install --upgrade pip
39-
pip install .[release]
45+
- name: Install the project
46+
run: uv pip install -e .[dev]
4047

4148
- name: Build
42-
run: flit build
49+
run: python -m build
4350

4451
- name: Publish package to PyPI
4552
uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,6 @@ node_modules
136136

137137
# Current version's temporary CHANGELOG
138138
.CHANGELOG-CURRENT.md
139+
140+
# configuration file with secrets
141+
yascheduler.conf

.pre-commit-config.yaml

Lines changed: 0 additions & 97 deletions
This file was deleted.

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ There is an [example dummy C++ code][dummy-engine] with its configuration templa
1717

1818
Use `pip` and PyPI: `pip install yascheduler`.
1919

20+
By default, no cloud connectors are installed.
21+
To install the appropriate connector, use one of the commands:
22+
23+
- for Microsoft Azure: `pip install yascheduler[azure]`
24+
- for Hetzner Cloud: `pip install yascheduler[hetzner]`
25+
- for UpCloud: `pip install yascheduler[upcloud]`
26+
2027
The last updates and bugfixes can be obtained cloning the repository:
2128

2229
```sh

examples/submit_dummy_input.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
"2.input": "DEF" * 100,
1313
"3.input": "Q" * 1000,
1414
"webhook_url": (
15-
"https://hooks.slack.com/services/"
16-
"T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"
15+
"https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"
1716
),
1817
},
1918
"dummy",

0 commit comments

Comments
 (0)