Crawler and search tools used by Sirji.
Project description
Sirji is an Open Source AI Software Development Agent.
Built with ❤️ by True Sparrow
Sirji Tools
sirji-tools
is a PyPI package that provides tools for:
- Crawling (downloading web pages to markdown files)
- Searching on Google
- Custom Logging
Installation
Setup Virtual Environment
We recommend setting up a virtual environment to isolate Python dependencies, ensuring project-specific packages without conflicting with system-wide installations.
python3 -m venv venv
source venv/bin/activate
Install Package
Install the package from PyPi:
pip install sirji-tools
Run the following command to install playwright:
playwright install
Usage
Environment Variables
Ensure that following environment variables are set:
export SIRJI_WORKSPACE="Absolute folder path for Sirji to use as it's workspace."
export SIRJI_RUN_PATH='Folder having run specific logs, etc.'
Crawl URLs
Crawl URLs tool will be used to crawl the web pages and extract the information from the web pages. And store the information for the further processing by researcher.
from sirji_tools import crawl_urls
urls = ['https://www.google.com', 'https://www.yahoo.com']
crawl_urls(urls, 'workspace/researcher')
Search
Search tool will be used to search the information from the web pages based on the search terms provided. It returns the list of URLs related to the search terms.
from sirji_tools import search_for
search_term = 'python programming'
urls = search_for(search_term)
Logger
Logger tool will be used to log the information in the log file. It will be used to log the information to show the progress of the execution.
from sirji_tools.logger import p_logger
p_logger.info("Log line here")
For Contributors
- Fork and clone the repository.
- Create and activate the virtual environment as described above.
- Set the environment variables as described above.
- Install the package in editable mode by running the following command from repository root:
pip install -e .
- Run the following command to install playwright:
playwright install
Running Tests and Coverage Analysis
Follow the above mentioned steps for "contributors", before running the test cases.
# Install testing dependencies
pip install pytest coverage
# Execute tests
pytest
# Measure coverage, excluding test files
coverage run --omit="tests/*" -m pytest
coverage report
License
Distributed under the MIT License. See LICENSE
for more information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for sirji_tools-0.0.11-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc32690230113e651ce9420a58d1f580a6648c12713ad210349976817854a3d8 |
|
MD5 | 173e65293f85e088adb9ef4a3cddf40f |
|
BLAKE2b-256 | c9303a07e424324ec35b7a96e88bb73467f3f47ed731ff0981cac06502b54d84 |