Skip to main content

Thuật toán Bát Tự Tiết Khí

Thư viện Python hỗ trợ xác định Can Chi của Tháng (theo Kinh độ mặt trời / Tiết khí) và Can Chi của Giờ (theo định luật Ngũ Tý Ca).

Cài đặt

1) Cài đặt trong môi trường ảo (khuyến nghị)

Đây là cách an toàn nhất và phù hợp với hầu hết người dùng.

python -m venv .venv
source .venv/bin/activate  # Linux/macOS
# hoặc trên Windows PowerShell:
# .\.venv\Scripts\Activate.ps1

python -m pip install --upgrade pip
python -m pip install git+https://github.com/caphenpro/battu_tietkhi.git

2) Cài đặt trực tiếp cho người dùng Linux có lỗi externally-managed-environment

Một số distro như Ubuntu, Debian mới có chính sách quản lý Python bởi hệ thống. Khi đó, pip install có thể báo lỗi externally managed environment.

python -m pip install --break-system-packages git+https://github.com/caphenpro/battu_tietkhi.git

Lưu ý:

  • --break-system-packages chỉ nên dùng khi bạn đang cài đặt vào môi trường Python do hệ thống quản lý.
  • Nếu có thể, hãy ưu tiên dùng venv thay vì cài trực tiếp vào hệ thống.

3) Cài đặt lại / làm mới cache (khi cần gỡ package cũ)

Nếu bạn từng cài bản cũ và muốn ép tải lại từ GitHub, dùng:

python -m pip install --no-cache-dir --force-reinstall git+https://github.com/caphenpro/battu_tietkhi.git

Nếu đang ở môi trường hệ thống quản lý, có thể thêm:

python -m pip install --break-system-packages --no-cache-dir --force-reinstall git+https://github.com/caphenpro/battu_tietkhi.git

4) Cài đặt từ nhánh cụ thể hoặc commit cụ thể (nâng cao)

Nếu bạn muốn cài từ một nhánh hoặc commit nhất định:

git clone https://github.com/caphenpro/battu_tietkhi.git
cd battu_tietkhi
python -m pip install .

Hoặc cài theo commit/nhánh:

python -m pip install "git+https://github.com/caphenpro/battu_tietkhi.git@main"

Cách gọi sử dụng trong Code

from battu_tietkhi import get_battu_month, get_battu_hour

# Tính tháng Bát Tự từ Kinh độ mặt trời (Ví dụ: 316 độ, năm Bính)
thang = get_battu_month(316.0, "Bính")
print(thang)  # Ví dụ: "Canh Dần"

# Tính giờ Bát Tự từ thời gian và Can Ngày (Ví dụ: 14h30, ngày Kỷ)
import datetime
gio = get_battu_hour(datetime.datetime(2026, 3, 5, 14, 30), "Kỷ")
print(gio)

Trường hợp nên dùng lệnh nào?

  • Dùng python -m venv .venv nếu:

    • Bạn đang làm dự án Python cá nhân hoặc muốn tránh xung đột package.
    • Đây là lựa chọn khuyên dùng nhất.
  • Dùng --break-system-packages nếu:

    • Bạn đang cài trên Ubuntu/Debian mới.
    • pip báo lỗi externally managed environment.
    • Bạn không muốn tạo môi trường ảo.
  • Dùng --no-cache-dir --force-reinstall nếu:

    • Bạn muốn ép cài lại từ đầu và bỏ cache cũ.
    • Bạn đã cài bản cũ nhưng muốn cập nhật hoặc sửa lỗi do package cũ.
  • Dùng python -m pip install . nếu:

    • Bạn đã clone repo về máy và muốn cài local package từ source code.
    • Bạn đang phát triển hoặc test code ở local.

Kiểm tra sau khi cài đặt

python -c "from battu_tietkhi import get_battu_month, get_battu_hour; print(get_battu_month(316.0, 'Bính')); print(get_battu_hour(__import__('datetime').datetime(2026, 3, 5, 14, 30), 'Kỷ'))"

Nếu lệnh trên chạy mà không báo lỗi import, nghĩa là bạn đã cài đặt đúng.

Metadata

Release files for battu-tietkhi 1.1.1

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

Source distribution (sdist)

Source distribution for battu-tietkhi 1.1.1
File Size Uploaded Provenance
battu_tietkhi-1.1.1.tar.gz 3.9 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for battu-tietkhi 1.1.1
File Interpreter ABI Platform
battu_tietkhi-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.0 kB

Release files / battu_tietkhi-1.1.1.tar.gz

Download URL battu_tietkhi-1.1.1.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
bb640752c3ca9c569797936df68eaeefcd283d250c1d09b55440211b4f307393
BLAKE2b-256 checksum
How to use checksums
178ea867bffcd9c8f65d7aa90aac50fac8fe2482d9ed2e10364c41c9d9e535c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Release files / battu_tietkhi-1.1.1-py3-none-any.whl

Download URL battu_tietkhi-1.1.1-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
91dd98f90f9ffc00dc26469757f89b185b4c59c08ef661cbd8f2ea9fa748e6eb
BLAKE2b-256 checksum
How to use checksums
c1556a6261a8b10ce20bff68f922692e0da26135d3af52f67a3468e9d1dfdb39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Security for battu-tietkhi 1.1.1

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for battu_tietkhi-1.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files Full provenance

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