Skip to content

Commit 586b921

Browse files
authored
Feature/first tools (#2)
* feat: add initial clevertools project structure * feat: introduce configurable core utilities and reorganize docs Expand clevertools into a more structured utility package with a configurable public API for masking, plain text file IO, and logger setup. Add global runtime configuration support, including shared error handling modes and logger default overrides, to make package behavior easier to customize across projects. Introduce dedicated modules for configuration, logger bootstrapping, logger retrieval, plain text read/write helpers, static defaults, and centralized error handling policy. Refine the masking implementation with stronger input validation, customizable visible prefix and suffix lengths, and support for custom mask characters. Rework the package exports so the main API exposes configure, configure_logger, get_logger, read, write, and mask from clear top-level entry points. Restructure the documentation into dedicated getting-started and reference sections, add concept pages for logging and error handling, and update the root README to reflect the expanded toolset. Refresh the test suite layout and add coverage for logger configuration, default file IO helpers, and mask behavior. Also clean up repository metadata and supporting files, including .gitignore, requirements, and legacy modules replaced by the new structure. * feat: remove unused dependencies in the requirements.txt file --------- Signed-off-by: b7binw13 <[email protected]>
1 parent 52f3017 commit 586b921

34 files changed

Lines changed: 992 additions & 116 deletions

.gitignore

Lines changed: 63 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
# Created by https://www.toptal.com/developers/gitignore/api/python,visualstudiocode,pythonvanilla
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=python,visualstudiocode,pythonvanilla
3+
4+
### Python ###
15
# Byte-compiled / optimized / DLL files
26
__pycache__/
3-
*.py[codz]
7+
*.py[cod]
48
*$py.class
59

610
# C extensions
@@ -46,7 +50,7 @@ htmlcov/
4650
nosetests.xml
4751
coverage.xml
4852
*.cover
49-
*.py.cover
53+
*.py,cover
5054
.hypothesis/
5155
.pytest_cache/
5256
cover/
@@ -94,35 +98,20 @@ ipython_config.py
9498
# install all needed dependencies.
9599
#Pipfile.lock
96100

97-
# UV
98-
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99-
# This is especially recommended for binary packages to ensure reproducibility, and is more
100-
# commonly ignored for libraries.
101-
#uv.lock
102-
103101
# poetry
104102
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105103
# This is especially recommended for binary packages to ensure reproducibility, and is more
106104
# commonly ignored for libraries.
107105
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108106
#poetry.lock
109-
#poetry.toml
110107

111108
# pdm
112109
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113-
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114-
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115110
#pdm.lock
116-
#pdm.toml
117-
.pdm-python
118-
.pdm-build/
119-
120-
# pixi
121-
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122-
#pixi.lock
123-
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124-
# in the .venv directory. It is recommended not to include this directory in version control.
125-
.pixi
111+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
112+
# in version control.
113+
# https://pdm.fming.dev/#use-with-ide
114+
.pdm.toml
126115

127116
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128117
__pypackages__/
@@ -136,7 +125,6 @@ celerybeat.pid
136125

137126
# Environments
138127
.env
139-
.envrc
140128
.venv
141129
env/
142130
venv/
@@ -175,33 +163,61 @@ cython_debug/
175163
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
176164
#.idea/
177165

178-
# Abstra
179-
# Abstra is an AI-powered process automation framework.
180-
# Ignore directories containing user credentials, local state, and settings.
181-
# Learn more at https://abstra.io/docs
182-
.abstra/
166+
### Python Patch ###
167+
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
168+
poetry.toml
183169

184-
# Visual Studio Code
185-
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186-
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187-
# and can be added to the global gitignore or merged into this file. However, if you prefer,
188-
# you could uncomment the following to ignore the entire vscode folder
189-
# .vscode/
190-
191-
# Ruff stuff:
170+
# ruff
192171
.ruff_cache/
193172

194-
# PyPI configuration file
195-
.pypirc
173+
# LSP config files
174+
pyrightconfig.json
175+
176+
### PythonVanilla ###
177+
# Byte-compiled / optimized / DLL files
178+
179+
# C extensions
180+
181+
# Distribution / packaging
182+
183+
# Installer logs
184+
185+
# Unit test / coverage reports
186+
187+
# Translations
188+
189+
# pyenv
190+
# For a library or package, you might want to ignore these files since the code is
191+
# intended to run in multiple environments; otherwise, check them in:
192+
# .python-version
193+
194+
# pipenv
195+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
196+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
197+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
198+
# install all needed dependencies.
199+
200+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
201+
202+
203+
### VisualStudioCode ###
204+
.vscode/*
205+
.vscode/
206+
!.vscode/settings.json
207+
!.vscode/tasks.json
208+
!.vscode/launch.json
209+
!.vscode/extensions.json
210+
!.vscode/*.code-snippets
211+
212+
# Local History for Visual Studio Code
213+
.history/
214+
215+
# Built Visual Studio Code Extensions
216+
*.vsix
196217

197-
# Cursor
198-
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199-
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200-
# refer to https://docs.cursor.com/context/ignore-files
201-
.cursorignore
202-
.cursorindexingignore
218+
### VisualStudioCode Patch ###
219+
# Ignore all local history of files
220+
.history
221+
.ionide
203222

204-
# Marimo
205-
marimo/_static/
206-
marimo/_lsp/
207-
__marimo__/
223+
# End of https://www.toptal.com/developers/gitignore/api/python,visualstudiocode,pythonvanilla

README.md

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,36 @@
11
# clevertools
22

3-
`clevertools` is a Python utility library for everyday filesystem and runtime tasks.
4-
5-
It provides:
6-
- file and directory creation
7-
- IO helpers
8-
- cleanup helpers
9-
- structured logging with console and file handlers
10-
- runtime helpers and file bootstrapping
11-
- a typed exception/validation model
12-
13-
## Start Working with it
14-
15-
1. Clone the repository (ssh recommended):
16-
```bash
17-
git clone [email protected]:The-Binary-Labs-TBL/clevertools.git
18-
cd clevertools
19-
```
3+
`clevertools` is a utility library providing practical tools for common
4+
workflows.
5+
6+
## Public Tools
7+
8+
- plain-text file helpers
9+
- masking for sensitive values
10+
- global runtime configuration
11+
- simple console and file logger setup
12+
13+
## Example
2014

21-
2. Install all dependecies:
15+
```python
16+
from clevertools import mask, read
2217

23-
Linux:
24-
```bash
25-
python -m venv .venv
26-
source .venv/bin/activate
27-
pip install --upgrade pip
28-
pip install -r requirements.txt
18+
secret = mask("sk-example-secret-token", 3, 4)
19+
content = read("example.txt")
2920
```
3021

31-
Project metadata is defined in `pyproject.toml`.
22+
## Project Goal
23+
24+
`clevertools` is intentionally compact. It focuses on practical helpers for
25+
everyday workflows without introducing a large framework or unnecessary
26+
abstraction.
27+
28+
## Documentation
29+
30+
- Start here: [docs/README.md](./docs/README.md)
31+
- Getting started: [docs/getting-started/README.md](./docs/getting-started/README.md)
32+
- Reference: [docs/reference/README.md](./docs/reference/README.md)
3233

33-
## Python version
34+
## Requirements
3435

35-
- Required: `>=3.10`
36+
- Python `>=3.10`

docs/README.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
# Documentation
22

3-
This project documentation has two levels:
4-
- guided chapters for understanding and onboarding
5-
- deep API docs with one page per implementation module file
3+
This folder contains the documentation for `clevertools`, a utility library
4+
providing practical tools for common workflows.
5+
6+
## Direction
7+
8+
The documentation is split into two main parts:
9+
10+
- [Getting Started](./getting-started/README.md) for installation, setup, and
11+
the first steps with the library
12+
- [Reference](./reference/README.md) for detailed documentation of tools,
13+
concepts, and important behavior
14+
15+
## Documentation Structure
16+
17+
This layout keeps the project easy to navigate:
18+
19+
- `README.md` in the project root introduces the package
20+
- `docs/README.md` explains how the documentation is organized
21+
- `docs/getting-started/` contains onboarding and first-use pages
22+
- `docs/reference/` contains structured reference documentation
23+
- `docs/reference/tools/` documents one public tool per file
24+
- `docs/reference/concepts/` explains shared behavior such as error handling
25+
and logging
26+
27+
## Start Here
28+
29+
- [Getting Started](./getting-started/README.md)
30+
- [Reference](./reference/README.md)

docs/getting-started/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Getting Started
2+
3+
This section helps you install `clevertools`, verify the package import, and
4+
build a first small example.
5+
6+
## Pages
7+
8+
- [Installation](./installation.md)
9+
- [First Steps](./first-steps.md)
10+
11+
## Recommended Order
12+
13+
1. Start with [Installation](./installation.md)
14+
2. Continue with [First Steps](./first-steps.md)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# First Steps
2+
3+
This page shows a small first workflow with `clevertools`.
4+
5+
## First Import
6+
7+
```python
8+
from clevertools import configure, configure_logger, mask, read, write
9+
```
10+
11+
## Example
12+
13+
```python
14+
from clevertools import configure, configure_logger, mask, read, write
15+
16+
configure(error_mode="log")
17+
18+
logger = configure_logger(name="example", level="INFO")
19+
20+
write("demo.txt", f"api_key={mask('sk-demo-123456789', 4, 3)}")
21+
content = read("demo.txt")
22+
23+
logger.info("Loaded content: %s", content)
24+
```
25+
26+
## Continue
27+
28+
- [Reference overview](../reference/README.md)
29+
- [Tool reference](../reference/tools/README.md)
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Installation
2+
3+
This page shows how to install `clevertools` locally on Linux, macOS, and
4+
Windows.
5+
6+
## Requirements
7+
8+
- Python `>=3.10`
9+
- dependencies from `requirements.txt`
10+
11+
## Linux
12+
13+
```bash
14+
python -m venv .venv
15+
source .venv/bin/activate
16+
pip install --upgrade pip
17+
pip install -r requirements.txt
18+
pip install -e .
19+
```
20+
21+
## macOS
22+
23+
```bash
24+
python3 -m venv .venv
25+
source .venv/bin/activate
26+
python3 -m pip install --upgrade pip
27+
python3 -m pip install -r requirements.txt
28+
python3 -m pip install -e .
29+
```
30+
31+
## Windows PowerShell
32+
33+
```powershell
34+
py -m venv .venv
35+
.venv\Scripts\Activate.ps1
36+
py -m pip install --upgrade pip
37+
py -m pip install -r requirements.txt
38+
py -m pip install -e .
39+
```
40+
41+
## Windows Command Prompt
42+
43+
```bat
44+
py -m venv .venv
45+
.venv\Scripts\activate.bat
46+
py -m pip install --upgrade pip
47+
py -m pip install -r requirements.txt
48+
py -m pip install -e .
49+
```

docs/reference/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Reference
2+
3+
This section contains the structured reference documentation for `clevertools`.
4+
5+
## Sections
6+
7+
- [Tools](./tools/README.md)
8+
- [Concepts](./concepts/README.md)
9+
10+
## Use This Section For
11+
12+
- detailed descriptions of public helpers
13+
- shared behavior and design decisions
14+
- examples for specific tools and workflows

docs/reference/concepts/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Concepts
2+
3+
This section explains shared behavior used across multiple tools.
4+
5+
## Pages
6+
7+
- [Error Handling](./error-handling.md)
8+
- [Logging](./logging.md)

0 commit comments

Comments
 (0)