shed
uses calendar versioning, with a year.month.patch scheme.
- Switch to calendar versioning to match underlying tools
- Fixed a cases where
--refactor
could delete comments in parens --refactor
replaces some calls tolist()
,tuple()
anddict()
builtins with literals
- Require Black >= 23.1.0 for latest code style
- Reformat
.pyi
files too
- Fixed
--refactor
to avoid incorrect changes to e.g.x = y or len(z)
--refactor
also removes redundant calls tobool()
in boolean contexts.
--refactor
now splitsassert a and b [and c and ...]
into a separate assertion for each clause, so that it's always clear which (if any) failed.--refactor
removes redundant calls tolen()
in boolean contexts.
- Preserve trailing commas in literals in
--refactor
mode --refactor
mode now flattensOptional[Union[...]]
toUnion[..., None]
- Don't convert
==
tois
in subscripts, to save e.g.df[df.flag == True]
- Updated for compatibility with new
pyupgrade==3.0.0
- Fix a crash when used with Python 3.10 pattern matching
- Fix a bug where the minimum-version argument was sometimes ignored
- Clarified some error messages for easier debugging
- Require latest version of Black to detect that
f"{x=}"
requires Python 3.8+ (and remove previous workaround) - Fixed detection of Hypothesis codemods in
--refactor
mode
- Handle non-locale-encoded files, such as UTF-8 on Windows (#42)
- Preserve comments on the last element of
Literal
types with--refactor
- When finding files in a git repo, search from root not current directory
- Keep
else: pass
blocks if they contain any comments - Leave
Optional[Literal[...]]
alone too - Merge
isinstance(x, y) or isinstance(x, z)
toisinstance(x, (y, z))
- Dropped
teyit
becausepyupgrade
now handles deprecated unittest methods - Don't merge
None
intoLiteral
types; it's easier to read| None
- Avoid crashing on some rare and questionable code patterns
- With
--refactor
, removeelse: pass
blocks - With
--refactor
, "unwrap" lambdas - e.g.lambda x: sorted(x)
->sorted
- Several new custom refactoring passes (#37, #38, #39, #40)
- Supports (and requires) new version of
pyupgrade
- Performance optimizations, reducing startup latency via deferred imports
- Fixed an internal error on
# isort: skip_file
(#32)
- Fixed a crash with
--refactor
on files containingf"{...=}"
(#31)
- Fixed
__init__.py
-based detection heuristic for first-party module names - Avoid guessing that stdlib modules are first-party due to e.g. a
code/
directory
- Require a stable version of Black, which now has a formatting stability policy
- Suppress
stderr
messages from Git when used outside a repository
- Updated minimum dependency versions - bugfixes and improved support for Python 3.9+
- Avoid importing Hypothesis if it's not going to be used (#26)
- Python 3.6 is end-of-life, so format code as 3.7+
- Codemods to fix most warnings from
flake8-comprehensions
, in--refactor
mode - Moves all
libCST
fixers to--refactor
mode for speed
- Fix an internal error on files with lambdas containing positional-only arguments which were not detected as requiring Python 3.8
- Fix an internal error on files with 'fluent interface' call chains (introduced in 0.5.2)
- Fix latent bugs around min-version handling with Black and LibCST
- Fix a rare crash with
--refactor
where com2ann could fail to parse input
- Continue in a single process if
os.fork()
fails withBlockingIOError
- Stop removing "unused" imports in code blocks; often they're used in later blocks
- Use custom LibCST refactoring passes instead of
pybetter
; because these are faster they're also enabled outside of--refactor
mode - Replace
raise NotImplemented
withraise NotImplementedError
- Replace
assert False [, msg]
withraise AssertionError [(msg)]
, for all falsey literals, to avoid surprising behaviour withPYTHONOPTIMIZE
(useif __debug__
if you need such behaviour) - Remove
assert True
, or other truthy literals, which can never fail
- Warn on invalid syntax, and try to format docstrings anyway (#23)
- Skip files or code-blocks with invalid syntax (#23)
- Add new
--py-37-plus
(etc) arguments to select the minimum Python version - disable
autoflake
's remove-unused-variables; allow linters to warn about probable bugs
- require latest versions of all dependencies; variously fixing some upstream bugs, avoiding installation problems, and adding some refactoring features.
- Fix the other
FileNotFoundError
on Windows, ifgit
is not installed.
- Fix a
FileNotFoundError
on Windows, ifgit
is not installed.
- require
black >= 21.6b0
- support, and require,
pyupgrade >= 2.21
- leave empty files empty, instead of adding a blank line (which triggered
flake8
W391)
- require
black >= 21.5b0
to avoid version-detection bug
- avoid new duplicate work when running
shed
(withoutpython -m
)
- support running via
python -m shed
- stop merging nested
with
-statements (ugly when multiline on Python <= 3.9)
- support, and require,
pyupgrade
>= 2.8.0
- sort
tests
imports as aknown_local_folder
withisort
- increase minimum dependency versions
- integrates
hypothesis codemod
in--refactor
mode (optional dependency) - improved reporting for internal errors
- work around known errors in pybetter and libcst
- supports Python-3.9-only files
- improved idempotence in
--refactor
mode with Teyit
- requires newer dependencies -
black
20.8b1 or later,autoflake
1.4 or later
- add
com2ann
to--refactor
on Python 3.8+
- use multiple processes if formatting many files (ncpus times faster!)
- drop
docformatter
due to poor performance - reorganise remaining passes for speed and split out
--refactor
passes
- use
pybetter
codemods - use
teyit
to replace deprecatedunittest
methods with the new aliases (if running on Python 3.9+) - use
docformatter
to format docstrings - new logic inspired by
blacken-docs
to format code in docstrings, via the newshed.docshed
function
- detect first-party imports in single-file mode as well as all-repo mode
- run
pyupgrade --py36-plus
logic too - print each file skipped due to permissions or encoding issues
- combine "as" imports with
isort
on a single line
- automatic and isolated
isort
configuration. I am now happy to recommend that you tryshed
!
- better handling of permissions issues or deleted files
- compatible with pyupgrade==2.4
- compatible with pyupgrade==2.2
- usable CLI
- better isort autoconfig
- project kickoff