{"id":22191921,"url":"https://github.com/klich3/python-ack","last_synced_at":"2025-03-24T20:44:17.662Z","repository":{"id":215306921,"uuid":"738115910","full_name":"klich3/python-ack","owner":"klich3","description":"ACK is a code-searching tool, similar to grep but optimized for programmers searching large trees of source code.","archived":false,"fork":false,"pushed_at":"2024-01-30T09:49:52.000Z","size":80,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-02T23:05:02.115Z","etag":null,"topics":["ack","grep","python-tool","regexp","search","shell-tool"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/klich3.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":["klich3"],"ko_fi":"klich3"}},"created_at":"2024-01-02T13:11:26.000Z","updated_at":"2024-01-03T23:00:33.000Z","dependencies_parsed_at":"2024-01-15T17:39:47.547Z","dependency_job_id":"a762bfeb-799d-4565-a8dc-0b9418f0c416","html_url":"https://github.com/klich3/python-ack","commit_stats":{"total_commits":13,"total_committers":2,"mean_commits":6.5,"dds":"0.15384615384615385","last_synced_commit":"577299006293115a58955d1e97b463cde56fe143"},"previous_names":["klich3/python-ack"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klich3%2Fpython-ack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klich3%2Fpython-ack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klich3%2Fpython-ack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klich3%2Fpython-ack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/klich3","download_url":"https://codeload.github.com/klich3/python-ack/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245351762,"owners_count":20601090,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ack","grep","python-tool","regexp","search","shell-tool"],"created_at":"2024-12-02T12:18:23.798Z","updated_at":"2025-03-24T20:44:17.624Z","avatar_url":"https://github.com/klich3.png","language":"Python","funding_links":["https://github.com/sponsors/klich3","https://ko-fi.com/klich3"],"categories":[],"sub_categories":[],"readme":"# Python-ACK\n\n![Python Version](https://img.shields.io/badge/python-3.6%2B-blue.svg)\n![License](https://img.shields.io/badge/license-MIT-blue.svg)\n\nACK is a code-searching tool, similar to grep but optimized for programmers searching large trees of source code.\n\n## Features\n- Multi-process search\n- Exclude specific paths and patterns\n- ANSI color-coded output\n- Search in symlinks (Python \u003e= 2.6 only)\n- Execution statistics\n\n---\n\n# Usage as script\n***Options***\n* --num-processes, -n: Number of processes to use (default: 4).\n* --exclude-path, -x: Exclude paths matching EXCLUDE_PATH_PATTERN.\n* --follow-links, -f: Follow symlinks (Python \u003e= 2.6 only).\n* --exclude-search, -s: Exclude results matching EXCLUDE_PATTERN.\n* --no-colors, -c: Don't print ANSI colors like ACK tool.\n* --statistics, -t: On final print execution statistics.\n\n\n### Example\n\n***After install you can run it simply writing***\n```shell\npython-ack \u003cparams\u003e\n```\n\n***Search:***\n```shell\npython -m python_ack \"apple\" /path/to/search\n\n// or\n\npython-ack \"apple\" /path/to/search\n```\n\n***Help:***\n```shell\npython -m python_ack --help\n\n// or\n\npython-ack --help\n```\n\n```\nusage: python-ack [-h] [--num-processes NUM_PROCESSES] [--exclude-path EXCLUDE_PATH_PATTERN] [--follow-links] [--exclude-search EXCLUDE_PATTERN]\n                  [--no-colors] [--statistics]\n                  PATTERN [DIRECTORY]\n\nPython-ACK is a code-searching tool, similar to grep but optimized for programmers searching large trees of source code.\n\npositional arguments:\n  PATTERN               Pattern to search for.\n  DIRECTORY             A directory to search.\n\noptions:\n  -h, --help            show this help message and exit\n  --num-processes NUM_PROCESSES, -n NUM_PROCESSES\n                        Number of processes to use.\n  --exclude-path EXCLUDE_PATH_PATTERN, -x EXCLUDE_PATH_PATTERN\n                        Exclude paths matching EXCLUDE_PATH_PATTERN.\n  --follow-links, -f    Follow symlinks (Python \u003e= 2.6 only).\n  --exclude-search EXCLUDE_PATTERN, -s EXCLUDE_PATTERN\n                        Exclude results matching EXCLUDE_PATTERN.\n  --no-colors, -c       Don't print ANSI colors like ACK tool.\n  --statistics, -t      On final print excecution statistics.\n\n```\n\n---\n\n## Ack Class Attributes\n\nThe `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:\n\n- **path**: The path to the directory where the search will be performed.\n- **regexp**: The regular expression pattern to search for in files.\n- **num_processes**: Number of processes to use for the multi-process search (default: 4).\n- **exclude_paths_regexp**: A list of regular expressions to exclude paths from the search.\n- **follow_links**: Boolean flag indicating whether to follow symbolic links (Python \u003e= 2.6 only).\n- **exclude_regexp**: A list of regular expressions to exclude results matching specific patterns in files.\n- **use_ansi_colors**: Boolean flag indicating whether to use ANSI colors in the output.\n- **search_function**: Custom search function to be used for searching in files.\n- **return_as_dict**: Boolean flag indicating whether to return the result as a dictionary.\n\n### Example Usage:\n\n```python\nfrom python_ack.ack import ack\n\ndef main():\n    folder = \"/path/to/search\"\n    instance = ack(\n        path=folder,\n        regexp=\"apple\",\n        exclude_regexp=[\"solor\"],\n        num_processes=10,\n        exclude_paths_regexp=[\"exclude_*\"],\n        follow_links=False,\n        use_ansi_colors=False\n    )\n    instance.process_folders()\n    instance.print_result()\n\n    duration = instance.get_duration()\n    if duration is not None:\n        print(f\"\\nComplete in {duration}ms.\")\n\nif __name__ == \"__main__\":\n    main()\n\n```\n\n---\n\n### Local dev\n\n\nClick sections to expand.\n\n\u003ca id=\"local-dev\"\u003e\n\u003cdetails\u003e\n    \u003csummary\u003e Command-line commands \u003c/summary\u003e\n\n\u003c/a\u003e\n\nIn root folder run `pip install -e .`\n\n```shell\ncd /tests\npython test.py\n```\n\n## Local cli run\n\n```shell\npython -m python_ack\n```\n\n\u003c/details\u003e\n\n---\n\n# Acknowledgements\n* Author: Anton Sychev\n* Email: anton@sychev.xyz\n\n\n# License\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n\nMake 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.\n\n\n---\n\n### Publish to Pypi\n\nClick sections to expand.\n\n\u003ca id=\"publish-to-pypi\"\u003e\n\u003cdetails\u003e\n    \u003csummary\u003e Command-line commands \u003c/summary\u003e\n\u003c/a\u003e\n\n***Local:***\n```shell\npython -m pip install build twine\npython3 -m build   \ntwine check dist/*\ntwine upload dist/*\n```\n\n***Live:***\nNo need do nothing GitHub have Workflow action its publish auto\n\n\u003c/details\u003e\n\n---\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=klich3/python-ack\u0026type=Date)](https://star-history.com/#klich3/python-ack\u0026Date)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklich3%2Fpython-ack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fklich3%2Fpython-ack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklich3%2Fpython-ack/lists"}