Skip to main content

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
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.

Metadata

Release files for ripgreppythonfiles 0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ripgreppythonfiles 0.10
File Size Uploaded Provenance Actions
ripgreppythonfiles-0.10.tar.gz 4.4 kB Without provenance Details for ripgreppythonfiles-0.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ripgreppythonfiles 0.10
File Interpreter ABI Platform Actions
ripgreppythonfiles-0.10-py3-none-any.whl Python 3 none any Details for ripgreppythonfiles-0.10-py3-none-any.whl

Total release size: 11.2 kB

Release files / ripgreppythonfiles-0.10.tar.gz

Download URL ripgreppythonfiles-0.10.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
59468b424c7b39fabc38f5a45d6d3583b40191cab2889d0d5b92108dd3bcd171
BLAKE2b-256 checksum
How to use checksums
4ae8c37f221d7b73b85af3bd7284a53b15f43f05d0acac135010fe17932a80e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / ripgreppythonfiles-0.10-py3-none-any.whl

Download URL ripgreppythonfiles-0.10-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be751e153b81ffd4253e6c930822c496acaa1298779f8c9867f6bcfe7fa94a30
BLAKE2b-256 checksum
How to use checksums
f1b3f38f3fb027cb06a2a369411fdf0798c8804832251fbd07cec98d6de1e967
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Security for ripgreppythonfiles 0.10

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.

Release history Release notifications | RSS feed

This release

0.10 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page