Skip to main content

Chinese-New-Year-and-Zodiac

Date: Fri 10 February 2023 20:21:38 CET

Author: Nicolas Flandrois

Licence: MIT License - Copyright (c) 2023 - Nicolas Flandrois

GitHub GitHub tag (latest by date)


DESCRIPTION:

Chinese-New-Year-and-Zodiac package aim to automate finding Chinese New Year's date, and/or find the Chinese Zodiac sign, for a given Year or Date.

This package is set to be multi languages:

  • 'en' - English (default)
  • 'fr' - French
  • 'cn' - Chinese (simplified chinese, mainland china, mandarin) work in progress

Install

pip install ChineseNewYear-Zodiac

How to use it?

exemples:

from CnyZodiac import ChineseNewYearZodiac as cnyz

# Default settings (lang='en')
my_cnyz = cnyz()

# Change Language
en_cnyz = cnyz(lang='en')  # English
fr_cnyz = cnyz(lang='fr')  # French
cn_cnyz = cnyz(lang='cn')  # Simplified Chinese Mandarin  (Work In Progress)


# Chinese Zodiac for a given Year
zodiac_2023 = my_cnyz.zodiac(2023)
# output: Rabbit

# Find the Chinese New Year's date for a given year (Integer)
cny_2023 = my_cnyz.chinese_new_year(2023)
# output: datetime.date(2023, 1, 22)

# Given a datetime object find out it's Chinese Zodiac sign
zodiac_date = zodiac_date(datetime.datetime(1998, 7, 15))
# output: Tiger

# Find out what Chinese Zodiac sign is it right now
now_zodiac = my_cnyz.zodiac_now()  # e.g. if command launched on 2023-02-10
# outupt: Rabbit

# For a given datetime object, find out in more detailed informations: New Year this year, and current Chinese Zodiac
cnyz_1968 = my_cnyz.chinese_new_year_zodiac_full_details_date(datetime.datetime(1968, 6, 6, 1, 59, 5))
# output:
# {
#     'Chinese New Year': date(1968, 1, 30),
#     'Zodiac': 'Monkey',
#     'date': datetime(1968, 6, 6, 1, 59, 5),
#     'year': 1968
# }

# Get detailed information for current datetime.now() automatically
cnyz_now = my_cnyz.chinese_new_year_zodiac_full_details_now()
# output (if current datetime is 2023-02-10):
# {
#     'Chinese New Year': date(2023, 1, 22),
#     'Zodiac': 'Rabbit',
#     'date': datetime(2023, 2, 10, 1, 59, 5),
#     'year': 2023
# }

# Get detailed information for next (comming) year, based on datetime.now() automatically
cnyz_now = my_cnyz.chinese_new_year_zodiac_full_details_now()
# output (if current datetime is 2023-07-04):
# {
#     'Chinese New Year': date(2024, 2, 10),
#     'Zodiac': 'Dragon',
#     'year': 2024
# }

TODO (Work In Progress, still in development)

  • Add Simplified Chinese in multi lang.
  • Optimize code AND find a mathematical full proof way to conteract leap months, so this package can work for ANY given year/date (past of future).

Metadata

Release files for ChineseNewYear-Zodiac 1.0.0

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

Source distribution (sdist)

Source distribution for ChineseNewYear-Zodiac 1.0.0
File Size Uploaded
ChineseNewYear_Zodiac-1.0.0.tar.gz 9.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ChineseNewYear-Zodiac 1.0.0
File Interpreter ABI Platform
ChineseNewYear_Zodiac-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.0 kB

Release files / ChineseNewYear_Zodiac-1.0.0.tar.gz

Download URL ChineseNewYear_Zodiac-1.0.0.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8bb3bf6ee53de792133a68d3a8847061e7d526254106e01108685fc5ae4797d8
BLAKE2b-256 checksum
How to use checksums
30ec99dba5ca8655190a0b5a0dfd0bdfe40ab5cb600df1203d834803dfb0031f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.4

Release files / ChineseNewYear_Zodiac-1.0.0-py3-none-any.whl

Download URL ChineseNewYear_Zodiac-1.0.0-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
89f3f04793e284e2ef03ff4fcc01e44698bcb2bee556f43e7bb2773d1a1c3d22
BLAKE2b-256 checksum
How to use checksums
5f08054f54e710b5043ca58204b90c71ea8392b539a9fd56052ece0eac9bffcf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.4

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

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