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.txt
to do an editable install - Run
pytest
to 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
strings_py-1.0.0.tar.gz
(4.6 kB
view hashes)
Built Distribution
Close
Hashes for strings.py-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26d4df919f3049e9d7f4df2290494f01f1a1839c30d0e238617b6381fc9670e1 |
|
MD5 | 3c4c2b01b32c03f21c78a53b5584890b |
|
BLAKE2b-256 | 64d9e1dcd4170bc6845ede02664381b309025df11fbbf77312781f025e476def |