# strings.py
Print all strings and f-string constants present in a python project.
Ignores docstrings, unused strings, type annotations and single characters.
## Installation
```bash
pip install strings.py
```
## Usage
```bash
python -m strings path/to/project/or/file
```
### Example
Consider this `module.py` file:
```python
"""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}")
```
```console
$ 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:
```bash
rm -rf build dist
python setup.py sdist bdist_wheel
```
Then upload it to PyPI using [twine](https://twine.readthedocs.io/en/latest/#installation):
```bash
twine upload dist/*
```
Raw data
{
"_id": null,
"home_page": "https://github.com/tusharsadhwani/strings.py",
"name": "strings.py",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Tushar Sadhwani",
"author_email": "tushar.sadhwani000@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/68/a4/f2279eee2ba1dbea59b709dda77989afcd43caf9fce439a86fb06057ea14/strings_py-1.0.1.tar.gz",
"platform": null,
"description": "# strings.py\n\nPrint all strings and f-string constants present in a python project.\n\nIgnores docstrings, unused strings, type annotations and single characters.\n\n## Installation\n\n```bash\npip install strings.py\n```\n\n## Usage\n\n```bash\npython -m strings path/to/project/or/file\n```\n\n### Example\n\nConsider this `module.py` file:\n\n```python\n\"\"\"My module\"\"\"\n\nSOME_CONSTANT = \"42\"\n\nclass C:\n \"\"\"My Class does this\"\"\"\n\n def __init__(self) -> None:\n self.x = SOME_CONST\n\nc = C()\nprint(f\"The constant: {c.x}\")\n```\n\n```console\n$ python -m strings module.py\n42\nThe constant:\n\n$ python -m strings -n module.py\n/home/john/module.py:3:42\n/home/john/module.py:12:The constant:\n```\n\n## Local Development / Testing\n\n- Create and activate a virtual environment\n- Run `pip install -r requirements-dev.txt` to do an editable install\n- Run `pytest` to run tests\n\n## Type Checking\n\nRun `mypy .`\n\n## Create and upload a package to PyPI\n\nMake sure to bump the version in `setup.cfg`.\n\nThen run the following commands:\n\n```bash\nrm -rf build dist\npython setup.py sdist bdist_wheel\n```\n\nThen upload it to PyPI using [twine](https://twine.readthedocs.io/en/latest/#installation):\n\n```bash\ntwine upload dist/*\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Find all string values used in a python project.",
"version": "1.0.1",
"project_urls": {
"Homepage": "https://github.com/tusharsadhwani/strings.py"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "407b2d2c32302052f75d3cbbd65d1b95ce5ffd3842cd849d2abab3baeaa1b29a",
"md5": "af5dc8fdff3ea118025795b6078e1f9a",
"sha256": "a4c97a7256efa2e81a7be14d4a69a5c34d2bba23617e1f42c71170c6f4036b0e"
},
"downloads": -1,
"filename": "strings.py-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "af5dc8fdff3ea118025795b6078e1f9a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 4578,
"upload_time": "2024-06-28T21:25:10",
"upload_time_iso_8601": "2024-06-28T21:25:10.192393Z",
"url": "https://files.pythonhosted.org/packages/40/7b/2d2c32302052f75d3cbbd65d1b95ce5ffd3842cd849d2abab3baeaa1b29a/strings.py-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "68a4f2279eee2ba1dbea59b709dda77989afcd43caf9fce439a86fb06057ea14",
"md5": "230c2f198365689af63a81eb4870d7f3",
"sha256": "fd62c49663e3430ac0070d9a158877abfd91ee84ffa6334a2afc04b9fa6c0930"
},
"downloads": -1,
"filename": "strings_py-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "230c2f198365689af63a81eb4870d7f3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 4565,
"upload_time": "2024-06-28T21:25:12",
"upload_time_iso_8601": "2024-06-28T21:25:12.023514Z",
"url": "https://files.pythonhosted.org/packages/68/a4/f2279eee2ba1dbea59b709dda77989afcd43caf9fce439a86fb06057ea14/strings_py-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-28 21:25:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tusharsadhwani",
"github_project": "strings.py",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"tox": true,
"lcname": "strings.py"
}