PyPage is a comprehensive Python library that revolutionizes HTML generation with advanced features including dark mode, animations, responsive design, and modern UI components. Build professional websites programmatically with an intuitive, object-oriented approach.
|
|
|
|
# Basic installation
pip install pypage
# With PDF export support
pip install pypage[pdf]
# With chart support
pip install pypage[charts]
# Full installation with all features
pip install pypage[full]
from pypage import *
# Create a new page
page = Page("My Website", "Welcome to PyPage!")
# Add content
page.add_content(Heading("Hello, World!", 1))
page.add_content(Paragraph("Build amazing websites with Python."))
# Add a styled card
card = Card([
Heading("Getting Started", 3),
Paragraph("PyPage makes HTML generation simple and powerful."),
Button("Learn More", "button", css_class="btn-primary")
])
page.add_content(card)
# Generate HTML
html = page.generate_html()
print(html)
page = Page("Dark Mode Demo", "Theme Switching")
page.add_content(DarkModeToggle(position="top-right"))
page.add_content(Heading("Dark Mode Ready!", 1))
# Fade in animation
animated_content = FadeIn(
Container([
Heading("Smooth Animations", 2),
Paragraph("Content that fades in beautifully.")
])
)
page.add_content(animated_content)
row = Row()
row.add_column(Column([
Heading("Left Column", 3),
Paragraph("Responsive content here.")
], width="md-6"))
row.add_column(Column([
Heading("Right Column", 3),
Paragraph("More responsive content.")
], width="md-6"))
page.add_content(row)
# Create a chart
chart_data = {
"labels": ["Jan", "Feb", "Mar", "Apr"],
"datasets": [{
"label": "Sales",
"data": [10, 19, 3, 5]
}]
}
chart = BarChart("sales-chart", chart_data)
page.add_content(chart)
PyPage includes command-line tools for project generation:
# Create a new project
pypage create myproject
# Create a Flask project
pypage create myapp --template flask
# Generate documentation
pypage docs
PyPage includes a comprehensive set of components:
Page
- Main page container with theme supportContainer
,Div
,Section
- Layout containersHeading
,Paragraph
- Typography elementsImage
,Link
- Media and navigationCard
- Content cards with styling
Form
- Form container with validationInput
- Text, email, password, and other input typesTextArea
- Multi-line text inputSelect
- Dropdown with single/multiple selectionButton
- Submit and action buttons
Row
,Column
- Responsive grid systemFlex
- Flexbox layoutsNavbar
- Navigation with dropdown support
Modal
,Alert
,Badge
- Interactive elementsTable
,Tabs
,Carousel
- Data displayProgressBar
,Accordion
- UI componentsChart
,KPICard
- Data visualization
PyPage uses Bootstrap 5 by default with a custom dark theme:
# Set theme
page.set_theme('bootstrap') # or 'material', 'tailwind'
# Custom CSS
css_builder = CSSBuilder()
css_builder.add_rule('.custom', {
'background': 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
'color': 'white'
})
page.custom_css = css_builder.render()
The library includes a comprehensive testing application:
cd testing
python app.py
Visit http://localhost:5001
to run interactive tests and see component demonstrations.
๐ Core Documentation | ๐ฏ Guides & Tutorials | ๐ ๏ธ Development |
---|---|---|
๐ Quick Start Get up and running in 5 minutes |
๐จ Theme Customization Create beautiful custom themes |
๐ง API Reference Complete component documentation |
๐ฆ Installation Guide Multiple installation options |
๐ฑ Responsive Design Mobile-first development |
๐งช Testing Guide Test your components |
๐๏ธ Architecture Understanding PyPage structure |
๐ Dark Mode Setup Implement dark mode support |
๐ Plugin Development Create custom components |
- ๐ Component Gallery - Visual showcase of all components
- ๐ก Examples Library - Real-world usage examples
- ๐ฎ Interactive Playground - Live testing environment
- ๐บ Video Tutorials - Step-by-step video guides
- โ FAQ - Common questions and solutions
- ๐จ Theme Gallery - Beautiful theme customization examples
We love contributions from the community! PyPage is built by developers, for developers.
๐ Bug Reports
|
๐ก Feature Requests
|
๐ Documentation
|
๐ง Code Contributions
|
๐จ Themes & Examples
|
๐ฌ Community Support
|
# 1. Fork and clone the repository
git clone https://github.com/yourusername/pypage.git
cd pypage
# 2. Install development dependencies
pip install -e .[dev]
# 3. Make your changes
# Edit code, add tests, update docs
# 4. Run tests and checks
pytest # Run test suite
black . # Format code
flake8 . # Check style
mypy src/pypage/ # Type checking
# 5. Submit your pull request
git commit -m "Add amazing feature"
git push origin feature-branch
- Follow the code style - We use Black and follow PEP 8
- Add tests - New features should include tests
- Update documentation - Keep docs current with changes
- Be respectful - Follow our code of conduct
- Start small - Begin with minor improvements or bug fixes
This project is licensed under the MIT License - see the LICENSE file for details.
- Bootstrap team for the excellent CSS framework
- Flask community for web framework inspiration
- All contributors who have helped improve PyPage
PyPage - Making HTML generation simple, powerful, and beautiful.