dhsrocha / template-py

Template for a python project.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python's logo

Python project template

Buy me a mug

Objective    |    Contents    |    Execution

Objective

This repository intends to stand a reliable and consistent procedure for setting up a development environment for python projects.

Thus, the main dependencies for the project's structure organization are the following:

Contents

  • setup.sh: Sets up a proper and isolated python environment, designed for both development and production purposes;
  • pyproject.toml: Describes the project's build specification, according to its specification;
  • .editorconfig: Applies formatting to whole repository content for any compatible editors, as depicted in its site;
  • .gitignore: Usual ignoring file against a python project's build, caching files and its corresponding editors.

There are other files in repository but not essential for a project initialization. such this file, LICENSE, CI/CD configuration and any other ones.

Execution

The setup.sh file is going to run the following:

  • shellcheck's check in order to verify its own content's syntax;
  • For both:
    • Downloads each aforementioned project management tools and installs as the way its corresponding procedure recommends;
    • Initiates its corresponding program and exports them to PATH variable;
    • Appends to ~/.bashrc the code snippet once in order to activate them automatically as a new shell is spawned.
  • For pyenv:
    • Creates a virtualenv activation using the repository's recipient folder name and according to the PROJ_VER variable:
      • Skips this step if a environment had already been activated as described above;
      • The current activation will be cleaned up if does not correspond to the way this script sets it.
  • For pypoetry:
    • Verifies for poetry updates;
    • Instructs the program to not creating virtual environments for itself;
    • If pyproject.toml is present:
      • Checks if this file is valid;
      • Updates the activated virtualenv's dependencies.
        • (Creates a new one with its default setting if the file absent).
    • Adds some useful development dependencies to the activated virtualenv if absent.
      • (If a poetry.lock file does not exist in the repository and a one is generated during the execution, it is going to be removed afterwards).

In addition to that, it does:

  • Install other complementary development tools such as docker, terraform and AWS client;
  • Create .gitignore and .editorconfig files as previously described if the corresponding one is absent.

About

Template for a python project.

License:MIT License


Languages

Language:Shell 100.0%