BEMPy is a library for building complex classes using the Block-Element-Modifier methodology. It provides a structured approach to class composition through reusable, modifiable components.
- Blocks: Independent entities that form the foundation of your components
- Modifiers: Variations that alter a block's appearance or behavior
- Inheritance: Blocks can inherit and extend properties from other blocks
pip install bempyfrom bempy import bem_scope
from bempy.builder import Build
# Set the scope to look for blocks
bem_scope('./blocks')
# Create a character with modifiers
character = Build('game/Character',
race='elf',
gender='female',
abilities=['agility'])
# Initialize the character with specific parameters
player = character(level=10, fertility=80, mana=100)Blocks are organized in a specific directory structure:
blocks/
game/
Character/
__init__.py # Base implementation
_gender/ # Gender modifiers
female.py
male.py
_race/ # Race modifiers
elf.py
human.py
BEMPy includes a command-line tool for creating and managing blocks:
# Create a new block
bempy create-block game/Character
# Add a modifier
bempy create-modifier game/Character race elf
# List available blocks
bempy listFor detailed documentation, see:
GNU General Public License v3.0 (GPL-3.0)
Alexander Kondratev (alex@nder.work)