Skip to content

Commit 194d344

Browse files
committed
feat: Restructure to standard Python package layout
- Move source code to pyhetznerserver/ package directory - Move tests to separate tests/ directory - Update imports and package configuration - Fix __init__.py with proper exports - Update pyproject.toml for new structure - Update Makefile commands for new layout - Ensure all 24 tests pass with new structure This restructuring follows Python packaging best practices and makes the package ready for professional PyPI distribution.
1 parent a63d416 commit 194d344

File tree

16 files changed

+82
-53
lines changed

16 files changed

+82
-53
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ dev-setup: install-dev install-hooks ## setup development environment
9595
@echo "Development environment setup complete!"
9696

9797
run-example: ## run the example usage script
98-
python example_usage.py
98+
python -m pyhetznerserver.example_usage
9999

100100
test-dry-run: ## run tests in dry-run mode
101-
python test_basic.py
101+
python -m pytest tests/test_basic.py -v
102102

103103
check-all: lint type-check security test ## run all checks
104104

__init__.py

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

pyhetznerserver/__init__.py

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
"""
2+
PyHetznerServer - A modern, type-safe Python library for Hetzner Cloud Server management.
3+
4+
This library provides a comprehensive interface to manage Hetzner Cloud servers,
5+
including creation, deletion, power management, backups, and more.
6+
7+
Example:
8+
>>> from pyhetznerserver import HetznerClient
9+
>>> client = HetznerClient(token="your_api_token")
10+
>>> servers = client.servers.list()
11+
>>> print(f"Found {len(servers)} servers")
12+
"""
13+
14+
from .client import HetznerClient
15+
from .exceptions import (
16+
HetznerAPIError,
17+
AuthenticationError,
18+
ValidationError,
19+
ServerNotFoundError,
20+
RateLimitError,
21+
ConflictError,
22+
ResourceLimitError,
23+
ActionFailedError
24+
)
25+
from .models.server import Server
26+
from .models.nested import (
27+
ServerType,
28+
Datacenter,
29+
Location,
30+
Image,
31+
ISO,
32+
Protection,
33+
PublicNet,
34+
PrivateNet,
35+
IPv4,
36+
IPv6
37+
)
38+
39+
__version__ = "1.0.0"
40+
__author__ = "Mohammad Rasol Esfandiari"
41+
__email__ = "[email protected]"
42+
__license__ = "MIT"
43+
__url__ = "https://github.com/DeepPythonist/PyHetznerServer"
44+
45+
__all__ = [
46+
# Main client
47+
"HetznerClient",
48+
49+
# Exceptions
50+
"HetznerAPIError",
51+
"AuthenticationError",
52+
"ValidationError",
53+
"ServerNotFoundError",
54+
"RateLimitError",
55+
"ConflictError",
56+
"ResourceLimitError",
57+
"ActionFailedError",
58+
59+
# Models
60+
"Server",
61+
"ServerType",
62+
"Datacenter",
63+
"Location",
64+
"Image",
65+
"ISO",
66+
"Protection",
67+
"PublicNet",
68+
"PrivateNet",
69+
"IPv4",
70+
"IPv6",
71+
]
File renamed without changes.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
try:
22
from pyhetznerserver import HetznerClient, ServerNotFoundError, ValidationError
33
except ImportError:
4-
from __init__ import HetznerClient
5-
from exceptions import ServerNotFoundError, ValidationError
4+
from .client import HetznerClient
5+
from .exceptions import ServerNotFoundError, ValidationError
66

77
def main():
88
client = HetznerClient(token="your_api_token_here", dry_run=True)
File renamed without changes.

0 commit comments

Comments
 (0)