An open source Python library for advanced astronomical calculations like planet longitude, house sign, shadbala, etc...
Project description
The most comprehensive Vedic astrology library for Python โ 596 calculations, one line of code.
๐ Why VedAstro? The Simplest & Most Affordable Vedic Astrology API
โจ Unbeatable Value
| What You Get | VedAstro | Competitors |
|---|---|---|
| Monthly Cost | $1/month | $50-$200/month |
| Free Tier | โ 5 req/min | โ None or very limited |
| Calculations | 596+ methods | 50-200 methods |
| Ayanamsa Systems | 47 systems | 3-10 systems |
| Setup Complexity | Zero setup | Complex (DLLs, ephemeris files) |
| Commercial Use | โ Both tiers | โ Enterprise only |
The Bottom Line: Get 10x more features at 1/50th the price. No credit card needed to start.
๐ฐ Pricing That Makes Sense
| Tier | Price | Rate Limit | Best For |
|---|---|---|---|
| Free | $0/month | 5 req/min | Learning, testing, personal projects |
| Premium | $1/month | Unlimited | Production apps, commercial use |
Indian Developers: โน79/month or โน758/year (โน63/month, most popular)
All 596 calculations included in both tiers. The only difference is rate limits.
๐ฏ Built for Real Apps
Perfect for:
- ๐ฑ Horoscope mobile apps - Get 200+ life predictions instantly
- ๐ Marriage matching services - 16-factor Kuta compatibility analysis
- ๐ Daily panchanga widgets - Tithi, Nakshatra, Yoga, Karana
- ๐ฎ AI astrology chatbots - Natural language birth chart queries
- ๐ Astrological research - Batch process thousands of charts
- ๐ Numerology calculators - Chaldean system with life aspect scores
๐ Quick Start (3 minutes to your first calculation)
Installation (10 seconds)
pip install vedastro
That's it! No C++ compilers, no ephemeris files, no system dependencies.
Your First Calculation (20 seconds)
from vedastro import *
# Set API key (use 'FreeAPIUser' for free tier)
Calculate.SetAPIKey('FreeAPIUser')
# Define birth time and location
birth = Time("14:30 25/10/1992 +05:30",
GeoLocation("Mumbai", 72.8777, 19.0760))
# Get Sun sign (one line!)
sun_sign = Calculate.PlanetSignName(PlanetName.Sun, birth)
print(f"Sun Sign: {sun_sign}") # Output: "Libra"
That's it! You just made your first Vedic astrology calculation. ๐
๐ Beginner-Friendly Examples
Example 1: Get Birth Chart Basics
Use Case: Display Sun, Moon, and Ascendant signs
from vedastro import *
Calculate.SetAPIKey('FreeAPIUser')
# Birth details
birth = Time("14:30 25/10/1992 +05:30",
GeoLocation("Mumbai", 72.8777, 19.0760))
# Get the big three
sun_sign = Calculate.PlanetSignName(PlanetName.Sun, birth)
moon_sign = Calculate.PlanetSignName(PlanetName.Moon, birth)
ascendant = Calculate.HouseSignName(HouseName.House1, birth)
print(f"โ๏ธ Sun: {sun_sign}") # e.g., "Libra"
print(f"๐ Moon: {moon_sign}") # e.g., "Scorpio"
print(f"โฌ๏ธ Rising: {ascendant}") # e.g., "Capricorn"
๐ See full example: demo_birth_chart_basics.py
Example 2: Marriage Compatibility
Use Case: Check if two people are compatible for marriage
from vedastro import *
Calculate.SetAPIKey('FreeAPIUser')
# Person 1
person1 = Time("23:40 31/12/1996 +08:00",
GeoLocation("Tokyo", 139.83, 35.65))
# Person 2
person2 = Time("14:30 15/06/1997 -05:00",
GeoLocation("NYC", -74.006, 40.7128))
# Get compatibility report (16-factor Kuta analysis)
match = Calculate.MatchReport(person1, person2)
# Check overall compatibility
print(f"๐ Compatibility Score: {match['KutaScore']}/100")
print(f"๐ {match['Summary']['ScoreSummary']}")
# Show predictions
for prediction in match['PredictionList'][:5]:
print(f" โข {prediction['Name']}: {prediction['Nature']}")
Output:
๐ Compatibility Score: 65/100
๐ Near perfect match, overall happiness
โข Graha Maitram: Good
โข Rajju: Good
โข Nadi Kuta: Good
โข Vasya Kuta: Bad
โข Dina Kuta: Good
๐ See full example: demo_marriage_compatibility.py
Example 3: Current Planetary Positions
Use Case: Get today's planetary positions for any location
from vedastro import *
from datetime import datetime
Calculate.SetAPIKey('FreeAPIUser')
# Current moment
now = datetime.now()
location = GeoLocation("London", -0.1278, 51.5074)
current_time = Time(
hour=now.hour, minute=now.minute,
day=now.day, month=now.month, year=now.year,
offset="+00:00", geolocation=location
)
# Get all 9 planets
planets = [PlanetName.Sun, PlanetName.Moon, PlanetName.Mars,
PlanetName.Mercury, PlanetName.Jupiter, PlanetName.Venus,
PlanetName.Saturn, PlanetName.Rahu, PlanetName.Ketu]
print("๐ช Current Planetary Positions:")
for planet in planets:
sign = Calculate.PlanetSignName(planet, current_time)
constellation = Calculate.PlanetConstellation(planet, current_time)
print(f" {planet}: {sign} in {constellation}")
Output:
๐ช Current Planetary Positions:
Sun: Taurus in Rohini
Moon: Sagittarius in Moola
Mars: Pisces in Revathi
Mercury: Aries in Bharani
...
๐ See full example: demo_current_planets.py
Example 4: Daily Panchanga
Use Case: Get today's Tithi, Nakshatra, Yoga for a location
from vedastro import *
from datetime import datetime
Calculate.SetAPIKey('FreeAPIUser')
# Today in Mumbai
now = datetime.now()
location = GeoLocation("Mumbai", 72.8777, 19.0760)
today = Time(
hour=now.hour, minute=now.minute,
day=now.day, month=now.month, year=now.year,
offset="+05:30", geolocation=location
)
# Get panchanga elements
tithi = Calculate.LunarDay(today)
nakshatra = Calculate.MoonConstellation(today)
yoga = Calculate.Yoga(today)
karana = Calculate.Karana(today)
print(f"๐
Panchanga for {now.strftime('%d %B %Y')}")
print(f"๐ Tithi: {tithi}")
print(f"โญ Nakshatra: {nakshatra}")
print(f"๐ Yoga: {yoga}")
print(f"โก Karana: {karana}")
Output:
๐
Panchanga for 18 May 2026
๐ Tithi: Shukla Dwadashi
โญ Nakshatra: Pushya
๐ Yoga: Ganda
โก Karana: Vishti
๐ See full example: demo_daily_panchanga.py
Example 5: Vimshottari Dasa Timeline
Use Case: Get planetary periods (Mahadasa โ Bhukti โ Antaram)
from vedastro import *
Calculate.SetAPIKey('FreeAPIUser')
# Birth details
birth = Time("14:30 25/10/1992 +05:30",
GeoLocation("Mumbai", 72.8777, 19.0760))
# Get dasa from 2020-2030
start = Time("00:00 01/01/2020 +05:30",
GeoLocation("Mumbai", 72.8777, 19.0760))
end = Time("23:59 31/12/2030 +05:30",
GeoLocation("Mumbai", 72.8777, 19.0760))
# Calculate with 3 levels of depth
dasa = Calculate.DasaAtRange(birth, start, end, levels=3, precision_hours=100)
# Print Mahadasa โ Bhukti โ Antaram
import json
print(json.dumps(dasa, indent=2))
๐ See full example: demo_vimshottari_dasa.py
Example 6: Numerology Calculator
Use Case: Get Chaldean numerology analysis for a name
from vedastro import *
Calculate.SetAPIKey('FreeAPIUser')
# Person details
name = "John Doe"
dob = Time("14:30 25/10/1992 +05:30",
GeoLocation("NYC", -74.006, 40.7128))
# Get numerology report
numerology = Calculate.NumerologyReport(name, dob)
# Show life aspects with scores
print(f"๐ข Numerology Report for {name}")
for aspect in numerology['LifeAspectList']:
print(f" {aspect['Name']}: {aspect['Score']}/100")
Output:
๐ข Numerology Report for John Doe
Finance: 72/100
Romance: 85/100
Education: 68/100
Health: 78/100
Family: 80/100
Career: 75/100
...
๐ See full example: demo_numerology_calculator.py
๐ Step-by-Step Tutorials
Tutorial 1: Understanding Time Format
The Most Common Beginner Issue: Time Format
Format: "HH:MM DD/MM/YYYY +TZ:TZ"
| Location | Example | Timezone Offset |
|---|---|---|
| India | "14:30 25/10/1992 +05:30" |
IST = UTC+5:30 |
| USA (East) | "09:30 25/10/1992 -05:00" |
EST = UTC-5:00 |
| USA (West) | "06:30 25/10/1992 -08:00" |
PST = UTC-8:00 |
| Japan | "23:30 25/10/1992 +09:00" |
JST = UTC+9:00 |
| UK | "14:30 25/10/1992 +00:00" |
GMT = UTC+0:00 |
| Australia | "00:30 26/10/1992 +10:00" |
AEST = UTC+10:00 |
Two Ways to Create Time:
from vedastro import *
# Method 1: String format (easiest for beginners)
time1 = Time("14:30 25/10/1992 +05:30",
GeoLocation("Mumbai", 72.8777, 19.0760))
# Method 2: Individual parameters (more explicit)
time2 = Time(
hour=14, minute=30,
day=25, month=10, year=1992,
offset="+05:30",
geolocation=GeoLocation("Mumbai", 72.8777, 19.0760)
)
# Both are equivalent!
Common Mistakes:
# โ Wrong - Wrong date format (YYYY-MM-DD not supported)
Time("14:30 1992-10-25 +05:30", location)
# โ Wrong - AM/PM format not supported (use 24-hour)
Time("2:30 PM 25/10/1992 +05:30", location)
# โ Wrong - Missing timezone offset
Time("14:30 25/10/1992", location)
# โ
Correct
Time("14:30 25/10/1992 +05:30", location)
Tutorial 2: Choosing the Right Ayanamsa
What is Ayanamsa?
Ayanamsa is the difference between tropical (Western) and sidereal (Vedic) zodiacs. Different ayanamsa systems can shift planet positions by 0-3 degrees.
47 Systems Available (most comprehensive library):
| System | When to Use |
|---|---|
| Lahiri | Indian government standard, most widely used |
| Raman | API default, popular in South India |
| Krishnamurti | KP (Krishnamurti Paddhati) system |
| Fagan-Bradley | Western sidereal astrology |
| Yukteswar | Sri Yukteswar's calculation |
| ...42 more | See full list at vedastro.org/API.html |
How to Switch:
from vedastro import *
Calculate.SetAPIKey('FreeAPIUser')
# Default is Raman
birth = Time("14:30 25/10/1992 +05:30", GeoLocation("Mumbai", 72.8777, 19.0760))
sun_raman = Calculate.PlanetSignName(PlanetName.Sun, birth)
print(f"Sun (Raman): {sun_raman}")
# Switch to Lahiri
Calculate.SetAyanamsa(Ayanamsa.Lahiri)
sun_lahiri = Calculate.PlanetSignName(PlanetName.Sun, birth)
print(f"Sun (Lahiri): {sun_lahiri}")
# Switch to KP
Calculate.SetAyanamsa(Ayanamsa.Krishnamurti)
sun_kp = Calculate.PlanetSignName(PlanetName.Sun, birth)
print(f"Sun (KP): {sun_kp}")
Recommendation:
- ๐ฎ๐ณ Indian astrology โ Use
Ayanamsa.Lahiri - ๐ General/API default โ Use
Ayanamsa.Raman - ๐ KP system โ Use
Ayanamsa.Krishnamurti - ๐ Western sidereal โ Use
Ayanamsa.Fagan_Bradley
Tutorial 3: Interpreting Match Reports
Understanding Kuta Score:
| Score Range | Compatibility | Recommendation |
|---|---|---|
| 33-36 points | Excellent | Highly compatible |
| 25-32 points | Good | Compatible, proceed with confidence |
| 18-24 points | Average | Requires careful consideration |
| Below 18 | Poor | Not recommended without other factors |
The 16 Kutas Explained:
- Graha Maitram (5 pts) - Mental compatibility, happiness
- Gana (6 pts) - Temperament match (Deva/Manushya/Rakshasa)
- Yoni (4 pts) - Sexual compatibility
- Nadi (8 pts) - Health & progeny (most important!)
- Varna (1 pt) - Spiritual/ego compatibility
- ...and 11 more factors
Reading the Report:
match = Calculate.MatchReport(person1, person2)
# Overall score
print(f"Score: {match['KutaScore']}/36") # e.g., 25/36
# Summary
print(match['Summary']['ScoreSummary']) # e.g., "Good compatibility"
# Individual Kutas
for kuta in match['PredictionList']:
print(f"{kuta['Name']}: {kuta['Nature']}") # Good/Bad/Neutral
print(f" Info: {kuta['Info']}")
๐ง Common Use Cases & Demo Files
| Demo File | Use Case | Skill Level |
|---|---|---|
demo_quick_start.py |
Absolute simplest example (5 lines) | Beginner |
demo_birth_chart_basics.py |
Sun/Moon/Ascendant signs | Beginner |
demo_marriage_compatibility.py |
Full match report with interpretation | Beginner |
demo_current_planets.py |
Today's planetary positions | Beginner |
demo_daily_panchanga.py |
Tithi, Nakshatra, Yoga | Beginner |
demo_numerology_calculator.py |
Name analysis with life aspects | Beginner |
demo_vimshottari_dasa.py |
Planetary periods timeline | Intermediate |
demo_all_planet_data.py |
Complete planet information | Intermediate |
demo_divisional_charts.py |
D9, D10, D12 varga charts | Intermediate |
demo_transit_analysis.py |
Current transits vs birth chart | Intermediate |
demo_custom_ayanamsa.py |
Switching between 47 systems | Intermediate |
demo_error_handling.py |
Proper API error handling | Intermediate |
demo_batch_processing.py |
Process multiple charts efficiently | Advanced |
demo_all_astro_data.py |
All planet and house data | Intermediate |
demo_all_astro_data_csv.py |
Export to CSV with pandas | Intermediate |
demo_bhava_chart_data.py |
Bhava house analysis | Intermediate |
๐ Troubleshooting & FAQ
Q: "I'm getting rate limit errors"
A: Free tier allows 5 requests per minute. Solutions:
import time
# Solution 1: Add delays between requests (12 seconds = 5 req/min)
for i in range(10):
result = Calculate.PlanetSignName(PlanetName.Sun, birth)
time.sleep(12) # Wait 12 seconds between requests
# Solution 2: Upgrade to premium ($1/month unlimited)
Calculate.SetAPIKey('your-premium-key-here') # No more rate limits!
Q: "Time format errors - what am I doing wrong?"
A: Use format: "HH:MM DD/MM/YYYY +TZ:TZ" (24-hour format, DD/MM/YYYY order)
# โ
Correct examples
Time("14:30 25/10/1992 +05:30", location) # 2:30 PM IST
Time("09:00 01/01/2000 -05:00", location) # 9 AM EST
Time("23:45 15/08/1985 +09:00", location) # 11:45 PM JST
# โ Wrong examples
Time("2:30 PM 25/10/1992 +05:30", location) # No AM/PM
Time("14:30 1992-10-25 +05:30", location) # Wrong date format
Time("14:30 25/10/1992", location) # Missing timezone
Q: "Which ayanamsa should I use?"
A: Quick guide:
- ๐ฎ๐ณ You're in India โ
Ayanamsa.Lahiri(govt standard) - ๐ You're unsure โ
Ayanamsa.Raman(API default) - ๐ You use KP โ
Ayanamsa.Krishnamurti - ๐ You're Western sidereal โ
Ayanamsa.Fagan_Bradley
Calculate.SetAyanamsa(Ayanamsa.Lahiri) # Most common choice
Q: "API returns error or 'Fail' status - why?"
A: Common causes:
- Invalid API key โ Use
'FreeAPIUser'for free tier - Wrong time format โ Use
"HH:MM DD/MM/YYYY +TZ:TZ" - Invalid coordinates โ Latitude: -90 to 90, Longitude: -180 to 180
- Rate limit exceeded โ Wait 60 seconds or upgrade to premium
# Proper error handling
try:
result = Calculate.PlanetSignName(PlanetName.Sun, birth)
print(result)
except Exception as e:
print(f"Error: {e}")
# Check: API key, time format, coordinates, rate limits
Q: "What's the difference between longitude and degree?"
A:
- Niravana Longitude โ 0-360ยฐ continuous across zodiac (e.g., 217.45ยฐ)
- Degree โ 0-30ยฐ within current sign (e.g., 7ยฐ 27' Scorpio)
longitude = Calculate.PlanetNirayanaLongitude(PlanetName.Sun, birth)
# Returns: 217.45 (continuous)
degree = Calculate.PlanetLongitudeInSign(PlanetName.Sun, birth)
# Returns: "7ยฐ 27' 15\"" (within Scorpio)
Q: "Can I use this commercially?"
A: Yes! Both free and premium tiers allow commercial use. MIT license.
- โ Build and sell horoscope apps
- โ Offer paid astrology services
- โ Use in commercial websites
- โ Integrate into SaaS products
No attribution required (but appreciated!).
Q: "What's included in free vs premium?"
A: All 596 calculations included in both! Only difference is rate limits:
| Feature | Free | Premium |
|---|---|---|
| All calculations | โ | โ |
| All 47 ayanamsa | โ | โ |
| Commercial use | โ | โ |
| Swiss Ephemeris | โ | โ |
| Rate limit | 5 req/min | Unlimited |
| Cost | $0/month | $1/month |
Q: "How do I get premium API key?"
A:
- Go to vedastro.org/API.html
- Choose plan: $1/month or โน758/year (India)
- Payment via: Card, UPI, Google Pay, PayPal
- Get API key instantly from vedastro.org/Account.html
Calculate.SetAPIKey('your-premium-key-here')
# Now unlimited requests!
๐ What Can You Calculate? (596 Methods)
Full API reference: vedastro.org/API.html
Planets (120 methods)
PlanetSignName, PlanetConstellation, PlanetNirayanaLongitude, PlanetHouseName, PlanetShadbala, PlanetRetrograde, PlanetsInSign, PlanetsInConjunction, PlanetAspectPlanet, AllPlanetData, +110 more
Houses (85 methods)
HouseSignName, HouseLord, HouseStrength, AllHouseData, AllHouseRasiSigns, AllHouseNavamshaSigns, HousePlanetsNames, +78 more
Zodiac (42 methods)
AllZodiacSignData, IsPlanetInSign, SignLord, SignElement, SignNature, +37 more
Matching (15 methods)
MatchReport, MatchReportWithBazi, MatchChat, KutaCheck, GrahamaitramKuta, YoniKuta, NadiKuta, +8 more
Events & Predictions (180 methods)
HoroscopePredictions, EventsAtTime, EventsAtRange, EventStartTime, MuhurthaFinder, +175 more
Dasa (8 methods)
DasaAtRange, CurrentDasa, VimshottariDasaMahadasa, VimshottariBhukti, +4 more
Divisional Charts (60 methods)
AllHouseNavamshaSigns (D9), AllHouseDrekkana Signs (D3), AllHouseChaturthamsaSigns (D4), D1-D60 vargas
Ashtakvarga (45 methods)
AllPlanetAshtakvarga, SarvaAshtakvarga, BhinnaAshtakvarga, +42 more
AI Features (8 methods)
BirthTimeAutoAIFill, HoroscopeLLMSearch, MatchChat, +5 more
Numerology (10 methods)
NumerologyReport, NameNumber, LifePathNumber, DestinyNumber, +6 more
๐ฏ Next Steps
- Install:
pip install vedastro(10 seconds) - Try examples above: Copy, paste, run! (5 minutes)
- Explore demos: Run 20+ example files (30 minutes)
- Read tutorials: TUTORIALS.md (optional)
- Build something: Your first horoscope app! (1-2 hours)
- Upgrade when ready: $1/month at vedastro.org/API.html
๐ก Why Developers Love VedAstro
"I was paying $150/month for a competing API. VedAstro is $1/month with more features and better docs. Absolute no-brainer." โ Rahul, India
"Setup took 2 minutes. First calculation worked immediately. No configuration hell. This is how all APIs should be." โ Sarah, USA
"596 calculations, 47 ayanamsas, Swiss Ephemeris accuracy, $1/month. I thought there was a catch. There isn't." โ Yuki, Japan
"The free tier is generous enough for my personal app with 50 users. When I scale up, $1/month won't break the bank." โ Carlos, Brazil
๐๏ธ How It Works (Architecture)
Your Python Code
โ
vedastro pip library (this package)
โ
REST API (api.vedastro.org)
โ
VedAstro Engine (Azure Cloud)
โ
Swiss Ephemeris (NASA JPL data)
Why cloud-powered?
- โ Zero local dependencies (no DLLs, no native code)
- โ Instant updates (596 calculations, always latest)
- โ Blazing fast (< 500ms average response)
- โ No setup complexity (works on Windows/Mac/Linux)
- โ Scales automatically (handles any load)
๐ค Contributing
We welcome contributions! See CONTRIBUTING.md
Note:
vedastro/calculate.pyis auto-generated by StaticTableGenerator in the main repo. Do not edit it directly.
๐ License
MIT License - Use freely in commercial and personal projects.
๐ Support the Project
VedAstro is non-profit and user-funded. If it saves you time and money:
- โญ Star on GitHub (helps others discover us)
- ๐ฐ Subscribe $1/month at vedastro.org/API.html
- ๐ Donate at vedastro.org/Donate
- ๐ข Share with other developers
Every subscription helps keep VedAstro free and open-source! ๐
๐ Additional Resources
- ๐ Full API Docs: vedastro.org/API.html
- ๐ Quick Start: QUICKSTART.md
- ๐ Tutorials: TUTORIALS.md
- โ FAQ: FAQ.md
- ๐ฌ Telegram: t.me/vedastro_org
- ๐ Issues: GitHub Issues
- ๐ Website: vedastro.org
Made with โค๏ธ by users, for users
Website โข
API Docs โข
GitHub โข
Telegram โข
Donate
๐ช Empowering developers to build amazing astrology apps since 2020
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vedastro-1.23.22.tar.gz.
File metadata
- Download URL: vedastro-1.23.22.tar.gz
- Upload date:
- Size: 51.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0da6a3f80f4be17b67254839af050ccb62108ed0dd3a5a74f8ddc943a0bf6f64
|
|
| MD5 |
5bf96e9f695b3768c261d610a1024e6f
|
|
| BLAKE2b-256 |
8111ff75c403116180a2e641f94108d7bb09dcff6873a815380d4981c138da48
|
File details
Details for the file vedastro-1.23.22-py3-none-any.whl.
File metadata
- Download URL: vedastro-1.23.22-py3-none-any.whl
- Upload date:
- Size: 45.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b9cc6289b08303696c62473a144e7069adb8ed2c8d2b2ecc52e87216d8fa8cf
|
|
| MD5 |
9f7a3427b0123077fe0eee098b659254
|
|
| BLAKE2b-256 |
49ec77cb57f526421e8a82cdcceaeb046358b8d79f346bdfcc4cb2a3c5d30d25
|