Skip to main content

Lightweight package to store and retrieve code answers by program number.

Project description

codeprinter

Tiny utility package for keeping your lab solutions in one place and importing them easily from anywhere in the world.

🌍 Global Installation

Once published to PyPI, you (or anyone) can install it globally using:

pip install codeprinter

This will automatically install the latest version of the package from PyPI, so it can be used from any project or environment.


📦 Local Setup (for development)

If you’re developing the package locally, install it in editable mode:

cd /path/to/codeprinter
pip install -e .

This allows you to edit the code and immediately test changes without rebuilding.


🧠 Usage

After installation, simply import it anywhere in your Python code:

import codeprinter as cp

print(cp.ques(1))

This will retrieve the answer or code snippet linked to that question number.


🛠️ Add or Update Answers

You can add new entries by editing codeprinter/_answers.py:

ANSWERS = {
    1: "print('Hello world')",
    2: lambda: 42,
}

Each entry maps a question number to a solution, which can be:

  • a string
  • a dictionary
  • or even a callable (function/lambda)

Callables are automatically executed when retrieved.


🧾 License

MIT License © 2025 Shriyans Nayak


📬 Author

Shriyans Nayak Email: youremail@example.com GitHub: https://github.com/shriyansnayak

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

codeprinter2-0.2.2.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

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

codeprinter2-0.2.2-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file codeprinter2-0.2.2.tar.gz.

File metadata

  • Download URL: codeprinter2-0.2.2.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for codeprinter2-0.2.2.tar.gz
Algorithm Hash digest
SHA256 db69945b8f91f1eff2318dfc08ca5e7b932b8e20be78f0b78311b83404883c08
MD5 798990903398342f8eb4f0a3dfe72692
BLAKE2b-256 edfffc1edd8e5ce4c1f422bd4754ed7dece7d901b889947938092e6420cd303b

See more details on using hashes here.

File details

Details for the file codeprinter2-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: codeprinter2-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for codeprinter2-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 621822928133fc5f407f15823c4766cfb191ef01cce1ea654df2452bf61feff6
MD5 48534972fed1949df02981eef2e46f90
BLAKE2b-256 5c52ac1d24bb0a528b8ef8a8e5fe4e1716bf2e86d761564f89677828e2fc5f02

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