Metadata-Version: 2.4
Name: ebia
Version: 0.1.4
Summary: EquipeBaie Invoice Automation
Author: AAH
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: pdfplumber
Requires-Dist: openpyxl
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-cov>=5.0; extra == "dev"
Requires-Dist: pytest-mock>=3.12; extra == "dev"
Requires-Dist: ruff>=0.4; extra == "dev"
Requires-Dist: mypy>=1.10; extra == "dev"

# EquipeBaie_Freelance-project
Invoicing software that generates invoices and automatically syncs them to accounting tool.
# EquipeBaie Invoice Automation (equipebaie-tools)

This project aims to build a Python software tool that:

1. Detects new invoices (PDF) in a folder
2. Parses invoices and extracts required fields (EquipeBaie requirements)
3. Processes/validates the extracted data
4. Generates Excel reports (`.xlsx`) classified **by month** and **by week**

At the moment, the package contains the first module: **PDF parser**.

---

## Current Status

**Step 1 (implemented):** PDF parsing module  
**Next steps:** Excel generation + folder watcher (auto-detect new invoices) + pipeline orchestration

---

## Project Structure (wheel-ready)

equipebaie_tools/
├─ pyproject.toml
├─ README.md
├─ src/
│  └─ equipebaie_tools/
│     ├─ __init__.py
│     ├─ parser.py
│     └─ cli.py
└─ tests/
   └─ test_import.py



- `src/equipebaie_tools/` is the installable Python package
- `parser.py` exposes the main function: `extract_invoice_fields(pdf_path)`

---

## Requirements

- Python >= 3.9
- `pip` up to date

Recommended: use a virtual environment.

---

## Installation (Development / Editable)


```bash

## 1) Create a virtual environment
**Linux/macOS**

python -m venv .venv
source .venv/bin/activate


Windows (PowerShell)
python -m venv .venv
.\.venv\Scripts\Activate.ps1

## 2) Install the package in editable mode

pip install -U pip
pip install -e .

## Quickstart (Build, Install, Run)

1) Clone the repository

git clone https://github.com/Alamajdoub9/EquipeBaie_Freelance-project.git
cd EquipeBaie_Freelance-project

2) Create and activate a virtual environment
Linux/macOS

python3 -m venv .venv
source .venv/bin/activate
Windows (PowerShell)

python -m venv .venv
.\.venv\Scripts\Activate.ps1

3) Install build tools and project dependencies
python -m pip install --upgrade pip

python -m pip install build wheel setuptools

When you install the wheel (next steps), dependencies are installed automatically.

4) Build the wheel (.whl)
Run this command from the project root (where pyproject.toml exists):

python -m build -w
After a successful build, you should have a wheel in:
ls -lh dist/

5) Install the wheel
pip install --force-reinstall dist/*.whl

Solution immédiate (offline)

pip install --force-reinstall --no-deps dist/ebia-0.1.0-py3-none-any.whl

6) Run the CLI
Parse a PDF invoice and print extracted fields:

ebia --path facture.pdf

## Generate Excel (XLSX)

The CLI `ebia` can generate an Excel file from:
- a **single PDF invoice**, or
- a **folder** containing multiple PDF invoices (3 rows per invoice, appended one after another).


```bash
1) Single PDF → one Excel file
ebia --path "./invoices/facture.pdf" --out "./output/result.xlsx" --piece 0000 --document 00000

2) Folder of PDFs → one consolidated Excel file (auto-increment piece/document)

This mode reads all *.pdf files in the folder, parses each invoice, and appends 3 rows per invoice into the same Excel sheet.

ebia --path "./invoices" --out "./output/global.xlsx" --start-piece 1 --start-document 1
