Skip to main content

Initialize your Python project with all the linting boilerplates you need

Project description

Rubric

>> Automate the boilerplate while initializing your Python project <<

 

img

Preface

Rubric is an opinionated project initializer for Python. It assumes that you'll use:

  • Black as the primary code formatter.
  • Isort to sort the imports.
  • Flake8 to ensure style guide conformance.
  • Mypy to check the type hints.
  • Pip-tools to manage the dependencies.

Following is a list of config files that Rubric is going to add to your directory:

root
├── .flake8                #` Config file for .flake8
├── .gitignore             #` Python specific .gitignore file
├── makefile               #` Makefile containing the commands to lint your code
├── pyproject.toml         #` Toml file to with the configs for mypy, black & isort
├── README.md              #` A readme boilerplate
├── requirements-dev.in    #` File to specify the top level dev requirements
├── requirements-dev.txt   #` File to specify the dev requirements
├── requirements.in        #` File to specify the top level app requirements
└── requirements.txt       #` File to specify the pinned app requirements

The files will contain minimal but sensible default configurations for the respective tools. You're free to change them as you like.

Installation

  • Rubric requires Python 3.7 and up.

  • Make a virtual environment in your project's root directory.

  • Activate the environment and run:

    pip install rubric
    

Usage

  • To inspect all the CLI options, run:

    rubric --help
    

    You should see the following output:

    $ rubric
    
           ___       __       _
          / _ \__ __/ /  ____(_)___
         / , _/ // / _ \/ __/ / __/
        /_/|_|\_,_/_.__/_/ /_/\__/
    
    usage: rubric [-h] [-l] [-d DIRNAME] [-o OVERWRITE [OVERWRITE ...]] [-v] [run]
    
    Rubric -- Initialize your Python project ⚙️
    
    positional arguments:
    run                   run rubric & initialize the project scaffold
    
    optional arguments:
    -h, --help            show this help message and exit
    -l, --list            list the config files that are about to be generated
    -d DIRNAME, --dirname DIRNAME
                            target directory name
    -o OVERWRITE [OVERWRITE ...], --overwrite OVERWRITE [OVERWRITE ...]
                            overwrite existing config files, allowed values are: all, .flake8,
                            .gitignore, README.md, makefile, pyproject.toml,
                            requirements-dev.in, requirements-dev.txt, requirements.in, requirements.txt
    -v, --version         display the version number
    
    
  • Take a peek into the config files that are going to be created:

    rubric --list
    
  • Initialize a project with the following command:

    rubric run
    

    This will run the tool in a non-destructive way—that means it won't overwrite any of the configuration files that you might have in the directory.

    If you want to overwrite any of the existing config files that you might have in the directory, then run:

    rubric run --overwrite filename1 filename2
    

    You can also point Rubric to a directory.

    rubric run --directory "some/custom/directory"
    
✨ 🍰 ✨

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rubric-0.2.6.tar.gz (10.2 kB view hashes)

Uploaded Source

Built Distribution

rubric-0.2.6-py3-none-any.whl (10.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page