dreamstack 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dreamstack-0.0.1/LICENSE +3 -0
- dreamstack-0.0.1/PKG-INFO +91 -0
- dreamstack-0.0.1/README.md +56 -0
- dreamstack-0.0.1/README_PYPI.md +191 -0
- dreamstack-0.0.1/pyproject.toml +102 -0
- dreamstack-0.0.1/src/.gitkeep +0 -0
- dreamstack-0.0.1/src/__init__.py +0 -0
- dreamstack-0.0.1/src/dreamstack/__init__.py +74 -0
- dreamstack-0.0.1/src/dreamstack/__main__.py +121 -0
- dreamstack-0.0.1/src/dreamstack/__version__.py +32 -0
- dreamstack-0.0.1/src/dreamstack/core.py +203 -0
dreamstack-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dreamstack
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A Python library for demonstration and publishing to PyPI.
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Keywords: scape,dreamstack
|
|
7
|
+
Author: Scape Agency
|
|
8
|
+
Author-email: info@scape.agency
|
|
9
|
+
Maintainer: Lars van Vianen
|
|
10
|
+
Maintainer-email: lars@scape.agency
|
|
11
|
+
Requires-Python: >=3.12,<4.0
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: Other/Proprietary License
|
|
15
|
+
Classifier: Natural Language :: English
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Environment :: Web Environment
|
|
18
|
+
Classifier: Framework :: Django
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
24
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
25
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
26
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
27
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
28
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI
|
|
29
|
+
Requires-Dist: rite (>=0.0.13,<0.0.14)
|
|
30
|
+
Project-URL: Documentation, https://github.com/scape-agency/dreamstack/doc
|
|
31
|
+
Project-URL: Homepage, https://scape.agency/
|
|
32
|
+
Project-URL: Repository, https://github.com/scape-agency/dreamstack
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
<div align="right">
|
|
36
|
+
|
|
37
|
+
[](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/scape-agency/dreamstack)
|
|
38
|
+
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<header>
|
|
42
|
+
<p align="center">
|
|
43
|
+
<img src="res/logo/dreamstack-logo.png" width="20%" alt="Dreamstack Logo">
|
|
44
|
+
</p>
|
|
45
|
+
<h1 align='center' style='border-bottom: none;'>Dreamstack</h1>
|
|
46
|
+
<h3 align='center'>Scape Agency</h3>
|
|
47
|
+
</header>
|
|
48
|
+
|
|
49
|
+
<br/>
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
A Python library for demonstration and publishing to PyPI.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Installation
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pip install dreamstack
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Usage
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from dreamstack import hello
|
|
69
|
+
|
|
70
|
+
print(hello("Scape"))
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Project Structure
|
|
76
|
+
|
|
77
|
+
``` sh
|
|
78
|
+
src/dreamstack/
|
|
79
|
+
├── __init__.py # Package initialization with namespace support
|
|
80
|
+
├── __version__.py # Version management
|
|
81
|
+
├── __main__.py # CLI interface
|
|
82
|
+
└── core.py # Core greeting functions (hello, greet, format_message)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
<p align="center">
|
|
88
|
+
<b>Made with ❤️ by <a href="https://www.scape.agency" target="_blank">Scape Agency</a></b><br/>
|
|
89
|
+
<sub>Copyright 2026 Scape Agency. All Rights Reserved</sub>
|
|
90
|
+
</p>
|
|
91
|
+
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<div align="right">
|
|
2
|
+
|
|
3
|
+
[](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/scape-agency/dreamstack)
|
|
4
|
+
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<header>
|
|
8
|
+
<p align="center">
|
|
9
|
+
<img src="res/logo/dreamstack-logo.png" width="20%" alt="Dreamstack Logo">
|
|
10
|
+
</p>
|
|
11
|
+
<h1 align='center' style='border-bottom: none;'>Dreamstack</h1>
|
|
12
|
+
<h3 align='center'>Scape Agency</h3>
|
|
13
|
+
</header>
|
|
14
|
+
|
|
15
|
+
<br/>
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
A Python library for demonstration and publishing to PyPI.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install dreamstack
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from dreamstack import hello
|
|
35
|
+
|
|
36
|
+
print(hello("Scape"))
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Project Structure
|
|
42
|
+
|
|
43
|
+
``` sh
|
|
44
|
+
src/dreamstack/
|
|
45
|
+
├── __init__.py # Package initialization with namespace support
|
|
46
|
+
├── __version__.py # Version management
|
|
47
|
+
├── __main__.py # CLI interface
|
|
48
|
+
└── core.py # Core greeting functions (hello, greet, format_message)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
<p align="center">
|
|
54
|
+
<b>Made with ❤️ by <a href="https://www.scape.agency" target="_blank">Scape Agency</a></b><br/>
|
|
55
|
+
<sub>Copyright 2026 Scape Agency. All Rights Reserved</sub>
|
|
56
|
+
</p>
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# Dreamstack
|
|
2
|
+
|
|
3
|
+
**A lightweight Python core library for the Dreamstack ecosystem.**
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/dreamstack/)
|
|
6
|
+
[](https://pypi.org/project/dreamstack/)
|
|
7
|
+
[](https://pypi.org/project/dreamstack/)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
Install Dreamstack using pip:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install dreamstack
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
### Basic Usage
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
from dreamstack import hello
|
|
27
|
+
|
|
28
|
+
# Simple greeting
|
|
29
|
+
print(hello("World"))
|
|
30
|
+
# Output: Hello, World! Welcome to the dreamstack library.
|
|
31
|
+
|
|
32
|
+
print(hello("Alice"))
|
|
33
|
+
# Output: Hello, Alice! Welcome to the dreamstack library.
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Custom Greetings
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
from dreamstack import greet
|
|
40
|
+
|
|
41
|
+
# Customizable greeting
|
|
42
|
+
print(greet("Alice"))
|
|
43
|
+
# Output: Hello, Alice!
|
|
44
|
+
|
|
45
|
+
print(greet("Bob", "Hi"))
|
|
46
|
+
# Output: Hi, Bob!
|
|
47
|
+
|
|
48
|
+
print(greet("Charlie", greeting="Hey"))
|
|
49
|
+
# Output: Hey, Charlie!
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Message Formatting
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
from dreamstack import format_message
|
|
56
|
+
|
|
57
|
+
# Basic message
|
|
58
|
+
print(format_message("Alice", "Welcome aboard"))
|
|
59
|
+
# Output: Alice: Welcome aboard
|
|
60
|
+
|
|
61
|
+
# With prefix
|
|
62
|
+
print(format_message("Bob", "Great work", prefix="[INFO]"))
|
|
63
|
+
# Output: [INFO] Bob: Great work
|
|
64
|
+
|
|
65
|
+
# With suffix
|
|
66
|
+
print(format_message("Charlie", "Task completed", suffix="✓"))
|
|
67
|
+
# Output: Charlie: Task completed ✓
|
|
68
|
+
|
|
69
|
+
# With both
|
|
70
|
+
print(format_message("Diana", "Login successful", prefix="[SUCCESS]", suffix="🎉"))
|
|
71
|
+
# Output: [SUCCESS] Diana: Login successful 🎉
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Command-Line Interface
|
|
77
|
+
|
|
78
|
+
Dreamstack also provides a simple CLI:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Basic greeting
|
|
82
|
+
python -m dreamstack Alice
|
|
83
|
+
# Output: Hello, Alice! Welcome to the dreamstack library.
|
|
84
|
+
|
|
85
|
+
# Show version
|
|
86
|
+
python -m dreamstack --version
|
|
87
|
+
|
|
88
|
+
# Verbose output
|
|
89
|
+
python -m dreamstack Bob --verbose
|
|
90
|
+
# Output:
|
|
91
|
+
# Hello, Bob! Welcome to the dreamstack library.
|
|
92
|
+
# [Dreamstack v0.1.2]
|
|
93
|
+
|
|
94
|
+
# Help
|
|
95
|
+
python -m dreamstack --help
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Features
|
|
101
|
+
|
|
102
|
+
- **Simple API**: Easy-to-use functions for common greeting tasks
|
|
103
|
+
- **Type-safe**: Full type hints for better IDE support
|
|
104
|
+
- **Validated**: Input validation with helpful error messages
|
|
105
|
+
- **CLI Support**: Use as a command-line tool
|
|
106
|
+
- **Namespace Package**: Designed to support ecosystem extensions
|
|
107
|
+
- **Well-documented**: Comprehensive docstrings and examples
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## API Reference
|
|
112
|
+
|
|
113
|
+
### `hello(name: str) -> str`
|
|
114
|
+
|
|
115
|
+
Returns a welcoming greeting message.
|
|
116
|
+
|
|
117
|
+
**Parameters:**
|
|
118
|
+
- `name` (str): The name to greet (non-empty string)
|
|
119
|
+
|
|
120
|
+
**Returns:**
|
|
121
|
+
- str: A formatted greeting message
|
|
122
|
+
|
|
123
|
+
**Raises:**
|
|
124
|
+
- `TypeError`: If name is not a string
|
|
125
|
+
- `ValueError`: If name is empty or whitespace-only
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
### `greet(name: str, greeting: str = "Hello") -> str`
|
|
130
|
+
|
|
131
|
+
Returns a customizable greeting message.
|
|
132
|
+
|
|
133
|
+
**Parameters:**
|
|
134
|
+
- `name` (str): The name to greet (non-empty string)
|
|
135
|
+
- `greeting` (str): The greeting word (default: "Hello")
|
|
136
|
+
|
|
137
|
+
**Returns:**
|
|
138
|
+
- str: A formatted greeting with custom greeting
|
|
139
|
+
|
|
140
|
+
**Raises:**
|
|
141
|
+
- `TypeError`: If name or greeting is not a string
|
|
142
|
+
- `ValueError`: If name or greeting is empty or whitespace-only
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
### `format_message(name: str, message: str, prefix: str | None = None, suffix: str | None = None) -> str`
|
|
147
|
+
|
|
148
|
+
Formats a message with optional prefix and suffix.
|
|
149
|
+
|
|
150
|
+
**Parameters:**
|
|
151
|
+
- `name` (str): The name to include in the message
|
|
152
|
+
- `message` (str): The main message content
|
|
153
|
+
- `prefix` (str | None): Optional prefix before the message
|
|
154
|
+
- `suffix` (str | None): Optional suffix after the message
|
|
155
|
+
|
|
156
|
+
**Returns:**
|
|
157
|
+
- str: A formatted message string
|
|
158
|
+
|
|
159
|
+
**Raises:**
|
|
160
|
+
- `TypeError`: If arguments are not strings (where required)
|
|
161
|
+
- `ValueError`: If name or message is empty or whitespace-only
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Requirements
|
|
166
|
+
|
|
167
|
+
- Python >= 3.12, < 3.13
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## License
|
|
172
|
+
|
|
173
|
+
Proprietary License. Copyright © 2025 [Scape Agency](https://www.scape.agency).
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Links
|
|
178
|
+
|
|
179
|
+
- **Homepage**: [https://www.scape.agency](https://www.scape.agency)
|
|
180
|
+
- **PyPI**: [https://pypi.org/project/dreamstack/](https://pypi.org/project/dreamstack/)
|
|
181
|
+
- **Issues**: Report bugs and request features on our issue tracker
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Support
|
|
186
|
+
|
|
187
|
+
For questions and support, please contact [info@scape.agency](mailto:info@scape.agency).
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
**Made with 💙 by Scape Agency**
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# =============================================================================
|
|
5
|
+
# Project Configuration
|
|
6
|
+
# =============================================================================
|
|
7
|
+
|
|
8
|
+
[project]
|
|
9
|
+
name = "dreamstack"
|
|
10
|
+
version = "0.0.1"
|
|
11
|
+
description = "A Python library for demonstration and publishing to PyPI."
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.12,<4.0"
|
|
14
|
+
authors = [{ name = "Scape Agency", email = "info@scape.agency" }]
|
|
15
|
+
maintainers = [{ name = "Lars van Vianen", email = "lars@scape.agency" }]
|
|
16
|
+
keywords = ["scape", "dreamstack"]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 5 - Production/Stable",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"License :: Other/Proprietary License",
|
|
21
|
+
"Natural Language :: English",
|
|
22
|
+
"Operating System :: OS Independent",
|
|
23
|
+
"Environment :: Web Environment",
|
|
24
|
+
"Framework :: Django",
|
|
25
|
+
"Programming Language :: Python :: 3",
|
|
26
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
27
|
+
"Programming Language :: Python :: 3.12",
|
|
28
|
+
"Programming Language :: Python :: 3.13",
|
|
29
|
+
"Programming Language :: Python :: 3.14",
|
|
30
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
31
|
+
"Topic :: Software Development :: Libraries :: Application Frameworks",
|
|
32
|
+
"Topic :: Internet :: WWW/HTTP",
|
|
33
|
+
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
|
|
34
|
+
"Topic :: Internet :: WWW/HTTP :: WSGI",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# =============================================================================
|
|
39
|
+
# Project URLs
|
|
40
|
+
# =============================================================================
|
|
41
|
+
|
|
42
|
+
[project.urls]
|
|
43
|
+
homepage = "https://scape.agency/"
|
|
44
|
+
repository = "https://github.com/scape-agency/dreamstack"
|
|
45
|
+
documentation = "https://github.com/scape-agency/dreamstack/doc"
|
|
46
|
+
|
|
47
|
+
# =============================================================================
|
|
48
|
+
# Poetry
|
|
49
|
+
# =============================================================================
|
|
50
|
+
|
|
51
|
+
[tool.poetry]
|
|
52
|
+
package-mode = true
|
|
53
|
+
packages = [{ include = "dreamstack", from = "src" }]
|
|
54
|
+
include = [
|
|
55
|
+
"src/**",
|
|
56
|
+
# "README.md",
|
|
57
|
+
"README_PYPI.md",
|
|
58
|
+
"LICENSE",
|
|
59
|
+
# "docs/**", # Include documentation in the package
|
|
60
|
+
]
|
|
61
|
+
|
|
62
|
+
# =============================================================================
|
|
63
|
+
# Dependencies
|
|
64
|
+
# =============================================================================
|
|
65
|
+
|
|
66
|
+
[tool.poetry.dependencies]
|
|
67
|
+
python = ">=3.12, <4.0"
|
|
68
|
+
rite = "^0.0.13"
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
# =============================================================================
|
|
72
|
+
# Development Dependencies
|
|
73
|
+
# =============================================================================
|
|
74
|
+
|
|
75
|
+
[tool.poetry.group.dev.dependencies]
|
|
76
|
+
pytest = ">=8.3.5" # Framework for testing
|
|
77
|
+
pytest-cov = ">=6.1.1" # Code coverage for tests
|
|
78
|
+
black = "^25.1.0" # Code formatter
|
|
79
|
+
flake8 = "^7.2.0" # Linter for code quality
|
|
80
|
+
mypy = "^1.19.1" # Static type checker
|
|
81
|
+
sphinx = ">=8.0.2" # Documentation generator
|
|
82
|
+
isort = ">=6,<8" # Import sorter
|
|
83
|
+
tox = "^4.25.0" # Testing multiple environments
|
|
84
|
+
pre-commit = "^4.5.1" # Pre-commit hooks for linting and formatting
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
# =============================================================================
|
|
88
|
+
# Build System
|
|
89
|
+
# =============================================================================
|
|
90
|
+
|
|
91
|
+
[build-system]
|
|
92
|
+
requires = ["poetry-core>=2.0.0"]
|
|
93
|
+
build-backend = "poetry.core.masonry.api"
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
# =============================================================================
|
|
97
|
+
# Scripts
|
|
98
|
+
# =============================================================================
|
|
99
|
+
|
|
100
|
+
[tool.poetry.scripts]
|
|
101
|
+
dreamstack_base = "dreamstack_base.__main__:main"
|
|
102
|
+
test = "bin.run_tests:main"
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# =============================================================================
|
|
5
|
+
# Docstring
|
|
6
|
+
# =============================================================================
|
|
7
|
+
|
|
8
|
+
"""
|
|
9
|
+
Dreamstack - A Python Library
|
|
10
|
+
=============================
|
|
11
|
+
|
|
12
|
+
Dreamstack is a demonstration library for publishing to PyPI, showcasing best practices
|
|
13
|
+
in Python package development.
|
|
14
|
+
|
|
15
|
+
This package provides utilities for greeting and message formatting, with comprehensive
|
|
16
|
+
error handling and type safety.
|
|
17
|
+
|
|
18
|
+
Examples:
|
|
19
|
+
Basic usage::
|
|
20
|
+
|
|
21
|
+
>>> from dreamstack import hello
|
|
22
|
+
>>> hello("Scape")
|
|
23
|
+
'Hello, Scape! Welcome to the dreamstack library.'
|
|
24
|
+
|
|
25
|
+
Advanced usage::
|
|
26
|
+
|
|
27
|
+
>>> from dreamstack import greet, format_message
|
|
28
|
+
>>> greet("Alice", "Hi")
|
|
29
|
+
'Hi, Alice!'
|
|
30
|
+
>>> format_message("Bob", "Task done", prefix="[INFO]")
|
|
31
|
+
'[INFO] Bob: Task done'
|
|
32
|
+
|
|
33
|
+
Attributes:
|
|
34
|
+
__version__: The version string for this package.
|
|
35
|
+
__version_info__: A tuple of version components.
|
|
36
|
+
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
# =============================================================================
|
|
40
|
+
# Imports
|
|
41
|
+
# =============================================================================
|
|
42
|
+
|
|
43
|
+
# Import | Standard Library
|
|
44
|
+
from typing import Iterable
|
|
45
|
+
|
|
46
|
+
# Import | Local
|
|
47
|
+
from dreamstack.__version__ import __version__, __version_info__
|
|
48
|
+
from dreamstack.core import format_message, greet, hello
|
|
49
|
+
|
|
50
|
+
# =============================================================================
|
|
51
|
+
# Package Initialization
|
|
52
|
+
# =============================================================================
|
|
53
|
+
|
|
54
|
+
# Enable namespace package support
|
|
55
|
+
__path__: Iterable[str]
|
|
56
|
+
__path__ = __import__(name="pkgutil").extend_path(
|
|
57
|
+
__path__,
|
|
58
|
+
__name__,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
# =============================================================================
|
|
62
|
+
# Exports
|
|
63
|
+
# =============================================================================
|
|
64
|
+
|
|
65
|
+
# Public API exports
|
|
66
|
+
__all__: list[str] = [
|
|
67
|
+
# Version information
|
|
68
|
+
"__version__",
|
|
69
|
+
"__version_info__",
|
|
70
|
+
# Core functions
|
|
71
|
+
"hello",
|
|
72
|
+
"greet",
|
|
73
|
+
"format_message",
|
|
74
|
+
]
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# =============================================================================
|
|
5
|
+
# Docstring
|
|
6
|
+
# =============================================================================
|
|
7
|
+
|
|
8
|
+
"""
|
|
9
|
+
Dreamstack - Command-Line Interface
|
|
10
|
+
===================================
|
|
11
|
+
|
|
12
|
+
Command-line interface for Dreamstack library.
|
|
13
|
+
|
|
14
|
+
Provides a simple CLI to greet users using the dreamstack library.
|
|
15
|
+
|
|
16
|
+
Examples:
|
|
17
|
+
Basic usage::
|
|
18
|
+
|
|
19
|
+
$ python -m dreamstack --version
|
|
20
|
+
dreamstack 0.0.1
|
|
21
|
+
|
|
22
|
+
$ python -m dreamstack Alice
|
|
23
|
+
Hello, Alice! Welcome to the dreamstack library.
|
|
24
|
+
|
|
25
|
+
With verbose output::
|
|
26
|
+
|
|
27
|
+
$ python -m dreamstack Bob --verbose
|
|
28
|
+
Hello, Bob! Welcome to the dreamstack library.
|
|
29
|
+
|
|
30
|
+
[Dreamstack v0.0.1]
|
|
31
|
+
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
# =============================================================================
|
|
35
|
+
# Imports
|
|
36
|
+
# =============================================================================
|
|
37
|
+
|
|
38
|
+
# Import | Standard Library
|
|
39
|
+
import argparse
|
|
40
|
+
import sys
|
|
41
|
+
from typing import Optional, Sequence
|
|
42
|
+
|
|
43
|
+
# Import | Local
|
|
44
|
+
from dreamstack import __version__, hello
|
|
45
|
+
|
|
46
|
+
# =============================================================================
|
|
47
|
+
# Functions
|
|
48
|
+
# =============================================================================
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def create_parser() -> argparse.ArgumentParser:
|
|
52
|
+
"""Create and configure the argument parser."""
|
|
53
|
+
parser = argparse.ArgumentParser(
|
|
54
|
+
prog="dreamstack",
|
|
55
|
+
description="Dreamstack - A Python library for demonstration and publishing to PyPI",
|
|
56
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
parser.add_argument(
|
|
60
|
+
"--version",
|
|
61
|
+
action="version",
|
|
62
|
+
version=f"%(prog)s {__version__}",
|
|
63
|
+
help="Show program version and exit",
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
parser.add_argument(
|
|
67
|
+
"name",
|
|
68
|
+
nargs="?",
|
|
69
|
+
default="World",
|
|
70
|
+
help="Name to greet (default: World)",
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
parser.add_argument(
|
|
74
|
+
"-v",
|
|
75
|
+
"--verbose",
|
|
76
|
+
action="store_true",
|
|
77
|
+
help="Enable verbose output",
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
return parser
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def main(argv: Optional[Sequence[str]] = None) -> int:
|
|
84
|
+
"""
|
|
85
|
+
Main entry point for the CLI.
|
|
86
|
+
|
|
87
|
+
Args:
|
|
88
|
+
argv: Command-line arguments (defaults to sys.argv)
|
|
89
|
+
|
|
90
|
+
Returns:
|
|
91
|
+
Exit code (0 for success, non-zero for failure)
|
|
92
|
+
|
|
93
|
+
"""
|
|
94
|
+
|
|
95
|
+
parser = create_parser()
|
|
96
|
+
args = parser.parse_args(argv)
|
|
97
|
+
|
|
98
|
+
try:
|
|
99
|
+
greeting = hello(args.name)
|
|
100
|
+
print(greeting)
|
|
101
|
+
|
|
102
|
+
if args.verbose:
|
|
103
|
+
print(f"\n[Dreamstack v{__version__}]")
|
|
104
|
+
|
|
105
|
+
return 0
|
|
106
|
+
|
|
107
|
+
except (ValueError, TypeError) as e:
|
|
108
|
+
print(f"Error: {e}", file=sys.stderr)
|
|
109
|
+
return 1
|
|
110
|
+
|
|
111
|
+
except KeyboardInterrupt:
|
|
112
|
+
print("\nInterrupted", file=sys.stderr)
|
|
113
|
+
return 130
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
# =============================================================================
|
|
117
|
+
# Main
|
|
118
|
+
# =============================================================================
|
|
119
|
+
|
|
120
|
+
if __name__ == "__main__":
|
|
121
|
+
sys.exit(main())
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# =============================================================================
|
|
5
|
+
# Docstring
|
|
6
|
+
# =============================================================================
|
|
7
|
+
|
|
8
|
+
"""
|
|
9
|
+
Dreamstack - Version Information
|
|
10
|
+
================================
|
|
11
|
+
|
|
12
|
+
Version information for Dreamstack package.
|
|
13
|
+
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# =============================================================================
|
|
18
|
+
# Version Information
|
|
19
|
+
# =============================================================================
|
|
20
|
+
|
|
21
|
+
__version__ = "0.0.1"
|
|
22
|
+
__version_info__ = tuple(int(i) for i in __version__.split(".") if i.isdigit())
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# =============================================================================
|
|
26
|
+
# Exports
|
|
27
|
+
# =============================================================================
|
|
28
|
+
|
|
29
|
+
__all__: list[str] = [
|
|
30
|
+
"__version__",
|
|
31
|
+
"__version_info__",
|
|
32
|
+
]
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# =============================================================================
|
|
5
|
+
# Docstring
|
|
6
|
+
# =============================================================================
|
|
7
|
+
|
|
8
|
+
"""
|
|
9
|
+
Dreamstack - Core Module
|
|
10
|
+
========================
|
|
11
|
+
|
|
12
|
+
This module contains the core functionality of the Dreamstack library.
|
|
13
|
+
|
|
14
|
+
Examples:
|
|
15
|
+
Basic greeting::
|
|
16
|
+
|
|
17
|
+
>>> from dreamstack.core import hello
|
|
18
|
+
>>> hello("Scape")
|
|
19
|
+
'Hello, Scape! Welcome to the dreamstack library.'
|
|
20
|
+
|
|
21
|
+
Customized greeting::
|
|
22
|
+
|
|
23
|
+
>>> greet("Scape", greeting="Hi")
|
|
24
|
+
'Hi, Scape!'
|
|
25
|
+
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
# =============================================================================
|
|
29
|
+
# Imports
|
|
30
|
+
# =============================================================================
|
|
31
|
+
|
|
32
|
+
from typing import Optional
|
|
33
|
+
|
|
34
|
+
# =============================================================================
|
|
35
|
+
# Functions
|
|
36
|
+
# =============================================================================
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def hello(name: str) -> str:
|
|
40
|
+
"""
|
|
41
|
+
Return a simple greeting message.
|
|
42
|
+
|
|
43
|
+
This function provides a welcoming greeting message for the dreamstack
|
|
44
|
+
library.
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
name: The name of the person or entity to greet. Must be a non-empty
|
|
48
|
+
string.
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
A formatted greeting string.
|
|
52
|
+
|
|
53
|
+
Raises:
|
|
54
|
+
ValueError: If name is empty or contains only whitespace.
|
|
55
|
+
TypeError: If name is not a string.
|
|
56
|
+
|
|
57
|
+
Examples:
|
|
58
|
+
>>> hello("World")
|
|
59
|
+
'Hello, World! Welcome to the dreamstack library.'
|
|
60
|
+
|
|
61
|
+
>>> hello("Alice")
|
|
62
|
+
'Hello, Alice! Welcome to the dreamstack library.'
|
|
63
|
+
|
|
64
|
+
"""
|
|
65
|
+
if not isinstance(name, str):
|
|
66
|
+
raise TypeError(
|
|
67
|
+
f"Expected string for 'name', got {type(name).__name__}"
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
if not name.strip():
|
|
71
|
+
raise ValueError("Name cannot be empty or contain only whitespace")
|
|
72
|
+
|
|
73
|
+
return f"Hello, {name}! Welcome to the dreamstack library."
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def greet(name: str, greeting: str = "Hello") -> str:
|
|
77
|
+
"""
|
|
78
|
+
Return a customizable greeting message.
|
|
79
|
+
|
|
80
|
+
This function provides a flexible greeting with customizable greeting text.
|
|
81
|
+
|
|
82
|
+
Args:
|
|
83
|
+
name: The name of the person or entity to greet. Must be a non-empty string.
|
|
84
|
+
greeting: The greeting word to use (default: "Hello").
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
A formatted greeting string with the custom greeting.
|
|
88
|
+
|
|
89
|
+
Raises:
|
|
90
|
+
ValueError: If name or greeting is empty or contains only whitespace.
|
|
91
|
+
TypeError: If name or greeting is not a string.
|
|
92
|
+
|
|
93
|
+
Examples:
|
|
94
|
+
>>> greet("Alice")
|
|
95
|
+
'Hello, Alice!'
|
|
96
|
+
|
|
97
|
+
>>> greet("Bob", "Hi")
|
|
98
|
+
'Hi, Bob!'
|
|
99
|
+
|
|
100
|
+
>>> greet("Charlie", greeting="Hey")
|
|
101
|
+
'Hey, Charlie!'
|
|
102
|
+
|
|
103
|
+
"""
|
|
104
|
+
if not isinstance(name, str):
|
|
105
|
+
raise TypeError(
|
|
106
|
+
f"Expected string for 'name', got {type(name).__name__}"
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
if not isinstance(greeting, str):
|
|
110
|
+
raise TypeError(
|
|
111
|
+
f"Expected string for 'greeting', got {type(greeting).__name__}"
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
if not name.strip():
|
|
115
|
+
raise ValueError("Name cannot be empty or contain only whitespace")
|
|
116
|
+
|
|
117
|
+
if not greeting.strip():
|
|
118
|
+
raise ValueError("Greeting cannot be empty or contain only whitespace")
|
|
119
|
+
|
|
120
|
+
return f"{greeting}, {name}!"
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def format_message(
|
|
124
|
+
name: str,
|
|
125
|
+
message: str,
|
|
126
|
+
prefix: Optional[str] = None,
|
|
127
|
+
suffix: Optional[str] = None,
|
|
128
|
+
) -> str:
|
|
129
|
+
"""
|
|
130
|
+
Format a message with optional prefix and suffix.
|
|
131
|
+
|
|
132
|
+
This function provides advanced message formatting capabilities.
|
|
133
|
+
|
|
134
|
+
Args:
|
|
135
|
+
name: The name to include in the message.
|
|
136
|
+
message: The main message content.
|
|
137
|
+
prefix: Optional prefix to add before the message.
|
|
138
|
+
suffix: Optional suffix to add after the message.
|
|
139
|
+
|
|
140
|
+
Returns:
|
|
141
|
+
A formatted message string.
|
|
142
|
+
|
|
143
|
+
Raises:
|
|
144
|
+
ValueError: If name or message is empty.
|
|
145
|
+
TypeError: If arguments are not strings (where required).
|
|
146
|
+
|
|
147
|
+
Examples:
|
|
148
|
+
>>> format_message("Alice", "Welcome aboard")
|
|
149
|
+
'Alice: Welcome aboard'
|
|
150
|
+
|
|
151
|
+
>>> format_message("Bob", "Great work", prefix="[INFO]")
|
|
152
|
+
'[INFO] Bob: Great work'
|
|
153
|
+
|
|
154
|
+
>>> format_message("Charlie", "Task completed", suffix="✓")
|
|
155
|
+
'Charlie: Task completed ✓'
|
|
156
|
+
|
|
157
|
+
"""
|
|
158
|
+
if not isinstance(name, str):
|
|
159
|
+
raise TypeError(
|
|
160
|
+
f"Expected string for 'name', got {type(name).__name__}"
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
if not isinstance(message, str):
|
|
164
|
+
raise TypeError(
|
|
165
|
+
f"Expected string for 'message', got {type(message).__name__}"
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
if prefix is not None and not isinstance(prefix, str):
|
|
169
|
+
raise TypeError(
|
|
170
|
+
f"Expected string for 'prefix', got {type(prefix).__name__}"
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
if suffix is not None and not isinstance(suffix, str):
|
|
174
|
+
raise TypeError(
|
|
175
|
+
f"Expected string for 'suffix', got {type(suffix).__name__}"
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
if not name.strip():
|
|
179
|
+
raise ValueError("Name cannot be empty or contain only whitespace")
|
|
180
|
+
|
|
181
|
+
if not message.strip():
|
|
182
|
+
raise ValueError("Message cannot be empty or contain only whitespace")
|
|
183
|
+
|
|
184
|
+
result = f"{name}: {message}"
|
|
185
|
+
|
|
186
|
+
if prefix:
|
|
187
|
+
result = f"{prefix} {result}"
|
|
188
|
+
|
|
189
|
+
if suffix:
|
|
190
|
+
result = f"{result} {suffix}"
|
|
191
|
+
|
|
192
|
+
return result
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
# =============================================================================
|
|
196
|
+
# Exports
|
|
197
|
+
# =============================================================================
|
|
198
|
+
|
|
199
|
+
__all__: list[str] = [
|
|
200
|
+
"hello",
|
|
201
|
+
"greet",
|
|
202
|
+
"format_message",
|
|
203
|
+
]
|