viracitapada
Performs metrical analysis on ISO-15919-transliterated Sanskrit verses.
Features
- usable as a library in arbitrary projects (no CLI included, yet)
- parses lines of text into a metrical notation of long/short markers via
parse_meter(see examples below) - annotates the tokens of lines of text with their metrical position via
annotate_metrical_pos(see examples below)
Installation
An example using pip:
pip install -U viracitapada
Usage
parse_meter as well as annotate_metrical_pos will return the same type of data you threw at them. This can be either a single line of text as a str ("line one"), multiple lines of text as a str ("line one\nline two\nline three") or a list[str] containing a line of text per string (["line one", "line two", "line three"]).
Some examples:
import viracitapada as vp
vp.parse_meter("agním īḷe puróhitaṁ")
# —◡ —— ◡—◡—
vp.parse_meter("úṣo yé te ̀ prá yā́meṣu yuñjáte")
# ◡— — — · ◡ ——◡ —◡— (" `" as pause)
vp.parse_meter(
"kadā́ vaso ̀ stotráṁ háryate ā́",
long_mark="L",
short_mark="S",
pause_mark="P",
)
# "SL SL P LL LSL L"
vp.parse_meter("agním īḷe puróhitaṁ\nyajñásya devám r̥tvíjam\nhótāraṁ ratnadhā́tamam")
# —◡ —— ◡—◡—\n——◡ —◡ —◡—\n——— —◡—◡—
vp.parse_meter([
"agním īḷe puróhitaṁ",
"yajñásya devám r̥tvíjam",
"hótāraṁ ratnadhā́tamam",
])
# ["—◡ —— ◡—◡—", "——◡ —◡ —◡—", "——— —◡—◡—"]
vp.annotate_metrical_pos("agním īḷe puróhitaṁ")
# 1_agním 3_īḷe 5_puróhitaṁ
vp.annotate_metrical_pos(
"agním īḷe puróhitaṁ\nyajñásya devám r̥tvíjam\nhótāraṁ ratnadhā́tamam"
)
# 1_agním 3_īḷe 5_puróhitaṁ\n1_yajñásya 4_devám 6_r̥tvíjam\n1_hótāraṁ 4_ratnadhā́tamam
vp.annotate_metrical_pos([
"agním īḷe puróhitaṁ",
"yajñásya devám r̥tvíjam",
"hótāraṁ ratnadhā́tamam",
])
# ["1_agním 3_īḷe 5_puróhitaṁ", "1_yajñásya 4_devám 6_r̥tvíjam", "1_hótāraṁ 4_ratnadhā́tamam"]
Development
This project uses uv to manage dependencies. Install uv to make use of the following commands.
Install library and dependencies in a local virtual environment:
uv sync
Check code formatting, run linter:
uv run ruff format . --check
uv run ruff check .
Format code and fix linter errors:
uv run ruff format .
uv run ruff check . --fix
Run mypy to check typing:
uv run mypy
Run tests and measure test coverage:
uv run coverage run -m pytest
Run specific tests file:
uv run coverage run -m pytest tests/test_clean.py
Print coverage report of last measured test run:
uv run coverage report -m
Run everything from above to make sure things are working and in good shape (on Unix-like systems):
./pre-commit.sh
Metadata
Release files for viracitapada 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| viracitapada-0.2.0.tar.gz | 22.1 kB | Without provenance | Details for viracitapada-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| viracitapada-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for viracitapada-0.2.0-py3-none-any.whl |
Total release size: 29.0 kB
Release files / viracitapada-0.2.0.tar.gz
| Download URL | viracitapada-0.2.0.tar.gz |
|---|---|
| Size | 22.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d784f774385ea4f5e77575a7e55e5e13dd7dea5e7ddceb6b46ef0137759eeaeb
|
|
BLAKE2b-256 checksum How to use checksums |
5f6d9101b4c2dde71abbac333535bea1d09e014cf1c4cb272c408768415b0c40
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Pop!_OS","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / viracitapada-0.2.0-py3-none-any.whl
| Download URL | viracitapada-0.2.0-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7c2951ea0529f59ce6facef18f92e1a0b1b7377a05361824feb63cf94789352d
|
|
BLAKE2b-256 checksum How to use checksums |
0850dcf8beb8aee102ba3800eb1409f640f34d08d199ff52b7a304d647f89c95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Pop!_OS","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for viracitapada 0.2.0
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.