Python:
Support Python Versions
CI/CD Pipeline:
SonarCloud:
DevSetGo Common Library
devsetgo_lib
is a versatile library designed to provide common functions for Python applications. Its main goal is to increase reusability and reduce the need to rewrite the same functions across multiple applications. This also allows for quick defect resolution and propagation of fixes across all dependent projects.
Key Features
Common Functions:
-
File Operations:
- CSV, JSON, and Text File Functions: Create, read, write, and manipulate various file types with ease.
- Folder Functions: Create and remove directories, list directory contents, and manage file system operations efficiently.
-
Logging:
Comprehensive logging setup using the Loguru Library. Provides extensive customization options for log configuration, including log rotation, retention, and formatting. Includes improvements for multiprocessing environments to ensure log messages are handled correctly across multiple processes.
-
Calendar Functions:
Convert between month names and numbers seamlessly.
-
Pattern Matching:
Powerful tools for searching patterns in text using regular expressions.
FastAPI Endpoints:
- Pre-built endpoints for system health checks, status, and uptime monitoring.
- Functions to generate HTTP response codes easily.
Async Database:
- Configuration and management of asynchronous database sessions.
- CRUD operations with async support.
Installation
To install devsetgo_lib
, use pip:
pip install devsetgo-lib
pip install devsetgo-lib[sqlite]
pip install devsetgo-lib[postgres]
pip install devsetgo-lib[oracle]
pip install devsetgo-lib[mssql]
pip install devsetgo-lib[mysql]
pip install devsetgo-lib[fastapi]
pip install devsetgo-lib[all]
Usage
Here's a quick example to demonstrate how you can use some of the key features of devsetgo_lib
:
from devsetgo_lib.common_functions import file_functions, logging_config, patterns, calendar_functions
file_functions.create_sample_files("example", 100)
content = file_functions.read_from_file("example.csv")
print(content)
logging_config.config_log(logging_directory='logs', log_name='app.log', logging_level='DEBUG')
logger = logging.getLogger('app_logger')
logger.info("This is an info message")
text = "Hello, my name is 'John Doe' and I live in 'New York'."
results = patterns.pattern_between_two_char(text, "'", "'")
print(results)
print(calendar_functions.get_month(1))
print(calendar_functions.get_month_number('January'))
For detailed documentation on each module and function, please refer to the official documentation.
Contributing
We welcome contributions! Please see our contributing guidelines for more details.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Contact
For any questions or issues, please open an issue on GitHub or contact us at devsetgo@example.com.