Skip to main content

Find Fucking Bug

Project description

FFB: Find Fucking Bug

pypi License: GPL v3 Supported Python versions Code Style - Ruff Pre Commit ci

FFB Logo

FFB is a Python package designed to simplify debugging by analyzing your terminal output and providing concise solutions and explanations for errors. Whether you're new to coding or an experienced developer, FFB aims to reduce the time spent deciphering cryptic error messages and helps you find solutions faster.

 

 

 

TODO

  • Suggests solutions with code examples
  • Implement unit tests for the new API
  • Improve documentation
  • Serve with cloud-hosted API
  • Design and implement a user interface (UI)

Installation

You can install FFB via pip:

pip install ffb

Self-hosted

Ensure Ollama is running on your machine. You can find the setup and installation instructions for Ollama by visiting the Ollama GitHub repository.

Make sure you pull the model

ollama pull llama3.1

To run FFB in a self-hosted environment using Ollama, you’ll need to set the OLLAMA_API_URL environment variable. By default, you can set it to http://localhost:11434

export OLLAMA_API_URL=http://localhost:11434

Usage

To use FFB, simply run your Python script as usual. If an error occurs, call ffb to analyze the last output.

Example

Given the following Python code:

def divide_numbers(a, b):
    result = a / b
    print(f"Result: {result}")

divide_numbers(10, 0)

Running this code will produce the following error:

Traceback (most recent call last):
  File "/Users/aliymnx/Desktop/main.py", line 6, in <module>
    divide_numbers(10, 0)
  File "/Users/aliymnx/Desktop/main.py", line 2, in divide_numbers
    result = a / b
             ~~^~~
ZeroDivisionError: division by zero

To analyze this error using FFB, simply run:

ffb

FFB will analyze the error and provide a detailed solution:

Error Summary The error occurs when attempting to divide a number by zero, which is undefined.

Solution

def divide_numbers(a, b):
   if b == 0:
      return "Error: Division by zero is not allowed."
  else:
    result = a / b
    return result

print(divide_numbers(10, 0))


Explanation To resolve this issue, we've added a simple check in the divide_numbers function to ensure that the divisor (b) is not zero. If it is zero, the function returns an error message instead of attempting the division, thus preventing the ZeroDivisionError.

Contributing

If you’d like to contribute to FFB, feel free to submit issues and pull requests on the GitHub repository.

License

The license section now reflects the GPL-3.0 license as requested.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ffb-0.1.1.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

ffb-0.1.1-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

Details for the file ffb-0.1.1.tar.gz.

File metadata

  • Download URL: ffb-0.1.1.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for ffb-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9b09a46409fbc4c0a14a83bf9483e44c5601913998c1841524ce43e0eea9197f
MD5 84974eab0a5b351f590fe198cbafa2a2
BLAKE2b-256 daa346e0052435cdf71c5904f28c7bce5cda29ce505b70261c9d3f18760c0103

See more details on using hashes here.

File details

Details for the file ffb-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ffb-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 19.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for ffb-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 55cd01762a71ccdec3377d19602253c25e0a8e3b9a459a8bf05c74de614600fa
MD5 45fea3288d339d295dab02ac53afe0e3
BLAKE2b-256 54fde96470fbabe6fd66b343a960e6e7d3b9091fedd95c28f1e0182f58a248e9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page