Skip to content

Commit ef293a1

Browse files
committed
migrate to uv and modern package structure
1 parent 916153a commit ef293a1

26 files changed

Lines changed: 581 additions & 192 deletions

.github/workflows/python-package.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ jobs:
1919
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
2020

2121
steps:
22-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@v3
2325
- name: Set up Python ${{ matrix.python-version }}
24-
uses: actions/setup-python@v4
25-
with:
26-
python-version: ${{ matrix.python-version }}
26+
run: uv python install ${{ matrix.python-version }}
2727
- name: Cache ffmpeg download
28-
uses: actions/cache@v3
28+
uses: actions/cache@v4
2929
id: cache-ffmpeg
3030
with:
3131
path: /opt/ffmpeg/ffmpeg-n${{ env.FFMPEG_VERSION }}-latest-linux64-gpl-${{ env.FFMPEG_VERSION }}.tar.xz
@@ -45,13 +45,14 @@ jobs:
4545
sudo cp /opt/ffmpeg/extracted/bin/ffprobe /usr/bin/ffprobe
4646
- name: Install dependencies
4747
run: |
48-
python -m pip install --upgrade pip
49-
pip install -r requirements.txt
50-
pip install -r requirements.dev.txt
51-
pip install .
48+
uv sync --group dev
49+
- name: Lint with ruff
50+
run: |
51+
uv run ruff check .
52+
uv run ruff format --check .
5253
- name: Type check with mypy
5354
run: |
54-
mypy ffmpeg_normalize
55+
uv run mypy .
5556
- name: Test with pytest
5657
run: |
57-
pytest
58+
uv run pytest tests/

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.12.11
4+
hooks:
5+
- id: ruff
6+
args: [--fix]
7+
- id: ruff-format

CLAUDE.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ ffmpeg-normalize is a Python utility for audio normalization using ffmpeg. It su
99
## Development Commands
1010

1111
### Testing
12-
- `pytest` - Run all tests (requires installing requirements.dev.txt)
13-
- `python -m ffmpeg_normalize [args]` - Run the tool directly for testing
12+
- `uv run pytest` - Run all tests
13+
- `uv run python -m ffmpeg_normalize [args]` - Run the tool directly for testing
1414

1515
### Code Quality
16-
- `ruff` - Linting and code formatting
17-
- `mypy` - Type checking
16+
- `uv run ruff check .` - Linting
17+
- `uv run ruff format .` - Code formatting
18+
- `uv run mypy src/ffmpeg_normalize` - Type checking
1819

1920
### Installation
20-
- `pip install -r requirements.txt` - Install runtime dependencies
21-
- `pip install -r requirements.dev.txt` - Install development dependencies
21+
- `uv sync --dev` - Install all dependencies (runtime and development)
2222

2323
### Documentation
2424
- `pdoc -d google -o docs-api ./ffmpeg_normalize` - Generate API documentation
@@ -56,7 +56,7 @@ The project uses:
5656
- `colorama` (Windows only) for colored terminal output
5757

5858
### File Structure
59-
- `ffmpeg_normalize/` - Main package directory
59+
- `src/ffmpeg_normalize/` - Main package directory
6060
- `tests/` - Test files and test media samples
6161
- `docs/` - MKdocs documentation source
6262
- `completions/` - Shell completion scripts

DEVELOPERS.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44

55
Tests are located in `tests/test_*.py`. To run them:
66

