nestifypy 0.1.0__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.
- nestifypy-0.1.0/LICENSE +21 -0
- nestifypy-0.1.0/PKG-INFO +208 -0
- nestifypy-0.1.0/README.md +171 -0
- nestifypy-0.1.0/pyproject.toml +103 -0
- nestifypy-0.1.0/setup.cfg +4 -0
- nestifypy-0.1.0/src/nestifypy/__init__.py +9 -0
- nestifypy-0.1.0/src/nestifypy/cli.py +510 -0
- nestifypy-0.1.0/src/nestifypy/collections/__init__.py +21 -0
- nestifypy-0.1.0/src/nestifypy/collections/array_list.py +270 -0
- nestifypy-0.1.0/src/nestifypy/collections/hash_map.py +285 -0
- nestifypy-0.1.0/src/nestifypy/collections/linked_list.py +222 -0
- nestifypy-0.1.0/src/nestifypy/collections/ordered_set.py +183 -0
- nestifypy-0.1.0/src/nestifypy/collections/queue.py +147 -0
- nestifypy-0.1.0/src/nestifypy/collections/stack.py +148 -0
- nestifypy-0.1.0/src/nestifypy/console/__init__.py +329 -0
- nestifypy-0.1.0/src/nestifypy/core/__init__.py +287 -0
- nestifypy-0.1.0/src/nestifypy/decorators/__init__.py +675 -0
- nestifypy-0.1.0/src/nestifypy/env/__init__.py +189 -0
- nestifypy-0.1.0/src/nestifypy/flow/__init__.py +319 -0
- nestifypy-0.1.0/src/nestifypy/json/__init__.py +18 -0
- nestifypy-0.1.0/src/nestifypy/json/engine.py +88 -0
- nestifypy-0.1.0/src/nestifypy/json/exceptions.py +19 -0
- nestifypy-0.1.0/src/nestifypy/json/models.py +13 -0
- nestifypy-0.1.0/src/nestifypy/json/parser.py +45 -0
- nestifypy-0.1.0/src/nestifypy/json/serializer.py +39 -0
- nestifypy-0.1.0/src/nestifypy/json/utils.py +25 -0
- nestifypy-0.1.0/src/nestifypy/json/validator.py +45 -0
- nestifypy-0.1.0/src/nestifypy/os/__init__.py +13 -0
- nestifypy-0.1.0/src/nestifypy/os/dirs.py +61 -0
- nestifypy-0.1.0/src/nestifypy/os/files.py +80 -0
- nestifypy-0.1.0/src/nestifypy/os/paths.py +43 -0
- nestifypy-0.1.0/src/nestifypy/os/process.py +56 -0
- nestifypy-0.1.0/src/nestifypy/os/system.py +50 -0
- nestifypy-0.1.0/src/nestifypy/py.typed +1 -0
- nestifypy-0.1.0/src/nestifypy/pyunix/__init__.py +55 -0
- nestifypy-0.1.0/src/nestifypy/pyunix/app.py +404 -0
- nestifypy-0.1.0/src/nestifypy/pyunix/assets.py +241 -0
- nestifypy-0.1.0/src/nestifypy/pyunix/audio.py +128 -0
- nestifypy-0.1.0/src/nestifypy/pyunix/camera.py +135 -0
- nestifypy-0.1.0/src/nestifypy/pyunix/events.py +108 -0
- nestifypy-0.1.0/src/nestifypy/pyunix/exceptions.py +35 -0
- nestifypy-0.1.0/src/nestifypy/pyunix/fonts.py +71 -0
- nestifypy-0.1.0/src/nestifypy/pyunix/input.py +271 -0
- nestifypy-0.1.0/src/nestifypy/pyunix/physics.py +363 -0
- nestifypy-0.1.0/src/nestifypy/pyunix/scene.py +277 -0
- nestifypy-0.1.0/src/nestifypy/pyunix/sprite.py +350 -0
- nestifypy-0.1.0/src/nestifypy/pyunix/text.py +148 -0
- nestifypy-0.1.0/src/nestifypy/pyunix/timer.py +149 -0
- nestifypy-0.1.0/src/nestifypy/pyunix/window.py +136 -0
- nestifypy-0.1.0/src/nestifypy/types/__init__.py +239 -0
- nestifypy-0.1.0/src/nestifypy/utils/__init__.py +206 -0
- nestifypy-0.1.0/src/nestifypy/version.py +1 -0
- nestifypy-0.1.0/src/nestifypy/yaml/__init__.py +91 -0
- nestifypy-0.1.0/src/nestifypy/yaml/bootstrap.py +28 -0
- nestifypy-0.1.0/src/nestifypy/yaml/cache.py +36 -0
- nestifypy-0.1.0/src/nestifypy/yaml/engine.py +239 -0
- nestifypy-0.1.0/src/nestifypy/yaml/exceptions.py +11 -0
- nestifypy-0.1.0/src/nestifypy/yaml/metadata.py +88 -0
- nestifypy-0.1.0/src/nestifypy/yaml/models.py +79 -0
- nestifypy-0.1.0/src/nestifypy/yaml/proxy.py +50 -0
- nestifypy-0.1.0/src/nestifypy/yaml/registry.py +84 -0
- nestifypy-0.1.0/src/nestifypy/yaml/runtime.py +92 -0
- nestifypy-0.1.0/src/nestifypy/yaml/scanner.py +107 -0
- nestifypy-0.1.0/src/nestifypy/yaml/watcher.py +117 -0
- nestifypy-0.1.0/src/nestifypy.egg-info/PKG-INFO +208 -0
- nestifypy-0.1.0/src/nestifypy.egg-info/SOURCES.txt +76 -0
- nestifypy-0.1.0/src/nestifypy.egg-info/dependency_links.txt +1 -0
- nestifypy-0.1.0/src/nestifypy.egg-info/entry_points.txt +2 -0
- nestifypy-0.1.0/src/nestifypy.egg-info/not-zip-safe +1 -0
- nestifypy-0.1.0/src/nestifypy.egg-info/requires.txt +15 -0
- nestifypy-0.1.0/src/nestifypy.egg-info/top_level.txt +1 -0
- nestifypy-0.1.0/tests/test_collections.py +92 -0
- nestifypy-0.1.0/tests/test_env.py +57 -0
- nestifypy-0.1.0/tests/test_json.py +78 -0
- nestifypy-0.1.0/tests/test_nestify.py +380 -0
- nestifypy-0.1.0/tests/test_pyunix.py +120 -0
- nestifypy-0.1.0/tests/test_yaml.py +115 -0
- nestifypy-0.1.0/tests/test_yaml_namespace.py +12 -0
nestifypy-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pynest Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
nestifypy-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nestifypy
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Modern utility and game framework for Python
|
|
5
|
+
Author: rickmviana
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/nadezhdkov/nestifypy
|
|
8
|
+
Project-URL: Repository, https://github.com/nadezhdkov/nestifypy
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/nadezhdkov/nestifypy/issues
|
|
10
|
+
Keywords: game,framework,utility,yaml,pygame,ecs,env
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
19
|
+
Classifier: Topic :: Games/Entertainment
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: pyyaml>=6.0
|
|
24
|
+
Requires-Dist: python-dotenv>=1.0
|
|
25
|
+
Requires-Dist: typer>=0.12
|
|
26
|
+
Requires-Dist: watchdog>=4.0
|
|
27
|
+
Requires-Dist: pygame>=2.6.1
|
|
28
|
+
Provides-Extra: game
|
|
29
|
+
Requires-Dist: pygame>=2.5; extra == "game"
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest-cov>=4.1; extra == "dev"
|
|
33
|
+
Requires-Dist: ruff>=0.4; extra == "dev"
|
|
34
|
+
Requires-Dist: mypy>=1.10; extra == "dev"
|
|
35
|
+
Requires-Dist: black>=24.0; extra == "dev"
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
|
|
38
|
+
<div align="center">
|
|
39
|
+
<h1>🪺 Nestifypy Framework</h1>
|
|
40
|
+
<p><strong>A Modern, Declarative Utility and Game Framework for Python 3.10+</strong></p>
|
|
41
|
+
|
|
42
|
+
<p>
|
|
43
|
+
<a href="https://github.com/nestifypy/nestifypy/actions"><img src="https://img.shields.io/badge/build-passing-brightgreen?style=flat-square" alt="Build Status"></a>
|
|
44
|
+
<a href="https://pypi.org/project/nestifypy/"><img src="https://img.shields.io/badge/python-3.10%2B-blue?style=flat-square&logo=python&logoColor=white" alt="Python Version"></a>
|
|
45
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="License"></a>
|
|
46
|
+
<a href="https://github.com/astral-sh/ruff"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff"></a>
|
|
47
|
+
<a href="SECURITY.md"><img src="https://img.shields.io/badge/security-policy-lightgrey?style=flat-square" alt="Security"></a>
|
|
48
|
+
</p>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
**Nestifypy** is a production-ready, modular utility and game framework for Python. It provides a highly declarative, decorator-driven approach to application development, focusing on performance, developer ergonomics, and strict type safety.
|
|
54
|
+
|
|
55
|
+
Whether you are building complex CLI tools, managing intelligent configuration registries, or developing 2D physics-based games, Nestifypy provides a robust foundation.
|
|
56
|
+
|
|
57
|
+
## 🚀 Key Features
|
|
58
|
+
|
|
59
|
+
### 🎮 Pyunix Game Engine (`nestifypy.pyunix`)
|
|
60
|
+
A fully declarative, decorator-driven engine built on top of `pygame`.
|
|
61
|
+
- **No Boilerplate:** Build games using `@Game`, `@Sprite`, and `@Scene` without writing messy `while True` game loops.
|
|
62
|
+
- **ECS-Friendly Architecture:** Build isolated entities and manage them easily via `SpriteGroup`.
|
|
63
|
+
- **Built-in 2D Physics:** High-performance Rigidbody physics with spatial hashing, `BoxCollider` / `CircleCollider`, and collision event hooks (`@Sprite.on_collision_enter`).
|
|
64
|
+
- **Declarative UI & Fonts:** Advanced text rendering system with outlines, shadows, anchors, and caching via the `@Game.text` decorator.
|
|
65
|
+
- **Advanced Systems:** Built-in `Camera` with smooth-follow and screenshake, flexible `Audio` management, and robust `Timer` logic tied to game Delta-Time.
|
|
66
|
+
|
|
67
|
+
### 🛠️ Core Utilities
|
|
68
|
+
- **Intelligent YAML Registry (`nestifypy.yaml`)**: An advanced configuration engine that automatically scans, caches, and indexes your YAML files, providing instant `O(1)` access via dot-notation (e.g., `yaml.get("server.port")`).
|
|
69
|
+
- **Declarative Environments (`nestifypy.env`)**: Bind `.env` variables directly to class properties using the `EnvProperty` descriptor, or inject them into functions using `@Env.inject`.
|
|
70
|
+
- **System Tools (`nestifypy.os`)**: Cross-platform, memory-efficient generators for file scanning, subprocess management, and directory operations.
|
|
71
|
+
- **CLI Ecosystem (`nestifypy cli`)**: Scaffolding tools to generate professional-grade projects instantly with built-in support for `ruff`, `pytest`, and `mypy`.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## 📦 Installation
|
|
76
|
+
|
|
77
|
+
Nestifypy requires **Python 3.10 or higher**.
|
|
78
|
+
|
|
79
|
+
To install the core utility framework (without Pygame dependencies):
|
|
80
|
+
```bash
|
|
81
|
+
pip install nestifypy
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
To install Nestifypy with **full Pyunix Game Framework** capabilities:
|
|
85
|
+
```bash
|
|
86
|
+
pip install "nestifypy[game]"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## ⚡ Quick Start
|
|
92
|
+
|
|
93
|
+
### 1. Initialize a Project
|
|
94
|
+
Use the CLI to scaffold a new project complete with a professional `pyproject.toml` and directory structure.
|
|
95
|
+
```bash
|
|
96
|
+
nestifypy init --name my_app
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 2. Building a Game (Pyunix)
|
|
100
|
+
Building a game loop is as simple as decorating a class.
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
from nestifypy.pyunix import Game, Entity, Rigidbody, BoxCollider, BodyType
|
|
104
|
+
from nestifypy.types import Vector2, Color
|
|
105
|
+
|
|
106
|
+
# 1. Define your Game
|
|
107
|
+
@Game(title="My Awesome Game", size=(800, 600), fps=60)
|
|
108
|
+
class MyGame:
|
|
109
|
+
@Game.start
|
|
110
|
+
def start(self):
|
|
111
|
+
print("Engine Initialized!")
|
|
112
|
+
self.player = Player(x=400, y=300)
|
|
113
|
+
|
|
114
|
+
@Game.update
|
|
115
|
+
def update(self, dt: float):
|
|
116
|
+
# Game logic here
|
|
117
|
+
pass
|
|
118
|
+
|
|
119
|
+
@Game.draw
|
|
120
|
+
def draw(self, screen):
|
|
121
|
+
screen.fill(Color.BLACK.to_tuple())
|
|
122
|
+
|
|
123
|
+
@Game.text(x=10, y=10, size=24, color="white", outline=True)
|
|
124
|
+
def score_ui(self):
|
|
125
|
+
return f"SCORE: 1000"
|
|
126
|
+
|
|
127
|
+
# 2. Define your Entities with Physics
|
|
128
|
+
class Player(Entity):
|
|
129
|
+
def __init__(self, x, y):
|
|
130
|
+
super().__init__(
|
|
131
|
+
x=x, y=y,
|
|
132
|
+
layer="player",
|
|
133
|
+
rigidbody=Rigidbody(body_type=BodyType.DYNAMIC, mass=1.0),
|
|
134
|
+
collider=BoxCollider(width=32, height=32)
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
@Sprite.update
|
|
138
|
+
def movement(self, dt):
|
|
139
|
+
if self.input.is_action_pressed("jump"):
|
|
140
|
+
self.rigidbody.add_impulse(Vector2(0, -500))
|
|
141
|
+
|
|
142
|
+
# 3. Run!
|
|
143
|
+
if __name__ == "__main__":
|
|
144
|
+
game = MyGame()
|
|
145
|
+
game.run()
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### 3. Smart Configuration & Env
|
|
149
|
+
Access parsed configurations instantly across your entire project.
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
from nestifypy import yaml
|
|
153
|
+
from nestifypy.env import Env
|
|
154
|
+
|
|
155
|
+
# Automatically loads .env file
|
|
156
|
+
Env.load()
|
|
157
|
+
api_key = Env.required("API_KEY")
|
|
158
|
+
|
|
159
|
+
# Fetches value from any scanned .yml file in the project natively
|
|
160
|
+
db_host = yaml.get("database.host")
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## 📚 Documentation
|
|
166
|
+
|
|
167
|
+
Detailed guides and API references for each module can be found in the `docs/` directory:
|
|
168
|
+
|
|
169
|
+
- 🎮 **[Pyunix Game Framework](docs/pyunix.md)** (Includes Physics & UI guides)
|
|
170
|
+
- ⚙️ **[YAML Intelligent Registry](docs/yaml.md)**
|
|
171
|
+
- 🔒 **[Environment Management](docs/env.md)**
|
|
172
|
+
- 📁 **[OS & File Utilities](docs/os.md)**
|
|
173
|
+
- 📝 **[JSON Tools](docs/json.md)**
|
|
174
|
+
- 🖥️ **[Console Tools](docs/console.md)**
|
|
175
|
+
- 🧱 **[Core Systems (Logger/Plugins)](docs/core.md)**
|
|
176
|
+
- ✨ **[Decorators](docs/decorators.md)**
|
|
177
|
+
- ⏱️ **[Control Flow](docs/flow.md)**
|
|
178
|
+
- 🗃️ **[Collections](docs/collections.md)**
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## 🤝 Contributing
|
|
183
|
+
|
|
184
|
+
Nestifypy is built with modern Python tools (`uv`, `ruff`, `pytest`). We welcome contributions!
|
|
185
|
+
|
|
186
|
+
1. Clone the repository.
|
|
187
|
+
2. Install development dependencies using `uv` or `pip`:
|
|
188
|
+
```bash
|
|
189
|
+
uv pip install -e ".[dev]"
|
|
190
|
+
```
|
|
191
|
+
3. Run tests:
|
|
192
|
+
```bash
|
|
193
|
+
pytest
|
|
194
|
+
```
|
|
195
|
+
4. Lint code:
|
|
196
|
+
```bash
|
|
197
|
+
ruff check .
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## 🛡️ Security
|
|
203
|
+
|
|
204
|
+
Please review our [Security Policy](SECURITY.md) for information on reporting vulnerabilities.
|
|
205
|
+
|
|
206
|
+
## 📜 License
|
|
207
|
+
|
|
208
|
+
This project is licensed under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>🪺 Nestifypy Framework</h1>
|
|
3
|
+
<p><strong>A Modern, Declarative Utility and Game Framework for Python 3.10+</strong></p>
|
|
4
|
+
|
|
5
|
+
<p>
|
|
6
|
+
<a href="https://github.com/nestifypy/nestifypy/actions"><img src="https://img.shields.io/badge/build-passing-brightgreen?style=flat-square" alt="Build Status"></a>
|
|
7
|
+
<a href="https://pypi.org/project/nestifypy/"><img src="https://img.shields.io/badge/python-3.10%2B-blue?style=flat-square&logo=python&logoColor=white" alt="Python Version"></a>
|
|
8
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="License"></a>
|
|
9
|
+
<a href="https://github.com/astral-sh/ruff"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff"></a>
|
|
10
|
+
<a href="SECURITY.md"><img src="https://img.shields.io/badge/security-policy-lightgrey?style=flat-square" alt="Security"></a>
|
|
11
|
+
</p>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
**Nestifypy** is a production-ready, modular utility and game framework for Python. It provides a highly declarative, decorator-driven approach to application development, focusing on performance, developer ergonomics, and strict type safety.
|
|
17
|
+
|
|
18
|
+
Whether you are building complex CLI tools, managing intelligent configuration registries, or developing 2D physics-based games, Nestifypy provides a robust foundation.
|
|
19
|
+
|
|
20
|
+
## 🚀 Key Features
|
|
21
|
+
|
|
22
|
+
### 🎮 Pyunix Game Engine (`nestifypy.pyunix`)
|
|
23
|
+
A fully declarative, decorator-driven engine built on top of `pygame`.
|
|
24
|
+
- **No Boilerplate:** Build games using `@Game`, `@Sprite`, and `@Scene` without writing messy `while True` game loops.
|
|
25
|
+
- **ECS-Friendly Architecture:** Build isolated entities and manage them easily via `SpriteGroup`.
|
|
26
|
+
- **Built-in 2D Physics:** High-performance Rigidbody physics with spatial hashing, `BoxCollider` / `CircleCollider`, and collision event hooks (`@Sprite.on_collision_enter`).
|
|
27
|
+
- **Declarative UI & Fonts:** Advanced text rendering system with outlines, shadows, anchors, and caching via the `@Game.text` decorator.
|
|
28
|
+
- **Advanced Systems:** Built-in `Camera` with smooth-follow and screenshake, flexible `Audio` management, and robust `Timer` logic tied to game Delta-Time.
|
|
29
|
+
|
|
30
|
+
### 🛠️ Core Utilities
|
|
31
|
+
- **Intelligent YAML Registry (`nestifypy.yaml`)**: An advanced configuration engine that automatically scans, caches, and indexes your YAML files, providing instant `O(1)` access via dot-notation (e.g., `yaml.get("server.port")`).
|
|
32
|
+
- **Declarative Environments (`nestifypy.env`)**: Bind `.env` variables directly to class properties using the `EnvProperty` descriptor, or inject them into functions using `@Env.inject`.
|
|
33
|
+
- **System Tools (`nestifypy.os`)**: Cross-platform, memory-efficient generators for file scanning, subprocess management, and directory operations.
|
|
34
|
+
- **CLI Ecosystem (`nestifypy cli`)**: Scaffolding tools to generate professional-grade projects instantly with built-in support for `ruff`, `pytest`, and `mypy`.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 📦 Installation
|
|
39
|
+
|
|
40
|
+
Nestifypy requires **Python 3.10 or higher**.
|
|
41
|
+
|
|
42
|
+
To install the core utility framework (without Pygame dependencies):
|
|
43
|
+
```bash
|
|
44
|
+
pip install nestifypy
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
To install Nestifypy with **full Pyunix Game Framework** capabilities:
|
|
48
|
+
```bash
|
|
49
|
+
pip install "nestifypy[game]"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## ⚡ Quick Start
|
|
55
|
+
|
|
56
|
+
### 1. Initialize a Project
|
|
57
|
+
Use the CLI to scaffold a new project complete with a professional `pyproject.toml` and directory structure.
|
|
58
|
+
```bash
|
|
59
|
+
nestifypy init --name my_app
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 2. Building a Game (Pyunix)
|
|
63
|
+
Building a game loop is as simple as decorating a class.
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
from nestifypy.pyunix import Game, Entity, Rigidbody, BoxCollider, BodyType
|
|
67
|
+
from nestifypy.types import Vector2, Color
|
|
68
|
+
|
|
69
|
+
# 1. Define your Game
|
|
70
|
+
@Game(title="My Awesome Game", size=(800, 600), fps=60)
|
|
71
|
+
class MyGame:
|
|
72
|
+
@Game.start
|
|
73
|
+
def start(self):
|
|
74
|
+
print("Engine Initialized!")
|
|
75
|
+
self.player = Player(x=400, y=300)
|
|
76
|
+
|
|
77
|
+
@Game.update
|
|
78
|
+
def update(self, dt: float):
|
|
79
|
+
# Game logic here
|
|
80
|
+
pass
|
|
81
|
+
|
|
82
|
+
@Game.draw
|
|
83
|
+
def draw(self, screen):
|
|
84
|
+
screen.fill(Color.BLACK.to_tuple())
|
|
85
|
+
|
|
86
|
+
@Game.text(x=10, y=10, size=24, color="white", outline=True)
|
|
87
|
+
def score_ui(self):
|
|
88
|
+
return f"SCORE: 1000"
|
|
89
|
+
|
|
90
|
+
# 2. Define your Entities with Physics
|
|
91
|
+
class Player(Entity):
|
|
92
|
+
def __init__(self, x, y):
|
|
93
|
+
super().__init__(
|
|
94
|
+
x=x, y=y,
|
|
95
|
+
layer="player",
|
|
96
|
+
rigidbody=Rigidbody(body_type=BodyType.DYNAMIC, mass=1.0),
|
|
97
|
+
collider=BoxCollider(width=32, height=32)
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
@Sprite.update
|
|
101
|
+
def movement(self, dt):
|
|
102
|
+
if self.input.is_action_pressed("jump"):
|
|
103
|
+
self.rigidbody.add_impulse(Vector2(0, -500))
|
|
104
|
+
|
|
105
|
+
# 3. Run!
|
|
106
|
+
if __name__ == "__main__":
|
|
107
|
+
game = MyGame()
|
|
108
|
+
game.run()
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 3. Smart Configuration & Env
|
|
112
|
+
Access parsed configurations instantly across your entire project.
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from nestifypy import yaml
|
|
116
|
+
from nestifypy.env import Env
|
|
117
|
+
|
|
118
|
+
# Automatically loads .env file
|
|
119
|
+
Env.load()
|
|
120
|
+
api_key = Env.required("API_KEY")
|
|
121
|
+
|
|
122
|
+
# Fetches value from any scanned .yml file in the project natively
|
|
123
|
+
db_host = yaml.get("database.host")
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## 📚 Documentation
|
|
129
|
+
|
|
130
|
+
Detailed guides and API references for each module can be found in the `docs/` directory:
|
|
131
|
+
|
|
132
|
+
- 🎮 **[Pyunix Game Framework](docs/pyunix.md)** (Includes Physics & UI guides)
|
|
133
|
+
- ⚙️ **[YAML Intelligent Registry](docs/yaml.md)**
|
|
134
|
+
- 🔒 **[Environment Management](docs/env.md)**
|
|
135
|
+
- 📁 **[OS & File Utilities](docs/os.md)**
|
|
136
|
+
- 📝 **[JSON Tools](docs/json.md)**
|
|
137
|
+
- 🖥️ **[Console Tools](docs/console.md)**
|
|
138
|
+
- 🧱 **[Core Systems (Logger/Plugins)](docs/core.md)**
|
|
139
|
+
- ✨ **[Decorators](docs/decorators.md)**
|
|
140
|
+
- ⏱️ **[Control Flow](docs/flow.md)**
|
|
141
|
+
- 🗃️ **[Collections](docs/collections.md)**
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## 🤝 Contributing
|
|
146
|
+
|
|
147
|
+
Nestifypy is built with modern Python tools (`uv`, `ruff`, `pytest`). We welcome contributions!
|
|
148
|
+
|
|
149
|
+
1. Clone the repository.
|
|
150
|
+
2. Install development dependencies using `uv` or `pip`:
|
|
151
|
+
```bash
|
|
152
|
+
uv pip install -e ".[dev]"
|
|
153
|
+
```
|
|
154
|
+
3. Run tests:
|
|
155
|
+
```bash
|
|
156
|
+
pytest
|
|
157
|
+
```
|
|
158
|
+
4. Lint code:
|
|
159
|
+
```bash
|
|
160
|
+
ruff check .
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## 🛡️ Security
|
|
166
|
+
|
|
167
|
+
Please review our [Security Policy](SECURITY.md) for information on reporting vulnerabilities.
|
|
168
|
+
|
|
169
|
+
## 📜 License
|
|
170
|
+
|
|
171
|
+
This project is licensed under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=69.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "nestifypy"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Modern utility and game framework for Python"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "rickmviana"}
|
|
14
|
+
]
|
|
15
|
+
keywords = ["game", "framework", "utility", "yaml", "pygame", "ecs", "env"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
25
|
+
"Topic :: Games/Entertainment",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
dependencies = [
|
|
29
|
+
"pyyaml>=6.0",
|
|
30
|
+
"python-dotenv>=1.0",
|
|
31
|
+
"typer>=0.12",
|
|
32
|
+
"watchdog>=4.0",
|
|
33
|
+
"pygame>=2.6.1",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
[project.optional-dependencies]
|
|
37
|
+
game = ["pygame>=2.5"]
|
|
38
|
+
dev = [
|
|
39
|
+
"pytest>=8.0",
|
|
40
|
+
"pytest-cov>=4.1",
|
|
41
|
+
"ruff>=0.4",
|
|
42
|
+
"mypy>=1.10",
|
|
43
|
+
"black>=24.0"
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
[project.urls]
|
|
47
|
+
Homepage = "https://github.com/nadezhdkov/nestifypy"
|
|
48
|
+
Repository = "https://github.com/nadezhdkov/nestifypy"
|
|
49
|
+
"Bug Tracker" = "https://github.com/nadezhdkov/nestifypy/issues"
|
|
50
|
+
|
|
51
|
+
[project.scripts]
|
|
52
|
+
nestifypy = "nestifypy.cli:main"
|
|
53
|
+
|
|
54
|
+
[tool.setuptools]
|
|
55
|
+
package-dir = {"" = "src"}
|
|
56
|
+
zip-safe = false
|
|
57
|
+
|
|
58
|
+
[tool.setuptools.dynamic]
|
|
59
|
+
version = {attr = "nestifypy.version.__version__"}
|
|
60
|
+
|
|
61
|
+
[tool.setuptools.packages.find]
|
|
62
|
+
where = ["src"]
|
|
63
|
+
include = ["nestifypy*"]
|
|
64
|
+
exclude = ["tests*"]
|
|
65
|
+
|
|
66
|
+
[tool.setuptools.package-data]
|
|
67
|
+
nestifypy = ["py.typed"]
|
|
68
|
+
|
|
69
|
+
[tool.ruff]
|
|
70
|
+
line-length = 88
|
|
71
|
+
target-version = "py310"
|
|
72
|
+
|
|
73
|
+
[tool.ruff.lint]
|
|
74
|
+
select = ["E", "F", "I", "N", "W", "UP"]
|
|
75
|
+
ignore = ["UP006", "UP007", "E501"] # Keep standard typing for now
|
|
76
|
+
|
|
77
|
+
[tool.mypy]
|
|
78
|
+
python_version = "3.10"
|
|
79
|
+
strict = true
|
|
80
|
+
|
|
81
|
+
[tool.pytest.ini_options]
|
|
82
|
+
testpaths = ["tests"]
|
|
83
|
+
python_files = ["test_*.py"]
|
|
84
|
+
addopts = "-v --cov=nestifypy --cov-report=term-missing"
|
|
85
|
+
|
|
86
|
+
[tool.coverage.run]
|
|
87
|
+
source = ["src"]
|
|
88
|
+
omit = ["*/tests/*"]
|
|
89
|
+
|
|
90
|
+
[tool.coverage.report]
|
|
91
|
+
exclude_lines = [
|
|
92
|
+
"pragma: no cover",
|
|
93
|
+
"def __repr__",
|
|
94
|
+
"raise NotImplementedError",
|
|
95
|
+
"if __name__ == .__main__.:",
|
|
96
|
+
"except ImportError:"
|
|
97
|
+
]
|
|
98
|
+
|
|
99
|
+
[dependency-groups]
|
|
100
|
+
dev = [
|
|
101
|
+
"build>=1.5.0",
|
|
102
|
+
"twine>=6.2.0",
|
|
103
|
+
]
|