Rupantaran is a Python package that converts various Nepali-specific measurements into SI units or commonly used metric units. You can read the docs here.
A simple streamlit app called Bigha Busters is built using this package. The source code for the project is here. Please feel free to create your own app using this package. You can share them by creating an issue here.
This package covers a range of traditional Nepalese measurement units, including:
- Land:
khetmuri, bigha, kattha, dhur, ropani, aana, paisa, dam , square meter - Volume: mutthi, mana, pathi, dabba
- Length: angul, dharnugrah, dhanurmushti, vitastaa, haath, kosh, yojan
- Weight: lal, tola, chatak, pau, dharni, sher, kg, g, lb, oz
The package ensures accurate conversions by cross-referencing multiple resources. Please create an issue if you find any discrepancies in conversion maps. This sheet contains the conversion maps for the weight unit. Also, please let create an issue if you find any updated conversion maps.
- Wikipedia - Nepalese Units of Measurement
- Mero Kalam - Land Measurement
- Ministry of Land Reform Conversion Tool
- Rotaract - Unit Conversion PDF
- 1990 JICA Conversion Table
This document provides a step-by-step guide to setting up the development and production environments for the rupantaran package.
This environment is used for publishing the package to TestPyPI, PyPI's testing server. This is facilated with GitHub Actions workflow. The TestPyPI link for rupantaran is here.
Expand for more details for the development environment
Note: The GitHub Actions workflow is configured to run automatically when a new tag is pushed to the repository. This ensures that the package is always built and uploaded to TestPyPI when a new version is released.
# Always create a tag after the version_id is updated in the setup.py file.
# Create a new tag
git tag v0.2.2
# Push the tag to the repository
git push origin v0.2.2
-
Activate the development environment:
conda activate env-rupantaran-dev
-
Install required dependencies for building and uploading the package:
pip install build twine
-
Build the package and install it in editable mode:
python -m build pip install -e .
- This generates the
dist/
directory containing.tar.gz
and.whl
files.
- This generates the
-
Upload the package to TestPyPI:
twine upload --repository testpypi dist/*
- You will need an API Key for authentication.
-
Install the package from TestPyPI to verify deployment:
pip install --index-url https://test.pypi.org/simple/ rupantaran
-
Run tests on the installed package:
pytest --pyargs rupantaran
This environment is used for publishing the final package to PyPI.This is facilated with GitHub Actions workflow. The PyPI link for rupantaran is here.
Expand for more details for the production environment
Note: The Github Action workflow is configured to push the package to PyPI when a PR is merged into the main branch.
-
Activate the production environment:
conda activate env-rupantaran-prod
-
Upload the final version to PyPI:
twine upload dist/*
- This makes the package available on the official PyPI repository.
The documentation is built with Sphinx and Read the Docs. The documentation is stored in the docs/
directory. This is facilitated with GitHub Actions workflow. This workflow checks if there are any changes in the docs/
directory and if so, it builds the documentation .
- Navigate to directory
cd rupantaran/docs
- Generate the docs
make html
- Serve the docs in localhost
sphinx-autobuild . _build
Some useful commands for testing the package:
# Check the coverage of the all files
pytest --cov=rupantaran --cov-report=term-missing
# Run the tests for a specific keyword
pytest -k "hill"
# Generate the coverage report in html format
pytest --cov=rupantaran --cov-report=html
- Always test the package in the staging environment before publishing to production.
- If needed, remove the
dist/
directory before rebuilding the package:rm -rf dist/
- If you face authentication issues, regenerate the API token from TestPyPI or PyPI and update your
~/.pypirc
file. This is not relevant here, because we are using GitHub Actions to upload the package to TestPyPI and PyPI.
This project is licensed under the MIT License - see the LICENSE file for details.