Skip to main content

Modern utility and game framework for Python

Project description

🪺 Nestifypy Framework

A Modern, Declarative Utility and Game Framework for Python 3.10+

Build Status Python Version License Ruff Security


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.

Whether you are building complex CLI tools, managing intelligent configuration registries, or developing 2D physics-based games, Nestifypy provides a robust foundation.

🚀 Key Features

🎮 Pyunix Game Engine (nestifypy.pyunix)

A fully declarative, decorator-driven engine built on top of pygame.

  • No Boilerplate: Build games using @Game, @Sprite, and @Scene without writing messy while True game loops.
  • ECS-Friendly Architecture: Build isolated entities and manage them easily via SpriteGroup.
  • Built-in 2D Physics: High-performance Rigidbody physics with spatial hashing, BoxCollider / CircleCollider, and collision event hooks (@Sprite.on_collision_enter).
  • Declarative UI & Fonts: Advanced text rendering system with outlines, shadows, anchors, and caching via the @Game.text decorator.
  • Advanced Systems: Built-in Camera with smooth-follow and screenshake, flexible Audio management, and robust Timer logic tied to game Delta-Time.

🛠️ Core Utilities

  • 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")).
  • Declarative Environments (nestifypy.env): Bind .env variables directly to class properties using the EnvProperty descriptor, or inject them into functions using @Env.inject.
  • System Tools (nestifypy.os): Cross-platform, memory-efficient generators for file scanning, subprocess management, and directory operations.
  • CLI Ecosystem (nestifypy cli): Scaffolding tools to generate professional-grade projects instantly with built-in support for ruff, pytest, and mypy.

📦 Installation

Nestifypy requires Python 3.10 or higher.

To install the core utility framework (without Pygame dependencies):

pip install nestifypy

To install Nestifypy with full Pyunix Game Framework capabilities:

pip install "nestifypy[game]"

⚡ Quick Start

1. Initialize a Project

Use the CLI to scaffold a new project complete with a professional pyproject.toml and directory structure.

nestifypy init --name my_app

2. Building a Game (Pyunix)

Building a game loop is as simple as decorating a class.

from nestifypy.pyunix import Game, Entity, Rigidbody, BoxCollider, BodyType
from nestifypy.types import Vector2, Color

# 1. Define your Game
@Game(title="My Awesome Game", size=(800, 600), fps=60)
class MyGame:
    @Game.start
    def start(self):
        print("Engine Initialized!")
        self.player = Player(x=400, y=300)

    @Game.update
    def update(self, dt: float):
        # Game logic here
        pass

    @Game.draw
    def draw(self, screen):
        screen.fill(Color.BLACK.to_tuple())

    @Game.text(x=10, y=10, size=24, color="white", outline=True)
    def score_ui(self):
        return f"SCORE: 1000"

# 2. Define your Entities with Physics
class Player(Entity):
    def __init__(self, x, y):
        super().__init__(
            x=x, y=y,
            layer="player",
            rigidbody=Rigidbody(body_type=BodyType.DYNAMIC, mass=1.0),
            collider=BoxCollider(width=32, height=32)
        )

    @Sprite.update
    def movement(self, dt):
        if self.input.is_action_pressed("jump"):
            self.rigidbody.add_impulse(Vector2(0, -500))

# 3. Run!
if __name__ == "__main__":
    game = MyGame()
    game.run()

3. Smart Configuration & Env

Access parsed configurations instantly across your entire project.

from nestifypy import yaml
from nestifypy.env import Env

# Automatically loads .env file
Env.load()
api_key = Env.required("API_KEY")

# Fetches value from any scanned .yml file in the project natively
db_host = yaml.get("database.host") 

📚 Documentation

Detailed guides and API references for each module can be found in the docs/ directory:


🤝 Contributing

Nestifypy is built with modern Python tools (uv, ruff, pytest). We welcome contributions!

  1. Clone the repository.
  2. Install development dependencies using uv or pip:
    uv pip install -e ".[dev]"
    
  3. Run tests:
    pytest
    
  4. Lint code:
    ruff check .
    

🛡️ Security

Please review our Security Policy for information on reporting vulnerabilities.

📜 License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nestifypy-0.1.0.tar.gz (74.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nestifypy-0.1.0-py3-none-any.whl (89.0 kB view details)

Uploaded Python 3

File details

Details for the file nestifypy-0.1.0.tar.gz.

File metadata

  • Download URL: nestifypy-0.1.0.tar.gz
  • Upload date:
  • Size: 74.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for nestifypy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 471d93bd6eb278b6dea3942ad8986405b89228335a7670712ce6584845074079
MD5 6d26b485e4fd05fe84416c45faec9781
BLAKE2b-256 30b1737e0231f761b52909d5a9ad6e5e5d34052c281205d84c4b6405f5d77acd

See more details on using hashes here.

File details

Details for the file nestifypy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nestifypy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 89.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for nestifypy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5f3abb8509060d5d59d7d6c7eb8a2b61bfa60b130a53bde6373b12fb75d04578
MD5 171ee93e746072aa195f4bf1fd4c2c24
BLAKE2b-256 f15c9632357b4a74f30366552d16965087d9488257f8155715beff15c8c5023a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page