mirror of
https://github.com/pacnpal/pip-add.git
synced 2025-12-20 04:01:05 -05:00
Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
24fa3971bf | ||
|
|
7ee17f6479 | ||
|
|
330bc93df6 | ||
|
|
7712950aed | ||
|
|
40b618f97f | ||
|
|
6f125da2cb | ||
|
|
228ff8aae9 | ||
|
|
99cfafa3fa | ||
|
|
ee077907e8 | ||
|
|
141c6c8294 | ||
|
|
d780ea9092 | ||
|
|
a81a56a55a | ||
|
|
6019d260fc | ||
|
|
5672586ce0 | ||
|
|
e046250444 | ||
|
|
78e4b463f9 | ||
|
|
08be12c63e | ||
|
|
ec082f4174 | ||
|
|
fd44299f11 | ||
|
|
5047dc8093 | ||
|
|
7092c203f9 | ||
|
|
7292393eec | ||
|
|
af517b1283 |
7
.deepsource.toml
Normal file
7
.deepsource.toml
Normal file
@@ -0,0 +1,7 @@
|
||||
version = 1
|
||||
|
||||
[[analyzers]]
|
||||
name = "python"
|
||||
|
||||
[analyzers.meta]
|
||||
runtime_version = "3.x.x"
|
||||
34
.github/workflows/claude-review.yml
vendored
Normal file
34
.github/workflows/claude-review.yml
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
name: Claude Code Review
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
on:
|
||||
# Run on new/updated PRs
|
||||
pull_request:
|
||||
types: [opened, reopened, synchronize]
|
||||
|
||||
# Allow manual triggers for existing PRs
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
pr_number:
|
||||
description: 'Pull Request Number'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
code-review:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Run Claude Review
|
||||
uses: pacnpal/claude-code-review@v1.0.6
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
anthropic-key: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||
pr-number: ${{ github.event.pull_request.number || inputs.pr_number }}
|
||||
8
.github/workflows/publish.yml
vendored
8
.github/workflows/publish.yml
vendored
@@ -25,6 +25,14 @@ jobs:
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install build
|
||||
- name: Run Pytest tests
|
||||
run: |
|
||||
pip install pytest pytest-cov
|
||||
pytest --cov --cov-report=xml
|
||||
- name: Upload coverage reports to Codecov
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
- name: Build package
|
||||
run: python -m build
|
||||
|
||||
41
.github/workflows/python-multiversion.yml
vendored
Normal file
41
.github/workflows/python-multiversion.yml
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
|
||||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
|
||||
|
||||
name: Python test for 3.8, 3.9, 3.10, 3.11, 3.12, 3.13
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install flake8 pytest
|
||||
python -m pip install .
|
||||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||
- name: Lint with flake8
|
||||
run: |
|
||||
# stop the build if there are Python syntax errors or undefined names
|
||||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
||||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
||||
- name: Test with pytest
|
||||
run: |
|
||||
pytest
|
||||
37
.github/workflows/python-tests.yml
vendored
Normal file
37
.github/workflows/python-tests.yml
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
name: Python pytest and upload to Codecov
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: "3.x"
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install .
|
||||
pip install pytest pytest-cov
|
||||
- name: Run coverage & upload to Codecov
|
||||
run: |
|
||||
pytest --cov --cov-report=xml
|
||||
- name: Upload results to Codecov
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
- name: Run pytest tests
|
||||
run: |
|
||||
pytest --cov --junitxml=junit.xml -o junit_family=legacy
|
||||
- name: Upload test results to Codecov
|
||||
if: ${{ !cancelled() }}
|
||||
uses: codecov/test-results-action@v1
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
30
README.md
30
README.md
@@ -2,7 +2,9 @@
|
||||
|
||||
A command-line tool that combines package installation and requirements.txt management. Install, update, or remove Python packages and their dependencies with automatic requirements.txt handling.
|
||||
|
||||
Compatible with Python 3.11, 3.12, and 3.13.
|
||||
Compatible with Python 3.9, 3.10, 3.11, 3.12, and 3.13.
|
||||
|
||||
[](https://codecov.io/gh/pacnpal/pip-add)
|
||||
|
||||
## Features
|
||||
|
||||
@@ -16,7 +18,7 @@ Compatible with Python 3.11, 3.12, and 3.13.
|
||||
- Creates requirements.txt if it doesn't exist
|
||||
- Support for custom requirements file paths
|
||||
- Smart detection of multiple requirements files
|
||||
- Full support for Python 3.11, 3.12, and 3.13
|
||||
- Full support for Python 3.8, 3.9, 3.10, 3.11, 3.12, and 3.13
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -43,7 +45,7 @@ pipx install pip-add
|
||||
|
||||
## Usage
|
||||
|
||||
### Installation
|
||||
### Package Installation
|
||||
|
||||
```bash
|
||||
# Basic package installation
|
||||
@@ -133,7 +135,7 @@ pip-add -r -f requirements/dev.txt requests
|
||||
|
||||
## Command Line Options
|
||||
|
||||
```
|
||||
```bash
|
||||
pip-add [-h] [-d] [-e] [-r] [-f REQUIREMENTS_FILE] package
|
||||
|
||||
positional arguments:
|
||||
@@ -194,29 +196,15 @@ The tool is designed to safely handle dependencies:
|
||||
- pip
|
||||
- setuptools
|
||||
|
||||
## Development
|
||||
|
||||
### Local Setup
|
||||
|
||||
```bash
|
||||
# Clone the repository
|
||||
git clone https://github.com/PacNPal/pip-add.git
|
||||
cd pip-add
|
||||
|
||||
# Create virtual environment
|
||||
python -m venv venv
|
||||
source venv/bin/activate # or `venv\Scripts\activate` on Windows
|
||||
|
||||
# Install in development mode
|
||||
pip install -e .
|
||||
```
|
||||
|
||||
## Common Scenarios
|
||||
|
||||
### New Project
|
||||
|
||||
```bash
|
||||
# First time setup
|
||||
pip-add flask
|
||||
# Creates requirements.txt and adds Flask
|
||||
|
||||
pip-add -d flask
|
||||
# Creates requirements.txt and adds Flask with dependencies
|
||||
|
||||
|
||||
4
setup.py
4
setup.py
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
||||
|
||||
setup(
|
||||
name="pip-add",
|
||||
version="0.2.4",
|
||||
version="0.2.5",
|
||||
packages=find_packages(),
|
||||
install_requires=[
|
||||
"pip",
|
||||
@@ -39,5 +39,5 @@ setup(
|
||||
"Topic :: System :: Systems Administration",
|
||||
"Topic :: Utilities",
|
||||
],
|
||||
python_requires=">=3.11",
|
||||
python_requires=">=3.8",
|
||||
)
|
||||
|
||||
48
tests/test_cli.py
Normal file
48
tests/test_cli.py
Normal file
@@ -0,0 +1,48 @@
|
||||
import pytest
|
||||
from pip_add.cli import (
|
||||
find_requirements,
|
||||
get_package_dependencies,
|
||||
find_dependent_packages,
|
||||
analyze_dependencies,
|
||||
remove_from_requirements,
|
||||
add_to_requirements,
|
||||
install_package,
|
||||
uninstall_packages,
|
||||
main
|
||||
)
|
||||
|
||||
def test_find_requirements():
|
||||
# Add test cases for find_requirements
|
||||
pass
|
||||
|
||||
def test_get_package_dependencies():
|
||||
# Add test cases for get_package_dependencies
|
||||
pass
|
||||
|
||||
def test_find_dependent_packages():
|
||||
# Add test cases for find_dependent_packages
|
||||
pass
|
||||
|
||||
def test_analyze_dependencies():
|
||||
# Add test cases for analyze_dependencies
|
||||
pass
|
||||
|
||||
def test_remove_from_requirements():
|
||||
# Add test cases for remove_from_requirements
|
||||
pass
|
||||
|
||||
def test_add_to_requirements():
|
||||
# Add test cases for add_to_requirements
|
||||
pass
|
||||
|
||||
def test_install_package():
|
||||
# Add test cases for install_package
|
||||
pass
|
||||
|
||||
def test_uninstall_packages():
|
||||
# Add test cases for uninstall_packages
|
||||
pass
|
||||
|
||||
def test_main():
|
||||
# Add test cases for main
|
||||
pass
|
||||
10
tests/test_utils.py
Normal file
10
tests/test_utils.py
Normal file
@@ -0,0 +1,10 @@
|
||||
import pytest
|
||||
from pip_add.utils import find_requirements, add_to_requirements
|
||||
|
||||
def test_find_requirements():
|
||||
# Add test cases for find_requirements
|
||||
pass
|
||||
|
||||
def test_add_to_requirements():
|
||||
# Add test cases for add_to_requirements
|
||||
pass
|
||||
Reference in New Issue
Block a user