# Search for code in your env using ripgrep
## Tested against Windows / Python 3.11 / Anaconda
## pip install ripgreppythonfiles
A script to search for code in your env using ripgrep https://github.com/BurntSushi/ripgrep
Example:
```
(mainenv) C:\ProgramData\anaconda3\envs\mainenv>rgtt import\ numpy #SPACES MUST BE ESCAPED!!
call python -c "from ripgreppythonfiles import rfile;rfile(r'''import\ numpy''')"
C:\ProgramData\anaconda3\envs\mainenv\bstackbin.py:1:1:import numpy as np
C:\ProgramData\anaconda3\envs\mainenv\bstackbin.py-2-import regex # pip install regex
C:\ProgramData\anaconda3\envs\mainenv\bstackbin.py-3-
C:\ProgramData\anaconda3\envs\mainenv
C:\ProgramData\anaconda3\envs\mainenv\anyarray.pyx-12-from cython.parallel cimport prange
C:\ProgramData\anaconda3\envs\mainenv\anyarray.pyx-13-cimport cython
C:\ProgramData\anaconda3\envs\mainenv\anyarray.pyx:14:1:import numpy as np
C:\ProgramData\anaconda3\envs\mainenv\anyarray.pyx:15:2:cimport numpy as np
C:\ProgramData\anaconda3\envs\mainenv\anyarray.pyx-16-import cython
C:\ProgramData\anaconda3\envs\mainenv\anyarray.pyx-17-
C:\ProgramData\anaconda3\envs\mainenv
C:\ProgramData\anaconda3\envs\mainenv\cmdaxs.py-50-
C:\ProgramData\anaconda3\envs\mainenv\cmdaxs.py-51-import pymem
C:\ProgramData\anaconda3\envs\mainenv\cmdaxs.py:52:1:import numpy as np
C:\ProgramData\anaconda3\envs\mainenv\cmdaxs.py-53-from pdmemedit import Pdmemory
C:\ProgramData\anaconda3\envs\mainenv\cmdaxs.py-54-# pass either pid or filename, but not both
....
Output written to: C:\Users\hansc\AppData\Local\Temp\tmpbmfm5sdo.txt
```
```python
rfile(args: str):
Runs ripgrep with the provided arguments, printing the split arguments and calling `run_ripgrep`.
Parameters:
- args (str): The arguments to pass to ripgrep.
Returns:
None
Obs:
Useful when using a bat file:
Content of rgtt.bat
call python -c "from ripgreppythonfiles import rfile;rfile(r'''%*''')"
Calling the bat file;
rgtt.bat import\ numpy 5 100 1 120
run_ripgrep(
r: str = "",
c: int | str = 2,
m: int | str = 1,
s: int | str = 1,
l: int | str = 80,
f: str = "py,pyx",
):
Runs ripgrep with specified parameters.
Parameters:
- r (str): The regular expression to search for.
- c (in,str): The number of lines of context to display.
- m (in,str): The maximum search depth.
- s (in,str): If 1, writes the ripgrep output to a temporary file.
- l (in,str): The maximum number of columns to display in the output.
- f (str): A str of file extensions to search for (e.g, py,pyx).
Returns:
subprocess.CompletedProcess: The result of the ripgrep subprocess.
```
Raw data
{
"_id": null,
"home_page": "https://github.com/hansalemaos/ripgreppythonfiles",
"name": "ripgreppythonfiles",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "SEARCH,ripgrep,env",
"author": "Johannes Fischer",
"author_email": "aulasparticularesdealemaosp@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/4a/e8/c37f221d7b73b85af3bd7284a53b15f43f05d0acac135010fe17932a80e3/ripgreppythonfiles-0.10.tar.gz",
"platform": null,
"description": "\r\n# Search for code in your env using ripgrep \r\n\r\n## Tested against Windows / Python 3.11 / Anaconda\r\n\r\n## pip install ripgreppythonfiles\r\n\r\n\r\nA script to search for code in your env using ripgrep https://github.com/BurntSushi/ripgrep \r\n\r\n\r\nExample: \r\n\r\n```\r\n(mainenv) C:\\ProgramData\\anaconda3\\envs\\mainenv>rgtt import\\ numpy #SPACES MUST BE ESCAPED!!\r\n\r\ncall python -c \"from ripgreppythonfiles import rfile;rfile(r'''import\\ numpy''')\"\r\nC:\\ProgramData\\anaconda3\\envs\\mainenv\\bstackbin.py:1:1:import numpy as np\r\nC:\\ProgramData\\anaconda3\\envs\\mainenv\\bstackbin.py-2-import regex # pip install regex\r\nC:\\ProgramData\\anaconda3\\envs\\mainenv\\bstackbin.py-3-\r\n\r\nC:\\ProgramData\\anaconda3\\envs\\mainenv\r\nC:\\ProgramData\\anaconda3\\envs\\mainenv\\anyarray.pyx-12-from cython.parallel cimport prange\r\nC:\\ProgramData\\anaconda3\\envs\\mainenv\\anyarray.pyx-13-cimport cython\r\nC:\\ProgramData\\anaconda3\\envs\\mainenv\\anyarray.pyx:14:1:import numpy as np\r\nC:\\ProgramData\\anaconda3\\envs\\mainenv\\anyarray.pyx:15:2:cimport numpy as np\r\nC:\\ProgramData\\anaconda3\\envs\\mainenv\\anyarray.pyx-16-import cython\r\nC:\\ProgramData\\anaconda3\\envs\\mainenv\\anyarray.pyx-17-\r\n\r\nC:\\ProgramData\\anaconda3\\envs\\mainenv\r\nC:\\ProgramData\\anaconda3\\envs\\mainenv\\cmdaxs.py-50-\r\nC:\\ProgramData\\anaconda3\\envs\\mainenv\\cmdaxs.py-51-import pymem\r\nC:\\ProgramData\\anaconda3\\envs\\mainenv\\cmdaxs.py:52:1:import numpy as np\r\nC:\\ProgramData\\anaconda3\\envs\\mainenv\\cmdaxs.py-53-from pdmemedit import Pdmemory\r\nC:\\ProgramData\\anaconda3\\envs\\mainenv\\cmdaxs.py-54-# pass either pid or filename, but not both\r\n\r\n.... \r\n\r\nOutput written to: C:\\Users\\hansc\\AppData\\Local\\Temp\\tmpbmfm5sdo.txt\r\n```\r\n\r\n\r\n\r\n```python\r\nrfile(args: str):\r\n Runs ripgrep with the provided arguments, printing the split arguments and calling `run_ripgrep`.\r\n\r\n Parameters:\r\n - args (str): The arguments to pass to ripgrep.\r\n\r\n Returns:\r\n None\r\n\r\n Obs:\r\n Useful when using a bat file:\r\n Content of rgtt.bat\r\n call python -c \"from ripgreppythonfiles import rfile;rfile(r'''%*''')\"\r\n Calling the bat file;\r\n rgtt.bat import\\ numpy 5 100 1 120\r\n\r\nrun_ripgrep(\r\n r: str = \"\",\r\n c: int | str = 2,\r\n m: int | str = 1,\r\n s: int | str = 1,\r\n l: int | str = 80,\r\n f: str = \"py,pyx\",\r\n):\r\n\r\n Runs ripgrep with specified parameters.\r\n\r\n Parameters:\r\n - r (str): The regular expression to search for.\r\n - c (in,str): The number of lines of context to display.\r\n - m (in,str): The maximum search depth.\r\n - s (in,str): If 1, writes the ripgrep output to a temporary file.\r\n - l (in,str): The maximum number of columns to display in the output.\r\n - f (str): A str of file extensions to search for (e.g, py,pyx).\r\n\r\n Returns:\r\n subprocess.CompletedProcess: The result of the ripgrep subprocess.\r\n\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Search for code in your env using ripgrep",
"version": "0.10",
"project_urls": {
"Homepage": "https://github.com/hansalemaos/ripgreppythonfiles"
},
"split_keywords": [
"search",
"ripgrep",
"env"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f1b3f38f3fb027cb06a2a369411fdf0798c8804832251fbd07cec98d6de1e967",
"md5": "3be1e2b6f56e2a1a15b28af65603f393",
"sha256": "be751e153b81ffd4253e6c930822c496acaa1298779f8c9867f6bcfe7fa94a30"
},
"downloads": -1,
"filename": "ripgreppythonfiles-0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3be1e2b6f56e2a1a15b28af65603f393",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6775,
"upload_time": "2024-02-01T22:33:30",
"upload_time_iso_8601": "2024-02-01T22:33:30.950405Z",
"url": "https://files.pythonhosted.org/packages/f1/b3/f38f3fb027cb06a2a369411fdf0798c8804832251fbd07cec98d6de1e967/ripgreppythonfiles-0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4ae8c37f221d7b73b85af3bd7284a53b15f43f05d0acac135010fe17932a80e3",
"md5": "c9adad95ac0597f8956b67428f71f917",
"sha256": "59468b424c7b39fabc38f5a45d6d3583b40191cab2889d0d5b92108dd3bcd171"
},
"downloads": -1,
"filename": "ripgreppythonfiles-0.10.tar.gz",
"has_sig": false,
"md5_digest": "c9adad95ac0597f8956b67428f71f917",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4432,
"upload_time": "2024-02-01T22:33:32",
"upload_time_iso_8601": "2024-02-01T22:33:32.869858Z",
"url": "https://files.pythonhosted.org/packages/4a/e8/c37f221d7b73b85af3bd7284a53b15f43f05d0acac135010fe17932a80e3/ripgreppythonfiles-0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-01 22:33:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hansalemaos",
"github_project": "ripgreppythonfiles",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "touchtouch",
"specs": []
}
],
"lcname": "ripgreppythonfiles"
}