Git Product home page Git Product logo

blueprint's Introduction

Blueprint: A Perfect Python Project Structure

Blueprint is an exampel python project you can use to build maintainable applications. The details on the best practices followed in this project are explained in The Analytics Club

Buy Me a Coffee at ko-fi.com

Installation

Blueprint uses Poetry for dependency management. If you haven't installed it already please use Poetry's official docs for instructions.

  1. Fork this repository by clicking on the fork button at the top right corner. (If not make sure you change the remote url once you cloned this repository)
  2. Clone your new repository to your local computer
git clone [email protected]:thuwarakeshm/blueprint.git
cd blueprint

3.Install project depenencies.

poetry install
  1. Install pre-commit hooks
poetry run pre-commit install

You are ready to rock.

Usage

Now you can program your application inside the blueprint directory. The following command will start your application.

poetry run start

The above command will run the app function in the main.py module. You can import your custom functions and hook it to the app function to run them.

If not you can change the entry point to a different function by changing the blueprint.main:app configuration in the pyproject.toml file.

To change the main module name, you can rename the blueprint directory. But make sure you also rename the name in the pyproject.toml file.

You can add project configuration straightly to the toml file's [app] section. You can read it in anywhere in your project by calling the following lines.

import toml
APP_CONFIG = toml.load("pyproject.toml")["app"]

app_name = APP_CONFIG['APP_NAME']

Also you can add app secrets directly to the .env file and read it anywhere from your project with the help of Python's built in os module.

import os
secret = os.environ['APP_SECRET']

This is possible because we've loaded the env file from our main.py module. If you are replacing this module, be sure to load it again.

blueprint's People

Contributors

thuwarakesh-stax avatar thuwarakeshm 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.