Find all string values used in a python project.
Project description
strings.py
Print all strings and f-string constants present in a python project.
Ignores docstrings, unused strings, type annotations and single characters.
Installation
pip install strings.py
Usage
python -m strings path/to/project/or/file
Example
Consider this module.py file:
"""My module"""
SOME_CONSTANT = "42"
class C:
"""My Class does this"""
def __init__(self) -> None:
self.x = SOME_CONST
c = C()
print(f"The constant: {c.x}")
$ python -m strings module.py
42
The constant:
$ python -m strings -n module.py
/home/john/module.py:3:42
/home/john/module.py:12:The constant:
Local Development / Testing
- Create and activate a virtual environment
- Run
pip install -r requirements-dev.txtto do an editable install - Run
pytestto run tests
Type Checking
Run mypy .
Create and upload a package to PyPI
Make sure to bump the version in setup.cfg.
Then run the following commands:
rm -rf build dist
python setup.py sdist bdist_wheel
Then upload it to PyPI using twine:
twine upload dist/*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file strings_py-1.0.1.tar.gz.
File metadata
- Download URL: strings_py-1.0.1.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd62c49663e3430ac0070d9a158877abfd91ee84ffa6334a2afc04b9fa6c0930
|
|
| MD5 |
230c2f198365689af63a81eb4870d7f3
|
|
| BLAKE2b-256 |
68a4f2279eee2ba1dbea59b709dda77989afcd43caf9fce439a86fb06057ea14
|
File details
Details for the file strings.py-1.0.1-py3-none-any.whl.
File metadata
- Download URL: strings.py-1.0.1-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4c97a7256efa2e81a7be14d4a69a5c34d2bba23617e1f42c71170c6f4036b0e
|
|
| MD5 |
af5dc8fdff3ea118025795b6078e1f9a
|
|
| BLAKE2b-256 |
407b2d2c32302052f75d3cbbd65d1b95ce5ffd3842cd849d2abab3baeaa1b29a
|