Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[bumpversion]
current_version = 0.3.2
current_version = 0.4.0
commit = True
tag = True

[bumpversion:file:pyproxy/utils/version.py]
[bumpversion:file:pyproxy/__init__.py]
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ benchmark/
.gitignore
.git
.gitattributes
.pylintrc
.flake8
.readthedocs.yaml
CHANGELOG.md
CONTRIBUTING.md
Expand Down
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
ignore = E203, W503
max-line-length = 100
36 changes: 0 additions & 36 deletions .github/workflows/code-scan.yml

This file was deleted.

57 changes: 0 additions & 57 deletions .github/workflows/docker-images.yml

This file was deleted.

156 changes: 156 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
name: cicd

on:
push:
branches:
- main
tags:
- "*"
pull_request:

jobs:
code-scan:
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
python-version: ["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@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: pip install --no-cache-dir -U pip black flake8 bandit

- name: Lint with flake8
run: flake8 pyproxy tests benchmark

- name: Check with black
run: black --check pyproxy tests benchmark

- name: Check with bandit
run: bandit -r pyproxy tests benchmark

unittest:
needs: code-scan
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.13

- name: Install build dependencies
run: pip install --no-cache-dir -r requirements.txt

- name: Run tests
run: python -m unittest discover -s tests

build-docker:
needs: unittest
if: github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Get version
id: get_version
run: |
version=$(grep '^__version__' pyproxy/__init__.py | cut -d'"' -f2)
echo "version=${version}" >> $GITHUB_ENV

- name: Convert repository owner to lowercase
run: echo "REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV

- name: Build Docker image
run: docker build -t ghcr.io/${{ env.REPO_OWNER }}/pyproxy:${{ env.VERSION }} -t ghcr.io/${{ env.REPO_OWNER }}/pyproxy:latest .

- name: Build Docker slim image
run: docker build -f Dockerfile.slim -t ghcr.io/${{ env.REPO_OWNER }}/pyproxy:${{ env.VERSION }}-slim -t ghcr.io/${{ env.REPO_OWNER }}/pyproxy:latest-slim .

- name: Push Docker image
run: |
docker push ghcr.io/${{ env.REPO_OWNER }}/pyproxy:${{ env.VERSION }}-slim
docker push ghcr.io/${{ env.REPO_OWNER }}/pyproxy:latest-slim
docker push ghcr.io/${{ env.REPO_OWNER }}/pyproxy:${{ env.VERSION }}
docker push ghcr.io/${{ env.REPO_OWNER }}/pyproxy:latest

build-packages:
needs: unittest
if: github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.13

- name: Get version
id: get_version
run: |
version=$(grep '^__version__' pyproxy/__init__.py | cut -d'"' -f2)
echo "version=${version}" >> $GITHUB_OUTPUT

- name: Create Tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag v${{ steps.get_version.outputs.version }}
git push origin v${{ steps.get_version.outputs.version }}

- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: v${{ steps.get_version.outputs.version }}
release_name: Release v${{ steps.get_version.outputs.version }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install build dependencies
run: pip install --no-cache-dir -U pip . build

- name: Build package
run: python -m build --sdist --wheel
- name: Upload built distributions
uses: actions/upload-artifact@v4
with:
name: dist
path: dist

- name: Install release dependencies
run: pip install --no-cache-dir -U pip . twine packaging

- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
29 changes: 0 additions & 29 deletions .github/workflows/unittest.yml

This file was deleted.

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,6 @@ config/*
# Certs folder
certs/*.key
certs/*.pem
certs/ca/*.pem
certs/ca/*.pem

.vscode
2 changes: 0 additions & 2 deletions .pylintrc

This file was deleted.

13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## [0.3.3] - 2025-05-30
### Added
- Change pylint to flake8
- Black scan
- Build and release python package

## [0.3.2] - 2025-05-13
### Added
- Proxy chaining
- List of authorized IPs
## Patch
- Boolean in config ini

## [0.3.1] - 2025-04-26
### Added
- Add slim image
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ Whether you're fixing bugs, writing tests, or improving documentation, all contr
## ✅ Development Guidelines

- Follow [PEP8](https://peps.python.org/pep-0008/) coding style.
- We use **pylint** to ensure code quality:
- We use **flake8** to ensure code quality:
```bash
pylint $(find . -name "*.py" | xargs)
flake8 pyproxy tests benchmark
```
- Tests are written using **unittest**. To run all tests:
```bash
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ WORKDIR /app
COPY --from=builder /usr/local /usr/local
COPY --from=builder /app /app
EXPOSE 8080
ENTRYPOINT ["python3", "pyproxy.py"]
ENTRYPOINT ["python3", "-m", "pyproxy.pyproxy"]
2 changes: 1 addition & 1 deletion Dockerfile.slim
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ WORKDIR /app
COPY --from=builder /usr/local /usr/local
COPY --from=builder /app /app
EXPOSE 8080
ENTRYPOINT ["python3", "pyproxy.py"]
ENTRYPOINT ["python3", "-m", "pyproxy.pyproxy"]
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@

## 📦 **Installation**

### Install from package
```bash
pip install pyproxytools
```

### Install from source
```bash
git clone https://github.com/6C656C65/pyproxy.git
Expand All @@ -60,7 +65,7 @@ You can use slim images by adding `-slim` to the end of the tags

### Start the proxy
```bash
python3 pyproxy.py
python3 -m pyproxy.pyproxy
```
The proxy will be available at: `0.0.0.0:8080`.
The access log will be available at `./logs/access.log`.
Expand Down
2 changes: 1 addition & 1 deletion benchmark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pip install -r benchmark/requirements.txt
### Start the Proxy
Before running the benchmark, ensure that **pyproxy** is running. Start the proxy by running:
```bash
python3 pyproxy.py
python3 -m pyproxy.pyproxy
```
The proxy will be available at `0.0.0.0:8080`.

Expand Down
Loading