|
| 1 | +# Intro_project 🎉 |
| 2 | + |
| 3 | +A mini project written in Python 3.12, showcasing the use of modern tools and best practices in software development. |
| 4 | +This project utilizes: |
| 5 | + |
| 6 | +- **Poetry** 🛠️ – for virtual environment and dependency management, |
| 7 | +- **mypy** ✅ – for static type checking, |
| 8 | +- **pytest** 🧪 – for unit testing. |
| 9 | + |
| 10 | +--- |
| 11 | + |
| 12 | +## Project Overview 📚 |
| 13 | + |
| 14 | +The project implements a simple `BankAccount` class with the following functionalities: |
| 15 | + |
| 16 | +- Creating a bank account with an initial balance, |
| 17 | +- Depositing and withdrawing funds, |
| 18 | +- Handling errors, such as trying to withdraw more money than available. |
| 19 | + |
| 20 | +The project also includes unit tests to ensure code correctness. |
| 21 | + |
| 22 | +--- |
| 23 | + |
| 24 | +## Requirements 🖥️ |
| 25 | + |
| 26 | +- **Python** 3.12+ |
| 27 | +- **Poetry** 1.6.1 or newer |
| 28 | +- **mypy** 1.5.0 or newer |
| 29 | +- **pytest** 7.0.0 or newer |
| 30 | + |
| 31 | +--- |
| 32 | + |
| 33 | +## Installation 🚀 |
| 34 | + |
| 35 | +### 1. Clone the repository: |
| 36 | + ```bash |
| 37 | + git [email protected]:Kinetics20/intro_project.git |
| 38 | + cd intro_projekt |
| 39 | +``` |
| 40 | + |
| 41 | +### 2. Install dependencies using Poetry: |
| 42 | +```bash |
| 43 | +poetry install |
| 44 | +``` |
| 45 | + |
| 46 | +### 3. Activate the virtual environment: |
| 47 | + |
| 48 | +```bash |
| 49 | +# Linux/macOS |
| 50 | +poetry shell |
| 51 | +``` |
| 52 | +```bash |
| 53 | +# Windows (Command Prompt or PowerShell) |
| 54 | +poetry shell |
| 55 | +``` |
| 56 | +### 4. Install `mypy` for static type checking: |
| 57 | +```bash |
| 58 | +# Linux/macOS |
| 59 | +pip install mypy |
| 60 | + |
| 61 | +# Windows (Command Prompt or PowerShell) |
| 62 | +pip install mypy |
| 63 | + |
| 64 | +### Running Tests 🧪 |
| 65 | +```bash |
| 66 | +# Run all unit tests using pytest |
| 67 | +pytest |
| 68 | +``` |
| 69 | +### 5. Install `pytest` for running tests: |
| 70 | +```bash |
| 71 | +# Linux/macOS |
| 72 | +pip install pytest |
| 73 | +
|
| 74 | +# Windows (Command Prompt or PowerShell) |
| 75 | +pip install pytest |
| 76 | +``` |
| 77 | + |
| 78 | +--- |
| 79 | + |
| 80 | + |
| 81 | +### Type Checking ✅ |
| 82 | +```bash |
| 83 | +mypy bank_account.py |
| 84 | +``` |
| 85 | + |
| 86 | +--- |
| 87 | + |
| 88 | +## Features 🔧 |
| 89 | + |
| 90 | +### `BankAccount` Class |
| 91 | + |
| 92 | +- `__init__(owner: str, account_number: str, balance: Decimal = Decimal("0.0")) -> None` |
| 93 | + Creates a bank account. |
| 94 | + |
| 95 | +- `deposit(amount: Decimal) -> None` |
| 96 | + Deposits funds into the account (only positive amounts are allowed). |
| 97 | + |
| 98 | +- `withdraw(amount: Decimal) -> None` |
| 99 | + Withdraws funds from the account (the amount cannot exceed the current balance). |
| 100 | + |
| 101 | +- `get_balance() -> str` |
| 102 | + Returns the balance formatted as "xx.xx PLN". |
| 103 | +
|
| 104 | +
|
| 105 | +--- |
| 106 | +
|
| 107 | +
|
| 108 | +## Contribution 🤝 |
| 109 | +
|
| 110 | +Feel free to submit pull requests with improvements and suggestions. |
| 111 | +This project was created for educational purposes and to improve Python skills! 🌟 |
0 commit comments