{"id":13738338,"url":"https://github.com/rednafi/rubric","last_synced_at":"2025-04-22T14:30:40.824Z","repository":{"id":40779344,"uuid":"372218163","full_name":"rednafi/rubric","owner":"rednafi","description":"Linter config initializer for Python","archived":true,"fork":false,"pushed_at":"2023-09-25T02:15:41.000Z","size":197,"stargazers_count":28,"open_issues_count":6,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-02T07:28:16.624Z","etag":null,"topics":["black","config","configuration-files","configuration-management","flake8","isort","linters","makefile","mypy","pip-tools","poetry","pyproject-toml","python","toml"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rednafi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-05-30T13:13:47.000Z","updated_at":"2024-11-19T19:13:33.000Z","dependencies_parsed_at":"2024-04-16T22:03:53.383Z","dependency_job_id":"94b318ec-d466-4de5-a0af-1d8ee8d7d7db","html_url":"https://github.com/rednafi/rubric","commit_stats":{"total_commits":203,"total_committers":3,"mean_commits":67.66666666666667,"dds":0.03448275862068961,"last_synced_commit":"fe0f3523cf92bc68589f3327e5c05113c337c2ac"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rednafi%2Frubric","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rednafi%2Frubric/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rednafi%2Frubric/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rednafi%2Frubric/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rednafi","download_url":"https://codeload.github.com/rednafi/rubric/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250258777,"owners_count":21400970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["black","config","configuration-files","configuration-management","flake8","isort","linters","makefile","mypy","pip-tools","poetry","pyproject-toml","python","toml"],"created_at":"2024-08-03T03:02:19.203Z","updated_at":"2025-04-22T14:30:38.785Z","avatar_url":"https://github.com/rednafi.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"\n\u003cdiv align=\"center\"\u003e\n\n\u003ch1\u003eRubric\u003c/h1\u003e\n\u003cstrong\u003e\u003e\u003e \u003ci\u003eLinter Config Initializer for Python\u003c/i\u003e \u003c\u003c\u003c/strong\u003e\n\n\u0026nbsp;\n\n\u003c/div\u003e\n\n![logo]\n\n\n## Preface\n\nRubric initializes the configuration files of a few Python linters and formatters. Also,\nit adds a README.md boilerplate and a simple Makefile with the commands to apply the\ntools. This helps you maintain an isomorphic workflow across multiple projects. It\nassumes that, in all of your Python projects, you'll use—\n\n* [Black][black] as the primary code formatter.\n* [EditorConfig][editor-config] to enforce consistent style across different editors.\n* [Ruff][ruff] to ensure style guide conformance and sort the imports.\n* [Mypy][mypy] to check the type hints.\n* [Pip-tools][pip-tools] to manage the dependencies.\n* [Hatch][hatch] to generate build artifacts for reusable libraries.\n* [Pre-commit][pre-commit] for managing and maintaining the pre-commit hooks.\n\n\nFollowing is a list of config files that Rubric is going to add to your target\ndirectory:\n\n```\nroot\n├── .editorconfig           # Config file for Editorconfig\n├── .gitignore              # Python specific .gitignore file\n├── .pre-commit-config.yaml # Config to manage pre-commit hooks.\n├── Makefile                # Makefile containing the commands to lint your code\n├── pyproject.toml          # Toml file to with the configs for black, ruff, and mypy\n├── README.md               # A readme boilerplate\n├── requirements-dev.txt    # File to specify the dev requirements\n└── requirements.txt        # File to specify the pinned app requirements\n```\n\nThe files will contain minimal but sensible default configurations for the respective\ntools. You're free to change them as you like.\n\n## Installation\n\n* Rubric requires Python 3.8 and up.\n* Make a virtual environment in your project's root directory.\n* Activate the environment and run:\n\n    ```\n    pip install rubric\n    ```\n\n## Usage\n\n* To inspect all the CLI options, run:\n\n    ```\n    rubric --help\n    ```\n\n    You should see the following output:\n\n    ```\n    $ rubric --help\n                   \u003e\u003e Config Initializer for Python Projects \u003c\u003c\n\n    Usage: rubric [OPTIONS]\n\n    Options:\n    -h, --help                      Display help message.\n    -v, --version                   Display the version number.\n    -s, --show                      Show the contents of the config files.\n    -a, --append                    Append to existing config files.\n    -o, --overwrite                 Overwrite existing config files.\n    -c, --create                    Create the config files in the current\n                                    directory.\n    -f, --filename [.editorconfig|.gitignore|.pre-commit-config.yaml|README.md|\n            Makefile|pyproject.toml|requirements-dev.in|requirements-dev.txt|\n            requirements.in|requirements.txt]\n                                    Target file names.\n    -d, --dirname PATH              Target directory name.\n    -l, --list                      List the config files that are about to be\n                                    generated.\n\n    ```\n\n* Display a list of config files that are going to be created:\n\n    ```\n    rubric --list\n    ```\n\n    ```\n    Config files that are about to be generated:\n\n    =\u003e .editorconfig\n    =\u003e .gitignore\n    =\u003e .pre-commit-config.yaml\n    =\u003e README.md\n    =\u003e Makefile\n    =\u003e pyproject.toml\n    =\u003e requirements-dev.txt\n    =\u003e requirements.txt\n    ```\n\n* Take a peek into the content of any config file(s):\n\n    ```sh\n    rubric --show -f requirements.txt -f .editorconfig\n    ```\n\n    This will print:\n\n    ```txt\n\n    ============================ requirements.txt ============================\n\n    #\n    # This file is autogenerated by pip-compile with python 3.11\n    # To update, run:\n    #\n    #    pip-compile --output-file=requirements.txt requirements.in\n    #\n\n    ============================ .editorconfig ============================\n\n    # https://editorconfig.org\n\n    root = true\n\n    [*]\n    indent_style = space\n    indent_size = 2\n    trim_trailing_whitespace = true\n    insert_final_newline = true\n    charset = utf-8\n    end_of_line = lf\n\n    [*.{py,md}]\n    indent_size = 4\n\n    [Makefile]\n    indent_size = 4\n    indent_style = tab\n    ```\n\n* Initialize a project with the following command:\n\n    ```sh\n    rubric --create\n    ```\n\n    This will run the tool in a non-destructive way—that means it won't overwrite any of\n    the configuration files that you might already have in the directory.\n\n* If you only want to create a selected list of config files, then run:\n\n    ```sh\n    rubric --create -f requirements.txt -f requirements-dev.txt\n    ```\n\n* If you want to overwrite any of the existing config files that you might have in the\ndirectory, then run:\n\n    ```sh\n    rubric --overwrite -f filename1 -f filename2\n    ```\n\n* If you want to append the configs to an existing file, then run:\n\n    ```sh\n    rubric --append -f filename1 -f filename2\n    ```\n\n* You can also point Rubric to a directory.\n\n    ```sh\n    rubric --create --directory \"some/custom/directory\"\n    ```\n\n* If you want to check and update the configs across multiple repositories in a single\nsweep, use the following command:\n\n    ```sh\n    s=\"dir1 dir2 dir3\"; echo $s | xargs -n 1 -P $(echo $s | wc -w) rubric -c -d\n    ```\n\n    This command will spawn 3 processes to create the config files in `dir1`, `dir2`,\n    and `dir3` in parallel.\n\n* You can run the entire linter suite with this command:\n\n    ```\n    make lint\n    ```\n\n[logo]: https://user-images.githubusercontent.com/30027932/122619075-6a87b700-d0b1-11eb-9d6b-355446910cc1.png\n[black]: https://github.com/psf/black\n[editor-config]: https://editorconfig.org/\n[ruff]: https://github.com/charliermarsh/ruff\n[mypy]: https://github.com/python/mypy\n[pip-tools]: https://github.com/jazzband/pip-tools\n[pre-commit]: https://pre-commit.com/\n[hatch]: https://hatch.pypa.io/latest/\n\n\u003cdiv align=\"center\"\u003e\n\u003ci\u003e ✨ 🍰 ✨ \u003c/i\u003e\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frednafi%2Frubric","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frednafi%2Frubric","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frednafi%2Frubric/lists"}