mypy
black
Our great sponsors
mypy | black | |
---|---|---|
60 | 214 | |
13,316 | 28,344 | |
2.7% | 4.4% | |
9.8 | 9.4 | |
3 days ago | 3 days ago | |
Python | Python | |
GNU General Public License v3.0 or later | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
mypy
-
What's New in Python 3.11?
It looks like there's a PEP for that already! [0]
And as (almost) always, Pyright has already implemented the provisional PEP!
-
Don't let dicts spoil your code
They don't work in the way you would think for dataclasses or at all for dicts/TypedDicts.
See this for dataclasses: https://github.com/python/mypy/issues/5374#issuecomment-8841....
- mypy: Optional static typing for Python
-
why python is not used in game development? And why are the C+ and C# languages favored?
It's worth noting that Python 3.5+ added standardized type annotations for 3rd party type checkers to leverage. I pretty much use them all the time now except for extremely small scripts. My 3rd party type checker of choice is mypy.
-
You Should Compile Your Python and Here’s Why
how, when mypy itself has only "type: ignore" as a workaround for many scenarios?
here's a list of 41 issues where either the user or the mypy devs are saying "use type: ignore as a workaround for now":
https://github.com/python/mypy/issues?q=is%3Aopen+label%3Afa...
- Discussion Thread
-
Python’s “Type Hints” are a bit of a disappointment to me
It reminds me of this 5 year old bug in mypy: "int is not a Number?" [1].
-
Creating A Modern Python Development Environment
Mypy is an optional static type checker that aims to combine the benefits of dynamic (or “duck”) typing and static typing. The benefits of statically typed code are increased readability and maintainability. For an existing code base here's a guide on how to implement Mypy.
-
This Week In Python
mypy – Optional static typing for Python
-
Mypy won't detect instance attribute access
You might get some luck by asking it on the mypy repo.
black
-
From Jupyter to Kubernetes: Refactoring and Deploying Notebooks Using Open-Source Tools
The interactivity of notebooks makes it simple to try out new ideas, but it also yields messy code. While exploring data, we often rush to write code without considering readability. Lucky for us, there are tools like isort and black which allow us to easily re-format our code to improve readability. Unfortunately, these tools only work with .py files; however, soorgeon enable us to run them on notebook files (.ipynb):
-
API pull into pandas with formatting.
Your code isn't PEP-8 compliant. Use black or autopep8 on your code to auto-format your code, or at least use pylint to check for issues, before asking anyone else to read your code.
-
Best general packages to use for Python projects
Not so much for the project but for project support I always use black for formatting. mypy to check my code. pydocstyle to check the comments.
-
I write absolute garbage quality code
Use black code formatter.
-
Grade me for PEP 8 and overall good code habits
black for the win
- Black - The uncompromising Python code formatter
-
Formatting of Single If-Else Condition
To somewhat misquote Pirates of the Caribbean- code formatting is more what you'd call "guidelines" than actual rules. In my opinion, do what's comfortable for you or the team you're working with. These days I tend to just use black (which will adhere to the one statement per line mantra): https://github.com/psf/black
-
Python script to calculate air parameters
I have some feedback for you on the code itself. Typically, you should follow PEP8 naming conventions, your function names should have all lower case. Your classes should be camel case (CamelCase). Getting used to a good naming convention is vital and will make things easier for you in the long run. I also use a code format tool called black. It helps to make things very consistent. It isn't mandatory, just an FYI.
- Automatically rearranging Python code?
-
Did I do this right?
Run black on save https://github.com/psf/black Most modern IDE's allow this. Just google "name of your editor + black on save".
What are some alternatives?
autopep8 - A tool that automatically formats Python code to conform to the PEP 8 style guide.
yapf - A formatter for Python files
pyright - Static type checker for Python
prettier - Prettier is an opinionated code formatter.
Pylint - It's not just a linter that annoys you!
isort - A Python utility / library to sort imports.
pyre-check - Performant type-checking for python.
pycodestyle - Simple Python style checker in one Python file
autoflake - Removes unused imports and unused variables as reported by pyflakes
pytype - A static type analyzer for Python code
Flake8 - flake8 is a python tool that glues together pycodestyle, pyflakes, mccabe, and third-party plugins to check the style and quality of some python code.
typing - Python static typing home. Hosts the documentation and a user help forum.