A package to generate a receipt from an order in JSON format
Project description
Check Generator This Python package generates a text-based receipt from an order stored in a JSON file.
Features Accepts order details in a JSON file. Generates a receipt that includes: Customer's name. List of purchased items (name, quantity, price per unit). Total amount of the order. Supports command-line options for specifying input and output files. Installation Clone the repository or download the source code.
Install the package by running the following command in the project's root directory:
bash Копировать код pip install . Usage Once the package is installed, you can generate a receipt by using the command-line tool.
Command-line Interface (CLI) bash Копировать код check-generator --input-file <path_to_input_json> --output-file <path_to_output_txt> Example Given the following JSON file (order.json):
json Копировать код { "customer_name": "Иван Иванов", "items": [ {"name": "Телефон", "quantity": 1, "price": 20000}, {"name": "Наушники", "quantity": 2, "price": 1500} ] } Run the following command:
bash Копировать код check-generator --input-file data/order.json --output-file receipt.txt The generated receipt.txt will look like this:
yaml Копировать код Customer: Иван Иванов
Items:
- Телефон x 1 @ 20000 = 20000
- Наушники x 2 @ 1500 = 3000
Total: 23000 Development Setting up the environment Create a virtual environment:
bash Копировать код python -m venv venv Activate the virtual environment:
On macOS/Linux: bash Копировать код source venv/bin/activate On Windows: bash Копировать код .\venv\Scripts\activate Install the dependencies:
bash Копировать код pip install -r requirements.txt Running Tests To run the tests for the package:
Install pytest if you haven't already:
bash Копировать код pip install pytest Run the tests:
bash Копировать код pytest License This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file check_generator-0.1.0.tar.gz.
File metadata
- Download URL: check_generator-0.1.0.tar.gz
- Upload date:
- Size: 2.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6613651b648e6c2e3924c9f2d7998970302c900b4326f6aad98ba48feed4dc92
|
|
| MD5 |
bfe922aa10d726fff95521838b07d7e7
|
|
| BLAKE2b-256 |
cc9d9fcea0fe5699097c99ad782b76e466c3cee3482fe1e938c570cfbfc47e6d
|
File details
Details for the file check_generator-0.1.0-py3-none-any.whl.
File metadata
- Download URL: check_generator-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc291e4e3055fe1b787f44f4547d2d6e192f5a02d77ccfeda2853407de86e45f
|
|
| MD5 |
788541cdf4835cfe073b914ac34e0341
|
|
| BLAKE2b-256 |
a696a94ce74e15c9c27ee4fb4fc20e40aa6a733fba500c8f992168bd41b465e4
|