Coder Social home page Coder Social logo

basepythonproject's Introduction

This is a base project to be forked and used in later work. It supports:

  • containerization
  • secret injection
  • configuration
  • logging
  • testing
  • linting

This project will be for scripts that run, and exit But I should extend this script for microservice HTTP/grpc/graphql type services

Secret Injection & Configuration

yaml is used for storing secrets & config in config/. For secrets, they are stored in config/secrets.yaml. The secrets file is read on startup, and an example of reading a value is provided. The secrets file has also been added to the .gitignore.

Logging

logging is used for logging. Configuration is in main.py. Logs are written to: log/python_script.log

Linting

black is used for code formatting, flake8 is used for PEP enforcement, mypy is for type checking.

Testing

pytest is used for testing. Run PYTHONPATH=src pytest to invoke test suite. Not quite sure why the importing in the pytest configuration is not working

Containerization

docker is used for containerization.

  • docker build -t imagename . to build
  • docker run imagename to run

Project Structure

generated with tree ./ -I venv | sed 's/  / /' | pbcopy

./
├── Dockerfile
├── README.md
├── config
│  ├── basicConfig.yaml
│  └── secrets.yaml
├── log
│  └── python_script.log
├── pyproject.toml
├── requirements.txt
├── src
│  └── main.py
└── test
    └── test_main.py

basepythonproject's People

Contributors

jamesdesmond avatar

Watchers

James Cloos avatar  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.