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.3.tar.gz (9.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.3-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: codeprinter2-0.2.3.tar.gz
  • Upload date:
  • Size: 9.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.3.tar.gz
Algorithm Hash digest
SHA256 093a136f84dcc53d67608ba173d667c316f94a4fed72a7a34995213fff61d349
MD5 77bc7e1b008826cbc3458d00ed65b9da
BLAKE2b-256 e7e9bbab47abb776a3f8103d58303b47262762f4bc0214b6d0676894965984dd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codeprinter2-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 10.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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 523dad4dd7e1fd9c936c0da24e76cc4cc67079bf3168bccbbe417f11adf7fa73
MD5 11f751b64fef892e777c2e6bd684edf8
BLAKE2b-256 36e9ba74dfe58255b5fce849665ef732585da9c67cb7f1389fd1b422f0a326cc

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