no-string-hints
A pre-commit hook to automatically remove string literals as type hints from argument, return, and class variable type annotations. Will only make the replacement if your file contains from __future__ import annotations.
Installation
pip install no-string-hints
As a pre-commit hook
See pre-commit for instructions
Sample .pre-commit-config.yaml:
- repo: https://github.com/MarcoGorelli/no-string-hints
rev: v0.2.0
hooks:
- id: no-string-hints
Command-line example
$ cat myfile.py
myvar: 'str'
$ no_string_hints myfile.py
$ cat myfile.py
myvar: str
See also
Check out pyupgrade, which I learned a lot from when writing this.
Metadata
Release files for no-string-hints 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| no_string_hints-0.2.0.tar.gz | 3.8 kB | Without provenance | Details for no_string_hints-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| no_string_hints-0.2.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for no_string_hints-0.2.0-py2.py3-none-any.whl |
Total release size: 7.8 kB
Release files / no_string_hints-0.2.0.tar.gz
| Download URL | no_string_hints-0.2.0.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
055c1b012b09c47eb0d8a8d89f0ed743b0582bd83ff810f39eacdd6dc8efd988
|
|
BLAKE2b-256 checksum How to use checksums |
db5d9a893830889e6dc76d4c065875ac7c06ba32fcc9e5110a0141d2daa9769a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5
|
Release files / no_string_hints-0.2.0-py2.py3-none-any.whl
| Download URL | no_string_hints-0.2.0-py2.py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
4b584e37fd6000b8cd4ed69b297ecea4b3206a15782af73e694f18453c85b6c9
|
|
BLAKE2b-256 checksum How to use checksums |
cab34d5d56bbd64af782e5946007a693198ca28d1fa1d5b092086e530d28bd0c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5
|
Security for no-string-hints 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.