-
absolufy-imports converts relative imports to absolute ones.
-
Scout Monitoring
Free Django app performance insights with Scout Monitoring. Get Scout setup in minutes, and let us sweat the small stuff. A couple lines in settings.py is all you need to start monitoring your apps. Sign up for our free tier today.
-
removestar replaces import * in Python files with explicit imports.
-
unimport
Discontinued :rocket: The ultimate linter and formatter for removing unused import statements in your code. [Moved to: https://github.com/hakancelikdev/unimport] (by hakancelik96)
unimport: removes unused imports.
-
Pyre from Meta, pyright from Microsoft and PyType from Google provide additional assistance. They can 'infer' types based on code flow and existing types within the code.
-
black
Discontinued The uncompromising Python code formatter [Moved to: https://github.com/psf/black] (by python)
To get all your code into a consistent format the next step is to run a formatter. I recommend black, the well-known uncompromising code formatter, which is the most popular choice. Alternatives to black are autoflake, prettier and yapf, if you do not agree with blacks constraints.
-
isort will sort the imports for you
-
autoflake
Discontinued Removes unused imports and unused variables as reported by pyflakes [Moved to: https://github.com/PyCQA/autoflake] (by myint)
To get all your code into a consistent format the next step is to run a formatter. I recommend black, the well-known uncompromising code formatter, which is the most popular choice. Alternatives to black are autoflake, prettier and yapf, if you do not agree with blacks constraints.
-
CodeRabbit
CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
-
Pre-commit Hooks: Pre-commit is a tool that can be set up to enforce coding rules and standards before you commit your changes to your code repository. This ensures that you can't even check in (commit) code that doesn't meet your standards. This allows a code reviewer to focus on the architecture of a change while not wasting time with trivial style nitpicks.
-
To get all your code into a consistent format the next step is to run a formatter. I recommend black, the well-known uncompromising code formatter, which is the most popular choice. Alternatives to black are autoflake, prettier and yapf, if you do not agree with blacks constraints.
-
Mutmut introduces a clever approach to scrutinizing your tests. It evaluates the effectiveness of your test suite by slightly altering the code after the tests have been written. If a test fails after a minor change, that's a good sign; it means the test is robust enough to catch those changes. But if the test passes even after the code change, it indicates that the test isn't effectively detecting that alteration – this is what Mutmut terms a "surviving mutant."
-
Hypothesis for Property-Based Testing: Hypothesis is a Python library facilitating property-based testing. It offers a distinct advantage by generating a wide array of input data based on specified properties or invariants within the code. The perks of Hypothesis include:
-
To get all your code into a consistent format the next step is to run a formatter. I recommend black, the well-known uncompromising code formatter, which is the most popular choice. Alternatives to black are autoflake, prettier and yapf, if you do not agree with blacks constraints.
-
pyupgrade
A tool (and pre-commit hook) to automatically upgrade syntax for newer versions of the language.
pyupgrade and flynt are examples of tools that modify your code base from earlier python versions into the newest python syntax, rewriting all string formats into f-strings and similar things.
-
Pyre from Meta, pyright from Microsoft and PyType from Google provide additional assistance. They can 'infer' types based on code flow and existing types within the code.
-
pyupgrade and flynt are examples of tools that modify your code base from earlier python versions into the newest python syntax, rewriting all string formats into f-strings and similar things.
-
awesome-flake8-extensions
:octocat: A curated awesome list of flake8 extensions. Feel free to contribute! :mortar_board:
Ultimately we want to test our code with Flake8 and plugins to enforce a more consistent code style and to encourage best practices. When you first introduce flake8 or a new plug-in commonly you have a lot of violations that you can silence with a #noqa comment. When you first introduce a new flake8 plugin, you will likely have a lot of violations, which you silence with #noqa comments. Over time these comments will become obsolete because you fixed the. yesqa will automatically remove these unnecessary #noqa comments.
-
flake8-bugbear
A plugin for Flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle.
Bugbear is not specifically a security tool but serves as an effective guard against common coding errors and pitfalls. It pinpoints and rectifies frequent mistakes like setting a list as a default value for a parameter and cautions against such practices, enhancing code robustness.
-
On the other hand, Bandit is a dedicated security scanner designed to target critical security concerns such as SQL injection and cross-site scripting exploits. It meticulously scrutinizes the codebase to identify and alert developers about possible security breaches or vulnerabilities, thus fortifying the code against potential exploitation.
-
A more modern alternative for flake8 is Ruff: Ruff can be used to replace Flake8 (plus a variety of plugins), isort, pydocstyle, yesqa, eradicate, pyupgrade, and autoflake, all while executing tens or hundreds of times faster than any individual tool. Ruff supports over 700 lint rules and goes beyond the responsibilities of a traditional linter, instead functioning as an advanced code transformation tool capable of upgrading type annotations, rewriting class definitions, sorting imports, and more.
-
safety
Safety checks Python dependencies for known security vulnerabilities and suggests the proper remediations for vulnerabilities detected.
Safety and Dependabot complement these security tools by focusing on external dependencies. Safety takes charge of examining your dependencies, ensuring they are up-to-date and free from any known vulnerabilities. Dependabot works similarly, scanning dependencies, verifying if they're current and assessing them for potential security flaws. This function is crucial as weaknesses in external dependencies can compromise the security of the entire codebase.
-
MonkeyType
A Python library that generates static type annotations by collecting runtime types (by Instagram)
To alleviate the burden of manual annotation, MonkeyType offers a clever solution. It dynamically observes the types entering and leaving functions during code execution. Based on this observation, it generates a preliminary draft of type annotations. This significantly reduces the effort needed to add type hints to legacy code.
-
SchemaThesis is a powerful tool, especially when working with web APIs, and here's how it can enhance your testing capabilities:
-
While most of my 'hypermodernizing' was done on proprietary code, there is a good example in pygeoif, which was brought up to the standard 10 years after the first version was released. The diff is not very helpful, almost every line was touched in the end, but you can compare the version 0.6 to the current implementation. FastKML is still actively in the process of modernizing and refactoring.
-
While most of my 'hypermodernizing' was done on proprietary code, there is a good example in pygeoif, which was brought up to the standard 10 years after the first version was released. The diff is not very helpful, almost every line was touched in the end, but you can compare the version 0.6 to the current implementation. FastKML is still actively in the process of modernizing and refactoring.
-
Hypermodern Python Cookiecutter
-
Awesome Python Code Formatters
-
awesome-python-typing
Collection of awesome Python types, stubs, plugins, and tools to work with them.
Awesome Python Typing
-
Awesome Python Testing
-
Awesome PyTest
-
GuardDog is a CLI tool that allows to identify malicious PyPI packages.
-
talks
🚀️ Hypermodernizing python legacy code. Slides and links from my talks 📣️ . EuroPython 🇪🇺️ and Pycon Ireland 🇮🇪️ 2022/2023 (by cleder)
Slides A Tale of Two Kitchens Hypermodernizing Your Codebase.
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives