{"id":13771534,"url":"https://github.com/Zac-HD/shed","last_synced_at":"2025-05-11T04:30:45.829Z","repository":{"id":40365562,"uuid":"240695112","full_name":"Zac-HD/shed","owner":"Zac-HD","description":"`shed` canonicalises Python code.  Shed your legacy, stop bikeshedding, and move on.  Black++","archived":false,"fork":false,"pushed_at":"2024-10-08T06:04:30.000Z","size":406,"stargazers_count":343,"open_issues_count":5,"forks_count":23,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-08T11:44:35.078Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pypi.org/project/shed/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Zac-HD.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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,"publiccode":null,"codemeta":null},"funding":{"github":"Zac-HD"}},"created_at":"2020-02-15T11:19:18.000Z","updated_at":"2025-04-24T16:02:32.000Z","dependencies_parsed_at":"2024-01-12T21:19:52.916Z","dependency_job_id":"09d8846c-e36d-4a12-bdd8-46f45385ee22","html_url":"https://github.com/Zac-HD/shed","commit_stats":{"total_commits":239,"total_committers":13,"mean_commits":"18.384615384615383","dds":"0.35146443514644354","last_synced_commit":"f56ab966e97f1dcf4e3cd3807dace07b4dfb5cc0"},"previous_names":[],"tags_count":55,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zac-HD%2Fshed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zac-HD%2Fshed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zac-HD%2Fshed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zac-HD%2Fshed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Zac-HD","download_url":"https://codeload.github.com/Zac-HD/shed/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253518941,"owners_count":21921074,"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":[],"created_at":"2024-08-03T17:00:52.488Z","updated_at":"2025-05-11T04:30:45.299Z","avatar_url":"https://github.com/Zac-HD.png","language":"Python","readme":"# shed\n`shed` canonicalises Python code.  Shed your legacy, stop bikeshedding, and move on.  Black++\n\n## What does it do?\n`shed` is the *maximally opinionated* autoformatting tool.  It's *all about*\n[convention over configuration](https://en.wikipedia.org/wiki/Convention_over_configuration),\nand designed to be a single opinionated tool that fully canonicalises my\ncode - formatting, imports, updates, and every other fix I can possibly\nautomate.\n\nThere are no configuration options at all, but if the defaults aren't for you\nthat's OK - you can still use the underlying tools directly and get most of\nthe same effect... though you'll have to configure them yourself.\n\n`shed` must either be run in a git repo to auto-detect the files to format,\nor explicitly passed a list of files to format on the command-line.\n\n## Features\n`shed`...\n\n- Runs [`ruff`](https://pypi.org/project/ruff/),\n  to remove unused imports and variables, upgrade code, sort imports, and more.\n- Runs [`black`](https://pypi.org/project/black/),\n  with autodetected minimum version \u003e= py38\n- Formats code blocks in docstrings, markdown, and restructured text docs\n  (based on [`blacken-docs`](https://pypi.org/project/blacken-docs/)).\n- If `shed --refactor`, also runs [`com2ann`](https://pypi.org/project/com2ann/)\n  and custom refactoring logic using [`libcst`](https://pypi.org/project/libcst/). See documentation for the codemods in [CODEMODS.md](CODEMODS.md)\n\nThe version detection logic is provided by `black`.  Because `shed` supports the same\n[versions of Python as upstream](https://devguide.python.org/#status-of-python-branches),\nit assumes that the minimum version is Python 3.8.\n\nIf you run `shed` in a Git repository, the name of the root directory is assumed to be a\nfirst-party import.  [`src` layout](https://hynek.me/articles/testing-packaging/)\npackages are also automatically detected, i.e. the `foo` in any paths like\n`.../src/foo/__init__.py`.\n\n### Jupyter Notebook support\nWe recommend [using `jupytext` to save your notebooks in `.py` or `.md` files](https://jupytext.readthedocs.io/en/latest/),\nin which case `shed` supports them natively.  For a quick-and-dirty workflow,\nyou can [use `nbqa shed notebook.ipynb`](https://nbqa.readthedocs.io/en/latest/readme.html) -\n`nbqa` works for any linter or formatter.\n\n## Using `shed` in your editor\nWe recommend [using `black` in your editor](https://black.readthedocs.io/en/stable/integrations/editors.html)\ninstead of `shed`, since it provides our core formatting logic and `shed`'s extra\nsmarts can be counterproductive while you're actively editing code - for example,\nremoving an \"unused\" import just after you add it!\n\nThen, when you're done editing, you can run `shed` from the command-line, `pre-commit`\nhooks, and your CI system.\n\n## Using `shed` with pre-commit\nIf you use [pre-commit](https://pre-commit.com/), you can use it with Shed by\nadding the following to your `.pre-commit-config.yaml`:\n\n```yaml\nminimum_pre_commit_version: '2.9.0'\nrepos:\n- repo: https://github.com/Zac-HD/shed\n  rev: 2024.10.1\n  hooks:\n    - id: shed\n      # args: [--refactor, --py311-plus]\n      types_or: [python, pyi, markdown, rst]\n```\n\nThis is often considerably faster for large projects, because `pre-commit`\ncan avoid running `shed` on unchanged files.\n\n## See also\n`shed` inherits `pyupgrade`'s careful approach to converting string formatting\ncode.  If you want a more aggressive refactoring tool and don't mind checking\nfor breaking changes, [check out `flynt`](https://github.com/ikamensh/flynt).\n\nFor Django upgrades, see [`django-codemod`](https://github.com/browniebroke/django-codemod)\nor [`django-upgrade`](https://github.com/adamchainz/django-upgrade).\n\nThe [`ssort` project](https://pypi.org/project/ssort/) sorts the contents of\npython modules so that statements are placed after the things they depend on,\nfor easier navigation and consistency of design.\n\n[`Semgrep` supports some autofixes](https://r2c.dev/blog/2022/autofixing-code-with-semgrep/#the-results),\nwith patterns for a wide variety of languages.  This includes a variety of both\nsecurity and style checks, with manual inspection of results recommended.\n\n## Changelog\n\nPatch notes [can be found in `CHANGELOG.md`](https://github.com/Zac-HD/shed/blob/master/CHANGELOG.md).\n","funding_links":["https://github.com/sponsors/Zac-HD"],"categories":["Improvements and wrappers"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FZac-HD%2Fshed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FZac-HD%2Fshed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FZac-HD%2Fshed/lists"}