Skip to content

gerardrbentley/pipreqs-api

Repository files navigation

Python Pipreqs API

Powered by FastAPI + pipreqs. Specifically, FastAPI runs the API server for receiving requests and pipreqs does the code requirements assessing.

Basic API to power bots / helpers to rid the world of Python projects without correct requirements!

Attempts to shallow git clone a given repo then run pipreqs on the codebase. Returns the resulting requirements.txt contents!

NOTE: Caches responses for a given url for 5 minutes or until it is evicted by LRU policy

Deploy

How to Use

curl "https://pipreqs-api.herokuapp.com/pipreqs?code_url=https://github.com/gerardrbentley/pipreqs-api"

Response

cachetools==5.0.0
fastapi==0.75.2
httpx==0.22.0
pydantic==1.9.0
pytest==7.1.2
streamlit==1.8.1
uvicorn==0.17.6

Roadmap

  • 🧪 Generation Options:
    • Strict / Unpinned / Compatible / Greater Than options
    • Alternate PyPi server
    • Use requirements data to make conda environment.yml or pyproject.toml
  • 🤖 API Options:
    • Caching
    • Cache Busting
    • Auto open Github Pull Request with updated requirements
    • Allow partial repo / branch urls instead of full git url
    • Safe way to allow zip fetch / analysis?
  • 📺 Frontend:
    • Streamlit app for requesting repo(s)
    • Deployed on separate branch streamlit_deploy to contain requirements

Local Run

Update environment

  • Copy or Rename .env.example as .env.dev
mv .env.example .env.dev

Run with Docker

Requires docker-compose to be installed (this comes with Docker Desktop).

make run
# Open localhost:8000/health

Lint, Check, Test with Docker

# Linting
make lint
# Unit Testing
make test

# Display coverage report after test (uses local python, not docker)
make coverage

Local Python environment

For code completion / linting / developing / etc.

make install
. ./venv/bin/activate
cd backend

Features

  • Development Containerization with Docker
  • Dependency installation with Pip
  • Code formatting with Black and isort
  • Testing with pytest

About

API to help you help other python projects without too much effort

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published