python-ack

ACK is a code-searching tool, similar to grep but optimized for programmers searching large trees of source code.

https://github.com/klich3/python-ack

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.4%) to scientific vocabulary

Keywords

ack grep python-tool regexp search shell-tool
Last synced: 6 months ago · JSON representation ·

Repository

ACK is a code-searching tool, similar to grep but optimized for programmers searching large trees of source code.

Basic Info
  • Host: GitHub
  • Owner: klich3
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 78.1 KB
Statistics
  • Stars: 1
  • Watchers: 2
  • Forks: 0
  • Open Issues: 0
  • Releases: 2
Topics
ack grep python-tool regexp search shell-tool
Created about 2 years ago · Last pushed about 2 years ago
Metadata Files
Readme Funding License Citation

README.md

Python-ACK

Python Version License

ACK is a code-searching tool, similar to grep but optimized for programmers searching large trees of source code.

Features

  • Multi-process search
  • Exclude specific paths and patterns
  • ANSI color-coded output
  • Search in symlinks (Python >= 2.6 only)
  • Execution statistics

Usage as script

Options * --num-processes, -n: Number of processes to use (default: 4). * --exclude-path, -x: Exclude paths matching EXCLUDEPATHPATTERN. * --follow-links, -f: Follow symlinks (Python >= 2.6 only). * --exclude-search, -s: Exclude results matching EXCLUDE_PATTERN. * --no-colors, -c: Don't print ANSI colors like ACK tool. * --statistics, -t: On final print execution statistics.

Example

After install you can run it simply writing shell python-ack <params>

Search: ```shell python -m python_ack "apple" /path/to/search

// or

python-ack "apple" /path/to/search ```

Help: ```shell python -m python_ack --help

// or

python-ack --help ```

``` usage: python-ack [-h] [--num-processes NUM_PROCESSES] [--exclude-path EXCLUDEPATHPATTERN] [--follow-links] [--exclude-search EXCLUDE_PATTERN] [--no-colors] [--statistics] PATTERN [DIRECTORY]

Python-ACK is a code-searching tool, similar to grep but optimized for programmers searching large trees of source code.

positional arguments: PATTERN Pattern to search for. DIRECTORY A directory to search.

options: -h, --help show this help message and exit --num-processes NUMPROCESSES, -n NUMPROCESSES Number of processes to use. --exclude-path EXCLUDEPATHPATTERN, -x EXCLUDEPATHPATTERN Exclude paths matching EXCLUDEPATHPATTERN. --follow-links, -f Follow symlinks (Python >= 2.6 only). --exclude-search EXCLUDEPATTERN, -s EXCLUDEPATTERN Exclude results matching EXCLUDE_PATTERN. --no-colors, -c Don't print ANSI colors like ACK tool. --statistics, -t On final print excecution statistics.

```


Ack Class Attributes

The ack class in Python-ACK has several attributes that allow you to customize the behavior of the search tool. Here's a brief description of each attribute:

  • path: The path to the directory where the search will be performed.
  • regexp: The regular expression pattern to search for in files.
  • num_processes: Number of processes to use for the multi-process search (default: 4).
  • excludepathsregexp: A list of regular expressions to exclude paths from the search.
  • follow_links: Boolean flag indicating whether to follow symbolic links (Python >= 2.6 only).
  • exclude_regexp: A list of regular expressions to exclude results matching specific patterns in files.
  • useansicolors: Boolean flag indicating whether to use ANSI colors in the output.
  • search_function: Custom search function to be used for searching in files.
  • returnasdict: Boolean flag indicating whether to return the result as a dictionary.

Example Usage:

```python from python_ack.ack import ack

def main(): folder = "/path/to/search" instance = ack( path=folder, regexp="apple", excluderegexp=["solor"], numprocesses=10, excludepathsregexp=["exclude*"], followlinks=False, useansicolors=False ) instance.processfolders() instance.printresult()

duration = instance.get_duration()
if duration is not None:
    print(f"\nComplete in {duration}ms.")

if name == "main": main()

```


Local dev

Click sections to expand.

Command-line commands

In root folder run pip install -e .

shell cd /tests python test.py

Local cli run

shell python -m python_ack


Acknowledgements

  • Author: Anton Sychev
  • Email: anton@sychev.xyz

License

This project is licensed under the MIT License - see the LICENSE file for details.

Make sure to replace "/path/to/search" with your actual path. You can also customize the badges, add more sections, and provide more details based on your project's needs.


Publish to Pypi

Click sections to expand.

Command-line commands

Local: shell python -m pip install build twine python3 -m build twine check dist/* twine upload dist/*

Live: No need do nothing GitHub have Workflow action its publish auto


Star History

Star History Chart

Owner

  • Name: Anton Sychev
  • Login: klich3
  • Kind: user
  • Location: Barcelona
  • Company: @Sychev

FullStack developer passionate about decentralized web tech, AI, Web 2.0, FrontEnd/BackEnd, databases, and system optimization. Focused on R&D.

Citation (CITATION.cff)

cff-version: 1.2.0
title: python-ack
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Anton
    family-names: Sychev
    email: anton@sychev.xyz
repository-code: "https://github.com/klich3/python-ack"
abstract: ACK is a code-searching tool, similar to grep but optimized for programmers searching large trees of source code.
keywords:
  - storage
  - reegexp
  - search
license: MIT
version: 0.0.2

GitHub Events

Total
Last Year

Committers

Last synced: 11 months ago

All Time
  • Total Commits: 14
  • Total Committers: 1
  • Avg Commits per committer: 14.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Anton Sychev a****n@s****z 14
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 8 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 18 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 2
  • Total maintainers: 1
pypi.org: python-ack

Python-ACK is a code-searching tool, similar to grep but optimized for programmers searching large trees of source code.

  • Homepage: https://github.com/klich3/python-ack
  • Documentation: https://python-ack.readthedocs.io/
  • License: The MIT License (MIT) Copyright (c) <2024> Anton Sychev Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  • Latest release: 0.0.2
    published about 2 years ago
  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 18 Last month
Rankings
Dependent packages count: 10.1%
Average: 38.3%
Dependent repos count: 66.5%
Maintainers (1)
Last synced: 7 months ago

Dependencies

.github/workflows/python-publish.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
  • pypa/gh-action-pypi-publish 27b31702a0e7fc50959f5ad993c78deac1bdfc29 composite
pyproject.toml pypi
requirements.txt pypi
setup.py pypi
src/python_ack.egg-info/requires.txt pypi
  • build *
  • twine *