Skip to main content

gaurabda-calendar

Python library for calculating panchanga calendar with vaisnava events.

Installation

pip install gaurabda

Using

Here are a few examples of code that you can try quickly. Examples are related to calculation of calendar. Before calendar calculation we need to specify location and start date.

We can obtain location object basically in two ways:

  • create new location

# import module

import gaurabda as gcal


# create new location

loc = gcal.GCLocation(data = {
    'latitude': 27.583,
    'longitude': 77.73,
    'tzname': '+5:30 Asia/Calcutta',
    'name': 'Vrindavan, India'
})

List of all timezones can be obtained by calling gcal.GetTimeZones().

  • find location in existing list

# find existing location

loc = gcal.FindLocation(city='Vrindavan')

List of all countries gcal.GetCountries() and list of cities for given country: gcal.GetLocationsForCountry('India'). Function GetLocationsForCountry has optional parameter limit, that takes whole number limiting number of locations returned by this method. Default value is -1, that means there is no limit.

Then we need create date object.

today = gcal.Today()
print(repr(today))

date1 = gcal.GCGregorianDate(text='24 apr 2017')
print(repr(date1))

Constructor for GCGregorianDate contains more optional parameters:

  • year, month, day that are whole natural numbers, year between 1500 - 2500, month 1-12, day according given month

  • shour is from interval 0.0 up to 1.0 where 0.0 is mignight, 0.5 is noon (12:00 PM) and 1.0 is next midnight.

  • tzone is offset from UTC 0:00 in hours, so value +5.5 means offset 5:30, which is actual for India

  • date is existing GCGregorianDate object

  • text can be text form of date (e.g. ‘24 Apr 2017’)

Parameters can be combined with certain succession of evaluation. Parameters are evaluated in this order, where later parameter overrides previous values.

  • text

  • date

  • year

  • month

  • day

  • shour

So for example, to get first day of current month, we may use:

d = gcal.GCGregorianDate(date=gcal.Today(), day=1)

Next step is to create calculation engine for calendar, execute calculation and write results to file:

# create calculation engine and calculate
tc = gcal.TCalendar()
tc.CalculateCalendar(loc,today,365)

# save results in various formats
with open('calendar.txt','wt') as wf:
    tc.write(wf, format='plain')
with open('test/calendar.rtf','wt') as wf:
    tc.write(wf, format='rtf')
with open('test/calendar.html','wt') as wf:
    tc.write(wf)
with open('test/calendar2.html','wt') as wf:
    tc.write(wf, layout='table')
with open('test/calendar.json','wt') as wf:
    tc.write(wf, format='json')
with open('test/calendar.xml','wt') as wf:
    tc.write(wf, format='xml')

Arguments for write method of TCalendar class:

  • stream any text writer, for example subclass of io.TextWriter

  • format this is optional parameter, default value is ‘html’, posible values are: ‘plain’, ‘rtf’, ‘xml’, ‘html’, ‘json’

  • layout this is optional, denotes layout of output. It is effective for ‘html’ format, and possible values are ‘list’ and ‘table’. Default is ‘list’.

Setting of fasting style

There are two fasting styles available:

    1. fasting rules based on Hari Bhakti Vilasa and applied after 2006 in GCAL program (refered as “new”)

    1. fasting rules applied before year 2006 in VCAL program (refered as “old”)

To set fasting schema we need call method that does appropriate adjustment in configuration.

import gaurabda as gcal

gcal.SetFastingSchema(1)

In the example above we set “old” style fasting. It should be done before calculations in order to apply appropriate rules for the process of calculation.

Metadata

Release files for gaurabda 0.8.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gaurabda 0.8.4
File Size Uploaded Provenance Actions
gaurabda-0.8.4.tar.gz 146.8 kB Without provenance Details for gaurabda-0.8.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gaurabda 0.8.4
File Interpreter ABI Platform Actions
gaurabda-0.8.4-py3-none-any.whl Python 3 none any Details for gaurabda-0.8.4-py3-none-any.whl

Total release size: 308.1 kB

Release files / gaurabda-0.8.4.tar.gz

Download URL gaurabda-0.8.4.tar.gz
Size 146.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c3bec2c4534f6234dbf8b98c2849ffbe6a73a972d941e2c6d792bdf9b8f71e76
BLAKE2b-256 checksum
How to use checksums
da9393253b526a557161305c738cc3cebc04fe7c6d5b44ea7d07ee7484212304
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

Release files / gaurabda-0.8.4-py3-none-any.whl

Download URL gaurabda-0.8.4-py3-none-any.whl
Size 161.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
64d373130cdf1bb3ef2c4f275fed833cc0374073d57c24cdcdca908027622f96
BLAKE2b-256 checksum
How to use checksums
c9dd76a408bb843b2813ac1ccbbeb1a0d4831caaf5b0927f4abd216d95b29fa5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

Security for gaurabda 0.8.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page