Skip to main content

The most developer-friendly way to explore the Constitution of India

Project description

IndianConstitution (v1.1.0)

PyPI - Version PyPI Downloads Monthly Downloads Python Versions CI Codacy CodeQL OpenSSF Scorecard Typing Ruff License Donate via UPI

The definitive Python library for the Sovereign Democratic Republic.

indianconstitution is a professional-grade, high-performance framework designed for legal professionals, researchers, and developers. It provides structured, programmatic access to the Articles, Parts, and Schedules of the Constitution of India with an elite CLI and AI-ready architecture.


Features

  • Pythonic API: Intuitive, type-hinted, and chainable access to all articles.
  • High Performance: Inverted index for lightning-fast keyword search and lazy loading.
  • World-Class CLI: Beautiful terminal interface powered by Typer and Rich.
  • Advanced Search: Keyword, fuzzy, and (optional) semantic search capabilities.
  • Data Science Ready: Export to JSON, CSV, and Pandas DataFrames.
  • Smart Caching: Local disk caching for heavy operations.

Quickstart in 30 Seconds

Installation

pip install indianconstitution

Basic Usage

import indianconstitution as ic

# Get a specific article
article = ic.get_article(14)
print(f"{article.title}: {article.content}")

# Search across the entire constitution
results = ic.search("freedom of speech")
for a in results:
    print(f"Article {a.number}: {a.title}")

CLI Interface

The library comes with a powerful command-line interface.

# Get an article
indianconstitution get 21A

# Search for keywords
indianconstitution search "equality"

# View the Preamble
indianconstitution preamble

# Show statistics
indianconstitution stats

Advanced Features

Semantic Search (AI-Powered)

Find articles by meaning, not just keywords.

pip install "indianconstitution[ai]"
from indianconstitution import Constitution
ic = Constitution()
results = ic.semantic_search("rights of minority educational institutions")

Pandas Integration

import pandas as pd
df = pd.DataFrame([a.dict() for a in ic.data.articles])

Why this library exists?

The Constitution of India is one of the longest written constitutions in the world. Accessing it programmatically should be as elegant as the document itself. This library aims to bridge the gap between legal text and modern development workflows, enabling better research, education, and civic-tech applications.


Contributing

We welcome contributions! Please see CONTRIBUTING.md for details.

Acknowledgments

  • This library uses publicly available data from official sources of the Government of India.
  • Special thanks to the open-source community for the tools that made this library possible.

Contact

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Copyright

Copyright (c) 2026 Vikhram S. All rights reserved.


❤️ Support the Project

If this project helps you, consider supporting its continued development and maintenance.

Your support helps with:

  • maintaining and improving the package
  • adding new features and datasets
  • long-term open-source sustainability
  • keeping the project free and accessible

❤️ Support the Project

If this project provides value to you or your organization, consider supporting its continued development and maintenance.

Support helps fund:

  • ongoing package maintenance and improvements
  • new features, datasets, and documentation
  • infrastructure, testing, and release automation
  • long-term open-source sustainability

Support via UPI (Unified Payments Interface)

UPI ID: vikhrams15@okhdfcbank

Support via UPI

Contributions, feature requests, issue reports, documentation improvements, and GitHub stars are also appreciated.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

indianconstitution-1.1.0.tar.gz (234.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

indianconstitution-1.1.0-py3-none-any.whl (231.2 kB view details)

Uploaded Python 3

File details

Details for the file indianconstitution-1.1.0.tar.gz.

File metadata

  • Download URL: indianconstitution-1.1.0.tar.gz
  • Upload date:
  • Size: 234.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.5 cpython/3.14.4 HTTPX/0.28.1

File hashes

Hashes for indianconstitution-1.1.0.tar.gz
Algorithm Hash digest
SHA256 2c06a5042f990dfde324fc9d60c0f533b78fbabddeef07b20d95d5e818bd40bc
MD5 893d1be5b07b28c36ec792abeab04972
BLAKE2b-256 946d33c667e593895c0c9b1083ce981efb33797544653cad9bef74e3aa90a639

See more details on using hashes here.

File details

Details for the file indianconstitution-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: indianconstitution-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 231.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.5 cpython/3.14.4 HTTPX/0.28.1

File hashes

Hashes for indianconstitution-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ac08e679a3d8c2778341d97f37f5d8f827cd9d3b7e5a117a1dd28447cb0a704
MD5 02473496bf019e78d9c8a882cc589de8
BLAKE2b-256 79a0e87b92a4e54f174a6b8fbb46e795af39d542b5acbb651df4b2b165dfb700

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page