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
2 changes: 0 additions & 2 deletions .github/FUNDING.yml

This file was deleted.

24 changes: 12 additions & 12 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
- package-ecosystem: npm
directory: "/"
schedule:
interval: weekly
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
- package-ecosystem: npm
directory: "/"
schedule:
interval: weekly
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
127 changes: 18 additions & 109 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
name: CI

on:
push:
branches:
- main
pull_request:

jobs:

dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
- uses: astral-sh/setup-uv@v7
- run: uvx --from build pyproject-build --sdist --wheel
- run: uvx twine check dist/*
- uses: actions/upload-artifact@v6
with:
python-version: "3.x"
- run: python -m pip install --upgrade pip build wheel twine
- run: python -m build --sdist --wheel
- run: python -m twine check dist/*

path: dist/*
js-lint:
runs-on: ubuntu-latest
steps:
Expand All @@ -29,8 +25,6 @@ jobs:
- name: Install Node dependencies
run: npm ci
- run: npm run lint:js


js-test:
runs-on: ubuntu-latest
needs:
Expand All @@ -48,30 +42,8 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
flags: javascript
file: lcov.txt

py-lint:
runs-on: ubuntu-latest
strategy:
matrix:
lint-command:
- bandit -r . -x ./tests
- black --check --diff .
- flake8 .
- isort --check-only --diff .
- pydocstyle .
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.x"
cache: 'pip'
cache-dependency-path: 'linter-requirements.txt'
- run: python -m pip install -r linter-requirements.txt
- run: ${{ matrix.lint-command }}

pytest:
needs:
- py-lint
- dist
runs-on: ubuntu-latest
strategy:
Expand All @@ -85,91 +57,28 @@ jobs:
- "5.0"
- "5.1"
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Install Chrome
run: |
sudo apt update
sudo apt install -y google-chrome-stable
- name: Install Selenium
run: |
mkdir bin
curl -qO "https://chromedriver.storage.googleapis.com/$(curl -q https://chromedriver.storage.googleapis.com/LATEST_RELEASE)/chromedriver_linux64.zip"
unzip chromedriver_linux64.zip -d bin

- run: python -m pip install .[test]
- run: python -m pip install django~=${{ matrix.django-version }}.0
- run: python -m pytest -m "not selenium"
env:
PATH: $PATH:$(pwd)/bin
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: python


- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The checkout action version is inconsistent. Line 61 uses actions/checkout@v5 while line 11 uses actions/checkout@v6. Both instances should use the same version for consistency.

Copilot uses AI. Check for mistakes.
with:
python-version: ${{ matrix.python-version }}
- run: uv run --with django~=${{ matrix.django-version }}.0 pytest -m "not selenium"
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: python
selenium:
needs:
- pytest
strategy:
matrix:
python-version:
- "3.x"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Chrome
run: sudo apt-get install -y google-chrome-stable
- name: Install Selenium
run: |
mkdir bin
curl -O https://chromedriver.storage.googleapis.com/`curl -s https://chromedriver.storage.googleapis.com/LATEST_RELEASE`/chromedriver_linux64.zip
unzip chromedriver_linux64.zip -d bin
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- run: python -m pip install -e .[test]
- run: python -m pytest -m selenium
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb || sudo apt-get -f install -y
- uses: astral-sh/setup-uv@v7
- run: uv run pytest -m selenium
- uses: codecov/codecov-action@v5
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Django version specification for the selenium job. The pytest job on line 74 includes --with django~=${{ matrix.django-version }}.0 but the selenium job on line 101 is missing this specification. This could lead to inconsistent test environments between the two jobs.

Copilot uses AI. Check for mistakes.
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: selenium


analyze:
name: CodeQL Analyze
needs:
- pytest
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ javascript, python ]

steps:
- name: Checkout
uses: actions/checkout@v6

- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
queries: +security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v4
if: ${{ matrix.language == 'javascript' || matrix.language == 'python' }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{ matrix.language }}"
40 changes: 21 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
name: Release

on:
release:
types: [published]

workflow_dispatch:
jobs:
PyPi:

pypi-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.x"
- run: python -m pip install --upgrade pip build wheel twine
- uses: actions/setup-node@v6
- name: Install Node dependencies
run: npm ci
- name: Minify JavaScript files
run: npm run minify
- run: python -m build --sdist --wheel
- run: python -m twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- run: uvx --from build pyproject-build --sdist --wheel
- uses: actions/upload-artifact@v6
with:
name: release-dists
path: dist/
pypi-publish:
runs-on: ubuntu-latest
needs:
- pypi-build
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v7
with:
name: release-dists
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,6 @@ target/
node_modules

*.min.js

# uv
uv.lock
45 changes: 45 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: check-merge-conflict
- id: check-ast
- id: check-toml
- id: check-yaml
- id: check-symlinks
- id: debug-statements
- id: end-of-file-fixer
- id: no-commit-to-branch
args: [--branch, main]
- repo: https://github.com/asottile/pyupgrade
rev: v3.21.2
hooks:
- id: pyupgrade
- repo: https://github.com/adamchainz/django-upgrade
rev: 1.29.1
hooks:
- id: django-upgrade
- repo: https://github.com/hukkin/mdformat
rev: 1.0.0
hooks:
- id: mdformat
additional_dependencies:
- mdformat-ruff
- mdformat-footnote
- mdformat-gfm
- mdformat-gfm-alerts
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.9
hooks:
- id: ruff-check
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/google/yamlfmt
rev: v0.20.0
hooks:
- id: yamlfmt
ci:
autoupdate_schedule: weekly
skip:
- no-commit-to-branch
1 change: 0 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

4 changes: 0 additions & 4 deletions MANIFEST.in

This file was deleted.

29 changes: 15 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubu

## Features

- lightweight: less 200 lines
- no JavaScript or Python dependencies (no jQuery)
- easy integration
- works just like the built-in
- extendable JavaScript API
- lightweight: less 200 lines
- no JavaScript or Python dependencies (no jQuery)
- easy integration
- works just like the built-in
- extendable JavaScript API

## For the Nerds

Expand Down Expand Up @@ -81,15 +81,15 @@ Add the S3File app and middleware in your settings:
# settings.py

INSTALLED_APPS = (
'...',
's3file',
'...',
"...",
"s3file",
"...",
)

MIDDLEWARE = (
'...',
's3file.middleware.S3FileMiddleware',
'...',
"...",
"s3file.middleware.S3FileMiddleware",
"...",
)
```

Expand Down Expand Up @@ -150,7 +150,7 @@ to `FileSystemStorage`.

To prevent users from accidentally using the `FileSystemStorage` and the
insecure S3 dummy backend in production, there is also an additional
deployment check that will error if you run Django\'s deployment check
deployment check that will error if you run Django's deployment check
suite:

```shell
Expand All @@ -177,14 +177,15 @@ uploading the file to S3 and then copying it byte-by-byte to perform a
move operation just to rename the uploaded object. For large files this
leads to additional loading times for the user.

That\'s why S3File provides an optimized version of this method at
That's why S3File provides an optimized version of this method at
`storages_optimized.S3OptimizedUploadStorage`. It uses the more
efficient `copy` method from S3, given that we know that we only copy
from one S3 location to another.

```python
from s3file.storages_optimized import S3OptimizedUploadStorage


class MyStorage(S3OptimizedUploadStorage): # Subclass and use like any other storage
default_acl = 'private'
default_acl = "private"
```
Loading
Loading