GithubHelp home page GithubHelp logo

dq_my_python_project's Introduction

Python Template Repository

This repository serves as a template for starting Python projects with integrated logging, notification features, and more. It utilizes the loguru library for comprehensive logging and demonstrates the implementation of a notification feature using the notifiers library. Additionally, it showcases the use of decorators and wrappers for function logging, including entry, exit, and execution time tracking.

Features

  • Logging Levels: The template code demonstrates the use of different logging levels to control the verbosity of the output. The following levels are showcased:

    • DEBUG
    • INFO
    • ERROR
  • Logging Decorator: A logger_wraps decorator is provided, offering the capability to wrap functions for logging their entry, exit, and execution time. The decorator supports the following parameters:

    • entry: If True, logs the function entry.
    • exit: If True, logs the function exit and result.
    • level: The logging level to use.
  • Slack Notification (Optional): The template includes commented-out code to send Slack notifications in case of errors. To enable this feature, follow these steps:

    1. Uncomment the lines related to Slack notification in the script.
    2. Ensure you've filled in the required Slack webhook URL in the .env file.

Getting Started

Follow these steps to create a new Python project using this template:

  1. Click the "Use this template" button at the top of the repository page to create a new repository based on this template.

  2. Clone your newly created repository to your local machine:

         git clone https://github.com/yourusername/your-repo-name.git
         cd your-repo-name
         poetry install

Rename the .env.example file to .env and fill in the necessary values.

Usage

Run the main script using the following command:

To test the logging example

```bash
    poetry run python log_example.py
```

The script will output logs of different levels and demonstrate the decorator's impact on the test_timeit function. The output will be displayed in the console.

dq_my_python_project's People

Contributors

stringtheory92 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.