A comprehensive Python library for astrological calculations and chart generation
OpenAstro2 provides high-precision astrological calculations using the Swiss Ephemeris, supporting multiple chart types, house systems, and coordinate systems. It generates professional-quality SVG charts with extensive customization options.
- Natal/Radix Charts - Birth chart analysis
- Transit Charts - Current planetary influences
- Progression Charts - Secondary progressions and directions
- Solar/Lunar Returns - Annual and monthly return charts
- Lunation Charts - New Moon and Full Moon charts
- Geographic Astrology - Local Space Maps and AstroMaps
- Fixed Star Charts - Fixed star influences
- Placidus, Koch, Equal, Whole Sign, Regiomontanus
- Campanus, Morinus, Porphyrius, Topocentric
- And 15+ more systems
- Apparent Geocentric (default)
- True Geocentric
- Topocentric
- Heliocentric
- High-quality SVG chart generation
- Customizable colors, symbols, and layouts
- European and other traditional chart styles
- Export to various image formats
pip install openastro2from openastro2.openastro2 import openAstro
# Create a birth event
event = openAstro.event(
name="John Doe",
year=1990, month=6, day=15,
hour=14, minute=30, second=0,
timezone=2, # UTC+2
location="Berlin",
geolat=52.5200, geolon=13.4050
)
# Generate natal chart
chart = openAstro(event, type="Radix")
# Get planet positions
print(f"Sun position: {chart.planets_degree_ut[0]:.2f}Β°")
print(f"Moon sign: {chart.planets_sign[1]}") # 0=Aries, 1=Taurus, etc.
# Generate SVG chart
svg_content = chart.makeSVG2()
with open("natal_chart.svg", "w", encoding="utf-8") as f:
f.write(svg_content)# Get current transits
transit_chart = openAstro(event, type="Transit")
# Or for specific date
transit_event = openAstro.event_dt_str(
"Transit", "2024-12-25 12:00:00",
timezone=2, location="Berlin",
geolat=52.5200, geolon=13.4050
)
transit_chart = openAstro(event, transit_event, type="Transit")Comprehensive documentation is available in the docs/ directory:
- Installation Guide - Detailed setup instructions
- Quick Start - Get started in minutes
- API Reference - Complete API documentation
- Chart Types - All available chart types
- Configuration - Customization options
- Examples - Practical usage examples
- Testing - Testing framework
- Contributing - How to contribute
- Troubleshooting - Common issues and solutions
Try OpenAstro2 in Google Colab:
- Python 3.9+ (3.11+ recommended)
- 64-bit architecture recommended
pyswisseph>=2.10.3.2- Swiss Ephemeris calculationsskyfield>=1.46- Astronomical computationssvgwrite>=1.4.3- SVG generationpandas>=2.0.2- Data manipulationnumpy>=1.26.4- Numerical operations
librsvg2-bin- SVG to image conversionimagemagick- Additional image formats
# Generate client chart with custom settings
settings = {
'astrocfg': {
'houses_system': 'P', # Placidus
'language': 'en',
'zodiactype': 'tropical'
}
}
chart = openAstro(client_event, type="Radix", settings=settings)# Batch process multiple charts
people_data = [...] # List of birth data
results = []
for person in people_data:
event = openAstro.event(**person)
chart = openAstro(event, type="Radix")
results.append({
'name': person['name'],
'sun_sign': chart.planets_sign[0],
'moon_sign': chart.planets_sign[1]
})# API endpoint for chart generation
def generate_chart_api(birth_data):
try:
event = openAstro.event(**birth_data)
chart = openAstro(event, type="Radix")
return {'svg': chart.makeSVG2(), 'status': 'success'}
except Exception as e:
return {'error': str(e), 'status': 'error'}# Run test suite
pytest tests/ -v
# Run with coverage
pytest tests/ --cov=openastro2 --cov-report=html
# Run specific test
pytest tests/test_chart_list.py::test_openastro_types -vWe welcome contributions! Please see our Contributing Guide for details.
# Clone repository
git clone https://github.com/dimmastro/openastro2.git
cd openastro2
# Create virtual environment
python -m venv venv
source venv/bin/activate # Linux/macOS
venv\Scripts\activate # Windows
# Install development dependencies
pip install -r requirements.txt
pip install pytest pytest-cov black flake8
# Install in development mode
pip install -e .
# Run tests
pytest tests/OpenAstro2 is released under the GNU General Public License v3.0. See LICENSE for details.
- Swiss Ephemeris by Astrodienst for accurate astronomical calculations
- Original OpenAstro project by Pelle van der Scheer
- Contributors who help improve the project
- Documentation: Check the docs/ directory
- Issues: GitHub Issues
- Discussions: GitHub Discussions
OpenAstro2 - Making professional astrological calculations accessible to everyone.