Skip to content

Commit 950ab71

Browse files
committed
🚀 Initial release of PyHetznerServer v1.0.0
- Complete Hetzner Cloud Server API coverage - Type-safe Python library with full type hints - Dry-run mode for testing without API calls - Comprehensive error handling and exception hierarchy - Automatic JSON to Python object conversion - All server actions: power management, backups, rescue mode, ISO handling - Modern Python packaging with pyproject.toml - Extensive test coverage (24 tests) - Professional documentation and CI/CD setup - Ready for PyPI publishing
0 parents  commit 950ab71

31 files changed

+2907
-0
lines changed

‎.editorconfig‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_style = space
7+
indent_size = 4
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
max_line_length = 100
11+
12+
[*.{yml,yaml}]
13+
indent_size = 2
14+
15+
[*.{json,js,ts}]
16+
indent_size = 2
17+
18+
[*.md]
19+
trim_trailing_whitespace = false
20+
max_line_length = off
21+
22+
[Makefile]
23+
indent_style = tab
24+
25+
[*.{bat,cmd}]
26+
end_of_line = crlf

‎.github/workflows/ci.yml‎

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12"]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Cache pip dependencies
25+
uses: actions/cache@v3
26+
with:
27+
path: ~/.cache/pip
28+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
29+
restore-keys: |
30+
${{ runner.os }}-pip-
31+
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install -e ".[test,dev]"
36+
37+
- name: Lint with flake8
38+
run: |
39+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
40+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=100 --statistics
41+
42+
- name: Check code formatting with Black
43+
run: |
44+
black --check --diff .
45+
46+
- name: Check import sorting with isort
47+
run: |
48+
isort --check-only --diff .
49+
50+
- name: Type checking with mypy
51+
run: |
52+
mypy pyhetznerserver/ --ignore-missing-imports
53+
54+
- name: Test with pytest
55+
run: |
56+
pytest --cov=pyhetznerserver --cov-report=xml --cov-report=term-missing
57+
58+
- name: Upload coverage to Codecov
59+
uses: codecov/codecov-action@v3
60+
with:
61+
file: ./coverage.xml
62+
flags: unittests
63+
name: codecov-umbrella
64+
fail_ci_if_error: false
65+
66+
security:
67+
runs-on: ubuntu-latest
68+
steps:
69+
- uses: actions/checkout@v4
70+
71+
- name: Set up Python
72+
uses: actions/setup-python@v4
73+
with:
74+
python-version: "3.11"
75+
76+
- name: Install dependencies
77+
run: |
78+
python -m pip install --upgrade pip
79+
pip install bandit safety
80+
81+
- name: Run Bandit security linter
82+
run: |
83+
bandit -r pyhetznerserver/ -f json -o bandit-report.json || true
84+
85+
- name: Run Safety check
86+
run: |
87+
safety check --json --output safety-report.json || true
88+
89+
build:
90+
runs-on: ubuntu-latest
91+
needs: [test, security]
92+
steps:
93+
- uses: actions/checkout@v4
94+
95+
- name: Set up Python
96+
uses: actions/setup-python@v4
97+
with:
98+
python-version: "3.11"
99+
100+
- name: Install build dependencies
101+
run: |
102+
python -m pip install --upgrade pip
103+
pip install build twine
104+
105+
- name: Build package
106+
run: |
107+
python -m build
108+
109+
- name: Check package
110+
run: |
111+
twine check dist/*
112+
113+
- name: Upload build artifacts
114+
uses: actions/upload-artifact@v3
115+
with:
116+
name: dist
117+
path: dist/
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
push:
7+
tags:
8+
- 'v*'
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12"]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install -e ".[test]"
29+
30+
- name: Test with pytest
31+
run: |
32+
pytest
33+
34+
publish:
35+
needs: test
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v4
39+
40+
- name: Set up Python
41+
uses: actions/setup-python@v4
42+
with:
43+
python-version: "3.11"
44+
45+
- name: Install build dependencies
46+
run: |
47+
python -m pip install --upgrade pip
48+
pip install build twine
49+
50+
- name: Build package
51+
run: |
52+
python -m build
53+
54+
- name: Check package
55+
run: |
56+
twine check dist/*
57+
58+
- name: Publish to Test PyPI
59+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
60+
env:
61+
TWINE_USERNAME: __token__
62+
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
63+
run: |
64+
twine upload --repository testpypi dist/*
65+
66+
- name: Publish to PyPI
67+
if: github.event_name == 'release' && github.event.action == 'published'
68+
env:
69+
TWINE_USERNAME: __token__
70+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
71+
run: |
72+
twine upload dist/*

0 commit comments

Comments
 (0)