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

coderunnernew-0.2.0.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.

coderunnernew-0.2.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file coderunnernew-0.2.0.tar.gz.

File metadata

  • Download URL: coderunnernew-0.2.0.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 coderunnernew-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0963a98505fc3a54d2cabaee1844463addabf983cf0a9b1cfabfd4cd33cd7b12
MD5 0a18a514b5322a81f622b5754ee56ce4
BLAKE2b-256 c2f17c920ec4dab332b1524e64d6a5074f129515f553ab9c04df80c6e17dddf3

See more details on using hashes here.

File details

Details for the file coderunnernew-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: coderunnernew-0.2.0-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 coderunnernew-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 63125f1ae7687d142c0265ecb29d97b7ee8dafad3d9ad0425195de17fa741e9f
MD5 fe21cdb619a9a9c3d90ae8fdbbe4291f
BLAKE2b-256 86079a45376b685242aae6c2a8b5a0552cf169b431299ba7df9aeee413a7ab10

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