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.4.tar.gz (6.8 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.4-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: codeprinter2-0.2.4.tar.gz
  • Upload date:
  • Size: 6.8 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.4.tar.gz
Algorithm Hash digest
SHA256 83fbd9f275e30a66a4ffb496d19d5280837dc45f137cf4ae57101d7c3734da26
MD5 6bfa91567845818b1aebfd9bf769e51b
BLAKE2b-256 23d3a84051c56224d985aae7a28443285c070029476058a05ca05c3aecd3049a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codeprinter2-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 7.6 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c7074e922e698c13529522bc6ab8468b5843974525d5172b638018fb83ce3cc2
MD5 93099f52ba1b0ca13dce2dfc5e2587c4
BLAKE2b-256 31aa50ed71d881821d9cfa67ae78b8476d0f8e22859c9cb63cbad0cea58294e6

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