7-
- Install `requirements.txt` and `requirements.dev.txt`
8-
- Run `pytest`
7+
- Install `uv` (see [installation guide](https://github.com/astral-sh/uv#installation))
8+
- Run `uv sync --dev` to install all dependencies
9+
- Run `uv run pytest` to run the tests
910

1011
## Creating API Docs
1112

1213
```bash
13-
pdoc -d google -o docs-api ./ffmpeg_normalize
14+
pdoc -d google -o docs-api ./src/ffmpeg_normalize
1415
```
1516

1617
## Creating MKdocs Releases

LICENSE

Lines changed: 0 additions & 21 deletions
This file was deleted.

LICENSE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# License
2+
3+
ffmpeg-normalize, Copyright (c) Werner Robitza
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 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.

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ This program normalizes media files to a certain loudness level using the EBU R1
2424
## 🚀 Quick Start
2525

2626
1. Install a recent version of [ffmpeg](https://ffmpeg.org/download.html)
27-
2. Run `pip3 install ffmpeg-normalize`
28-
3. Run `ffmpeg-normalize /path/to/your/file.mp4`
29-
4. Done! 🎧 (the normalized file will be called `normalized/file.mkv`)
27+
2. Run `pip3 install ffmpeg-normalize` and `ffmpeg-normalize /path/to/your/file.mp4`, alternatively install [`uv`](https://docs.astral.sh/uv/getting-started/installation/) and run `uvx ffmpeg-normalize /path/to/your/file.mp4`
28+
3. Done! 🎧 (the normalized file will be called `normalized/file.mkv`)
3029

3130
## 📓 Documentation
3231

docs/getting-started/installation.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,36 @@
11
# Installation
22

3-
## Python Package
3+
## Via `uv` (recommended)
44

5-
For Python 3 and pip:
5+
Install `uv` from [their website](https://docs.astral.sh/uv/getting-started/installation/).
6+
7+
Then run:
8+
9+
```bash
10+
uvx ffmpeg-normalize
11+
```
12+
13+
That's it.
14+
15+
## Via `pipx`
16+
17+
Install `pipx` from [their website](https://pipx.pypa.io/latest/installation/).
18+
19+
Then run:
620

721
```bash
8-
pip3 install ffmpeg-normalize
22+
pipx install ffmpeg-normalize
923
```
1024

11-
Or download this repository, then run `pip3 install .`.
25+
## Via `pip`
26+
27+
For Python 3 and pip:
28+
29+
```bash
30+
pip3 install --user ffmpeg-normalize
31+
```
1232

13-
To later upgrade to the latest version, run `pip3 install --upgrade ffmpeg-normalize`.
33+
To later upgrade to the latest version, run `pip3 install --upgrade --user ffmpeg-normalize`.
1434

1535
## Shell Completions
1636

ffmpeg_normalize/_version.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

pyproject.toml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
[build-system]
2+
requires = ["uv_build>=0.8.14,<0.9.0"]
3+
build-backend = "uv_build"
4+
5+
[project]
6+
name = "ffmpeg-normalize"
7+
version = "1.33.0"
8+
description = "Normalize audio via ffmpeg"
9+
readme = "README.md"
10+
license = "MIT"
11+
license-files = ["LICENSE.md"]
12+
authors = [
13+
{name = "Werner Robitza", email = "werner.robitza@gmail.com"}
14+
]
15+
keywords = ["ffmpeg", "normalize", "audio"]
16+
classifiers = [
17+
"Development Status :: 5 - Production/Stable",
18+
"Intended Audience :: Developers",
19+
"Topic :: Multimedia :: Sound/Audio",
20+
"Topic :: Multimedia :: Sound/Audio :: Analysis",
21+
"Topic :: Multimedia :: Sound/Audio :: Conversion",
22+
"License :: OSI Approved :: MIT License",
23+
"Natural Language :: English",
24+
"Programming Language :: Python :: 3",
25+
"Programming Language :: Python :: 3.9",
26+
"Programming Language :: Python :: 3.10",
27+
"Programming Language :: Python :: 3.11",
28+
"Programming Language :: Python :: 3.12",
29+
"Programming Language :: Python :: 3.13",
30+
]
31+
requires-python = ">=3.9"
32+
dependencies = [
33+
"tqdm>=4.64.1",
34+
"colorama>=0.4.6; platform_system=='Windows'",
35+
"ffmpeg-progress-yield>=1.0.1",
36+
"colorlog==6.7.0",
37+
"mutagen>=1.47.0",
38+
]
39+
40+
[project.urls]
41+
Homepage = "https://github.com/slhck/ffmpeg-normalize"
42+
Repository = "https://github.com/slhck/ffmpeg-normalize"
43+
44+
[project.scripts]
45+
ffmpeg-normalize = "ffmpeg_normalize.__main__:main"
46+
47+
[tool.uv_build]
48+
src-layout = true
49+
50+
[dependency-groups]
51+
dev = [
52+
"pytest>=8.1.1,<9",
53+
"ruff>=0.12.11",
54+
"mypy>=1.0.0",
55+
"types-tqdm",
56+
]
57+
58+
[tool.mypy]
59+
python_version = "3.13"
60+
ignore_missing_imports = true
61+
exclude = ["build"]
62+
namespace_packages = false
63+
no_implicit_optional = true
64+
check_untyped_defs = true
65+
warn_return_any = true
66+
warn_unused_ignores = true
67+
show_error_codes = true

0 commit comments

Comments
 (0)