A simple python utility tool for your everyday projects.
Project description
Villog is a simple python utility tool for your everyday projects.
Can be installed with pip.
[!WARNING] On MacOS you need to install ODBC drivers differently:
# Install UnixODBC with Brew
brew install unixodbc
# Install PyODBC
pip install --no-binary :all: pyodbc
Modules
- Logger
- Excel generator
- Excel reader
- MSSQL handler
- PDF generator
- Mail sender
Logger
from villog.log import Logger
l: Logger = Logger(file_path = "example.log")
l.log(content = "example_content")
Write Excel
from villog.writexcel import WorkSheet, WorkBook
sheet_1: WorkSheet = WorkSheet(name = "Sheet1",
header = ["header_1", "header_2", "header_3"],
data = [["data_1", "data_2", "data_3"],
["data_4", "data_5", "data_6"]])
sheet_2: WorkSheet = WorkSheet(name = "Sheet2",
header = ["header_1", "header_2", "header_3"],
data = [["data_1", "data_2", "data_3"],
["data_4", "data_5", "data_6"]])
book: WorkBook = WorkBook(name = "Book1",
sheets = [sheet_1, sheet_2])
book.xlsx_create(file_path = "example.xlsx")
Read Excel
[!IMPORTANT] ReadExcel is under refactor.
from villog.readexcel import ReadExcel
excel: ReadExcel = ReadExcel(path = "example.xlsx")
excel.read()
for sheet_name in read_excel.get_sheet_names():
for row in excel.get_sheet_content_to_list(sheet_name):
for elem in row:
print(elem, end = "\t")
VillSQL
from villog.mssql import SQLConfig, VillSQL, Table
sql_config: SQLConfig = SQLConfig(server = "server_name",
database = "database_name",
username = "user_name",
password = "password")
sql_client: VillSQL = VillSQL(sql_config = sql_config)
egt: Table = sql_client.get_table("EXAMPLE_TABLE",
raw_filter="col_1 = "example",
order_by = ["col_1","ASC",
"col_3","DESC"],
# kwargs:
COL_4 = 1)
egt.set_filter(column_names = ["col_1, "col_2"])
print("COLUMNS:")
for column in egt.columns():
print(column, end = "\t")
print("\nROWS:)
for row in egt.rows:
for elem in row:
print(elem, end = "\t")
"""
Output:
COLUMNS:
col_1 col_2
ROWS:
val_1_1 val_1_2
val_2_1 val_2_2
val_3_1 val_3_2
"""
villsql_client.close()
PDF generator
[!IMPORTANT] To use PDF generator on Windows, you need some configuration.
from villog.pdf import generate as generate_pdf
generate_pdf(html_string = "html_string",
output_path = "example.pdf",
css_string = "css_string")
Mail man
from villog.mail_man import MailMan
mail: MailMan = MailMan(
smtp_server="smtp.example.com",
smtp_login="example@example.com",
smtp_port=465,
smtp_password="example_password",
name="Example Name"
)
mail.send(
subject = "Example subject",
body = "Example body",
send_to = ["example_1@example.com", "example_2@example.com"],
files = ["example.xlsx"],
images = None
)
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
villog-0.4.0.tar.gz
(27.5 kB
view details)
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
villog-0.4.0-py3-none-any.whl
(27.8 kB
view details)
File details
Details for the file villog-0.4.0.tar.gz.
File metadata
- Download URL: villog-0.4.0.tar.gz
- Upload date:
- Size: 27.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12d5a7f8d78dc3d09f7f0fb5cbb8bfaf61b27de7c5bfedfad03854f797881466
|
|
| MD5 |
9fd24defdee2ed508d2d3f05c65858ab
|
|
| BLAKE2b-256 |
fb9fd8d84d0c773fac75c3b9234604df4dce2bd4f3607f915c6760796aa5c572
|
File details
Details for the file villog-0.4.0-py3-none-any.whl.
File metadata
- Download URL: villog-0.4.0-py3-none-any.whl
- Upload date:
- Size: 27.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5064c9dc63d942491a3c76d4bc1f81f89c86e474e7f7735302201ac088afb45e
|
|
| MD5 |
68995ab6a8d0c8b54c938e803b7c4413
|
|
| BLAKE2b-256 |
47903d2428e8c8a35664c5af82c84818d94cec1147f64e85cec498d5e0c33c57
|