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 codeprinter2

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

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.3.0.tar.gz (35.7 MB view details)

Uploaded Source

Built Distribution

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

codeprinter2-0.3.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: codeprinter2-0.3.0.tar.gz
  • Upload date:
  • Size: 35.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for codeprinter2-0.3.0.tar.gz
Algorithm Hash digest
SHA256 3145705f64073a4d73aaba7a660e79580ac04211aaa0b749b18bb516a04c4e3b
MD5 749372a1ccb0c9f00ec8a9df1eca6e33
BLAKE2b-256 5ca9611dd98281cd6f034527ad3d069ee93dfa3eb7d0bceae19d878028d0ff92

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codeprinter2-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for codeprinter2-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7340b915ae4629641288dce89f7eee43fd89991e02903f0ea0455afa030ac450
MD5 25d5d608854b11daf350ca6d75ed7e2b
BLAKE2b-256 8afdc7a5997fcb1dbe9adce745e3dddba0659c629355b6fa7a086491e06afb82

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