Giter VIP home page Giter VIP logo

template-python's Introduction

python-template

A simple template to bootstrap Python packages. It should be slightly faster than starting from scratch each time.

Features

  • ๐Ÿจ As vanilla as it gets - Pure standard python, including setuptools as build tool.
  • โœ๏ธ One config file - The pyproject.toml handles everything: dependencies, tools, versioning.
  • ๐Ÿท๏ธ Dynamic versioning - The package version is dynamically set at build time, taken from package_name.__version__

Getting Started

To use this template, follow these steps:

  1. Click the "Use this template" button at the top of the repository and follow the procedure.

  2. Clone your new repository to your local machine:

    git clone https://github.com/your-username/your-repo.git
  3. Navigate to the project directory. Optional but recommended: create and activate a Python virtual environment to isolate your project's dependencies. E.g.:

    cd your-repo
    python -m venv .venv
    source .venv/bin/activate  # On Windows, use .venv\Scripts\activate
  4. The template provides a simple "self-destructing" initialization script, init.py, that automatically provides the necessary information to generate a fully functional python package (project name, author, ...). From a python environment, or any other means, this script can be launched as easily as:

    # launch and follow the prompts
    python init.py
  5. Install the required dependencies:

     # Install the bare minimum, editable is usually preferred when developing
    pip install -e .
    # Install extras
    pip install -e .[dev|docs|test]
  6. You're good to go! Of course, you can further customize it to your liking.

Note

The init.py script is self-contained and will delete itself once the procedure is completed. It is absolutely safe to delete if you prefer to edit the files manually.

Extra goodies

If you are using VS Code as your editor of choice, you can use the following snippet in your settings.json file to format and sort imports on save.

{
    "python.formatting.provider": "black",
    "[python]": {
        "editor.formatOnSave": true,
        "editor.codeActionsOnSave": {
            "source.organizeImports": true
        },
    },
}

Of course, this is completely optional.

template-python's People

Contributors

edornd 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.