Skip to content

Commit 4456a75

Browse files
authored
Merge pull request #362 from justjanne/refactor-imports
Modernize build setup & tests
2 parents 5aac0dd + 88f446e commit 4456a75

File tree

90 files changed

+1176
-786
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+1176
-786
lines changed

.github/workflows/test.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Test
2+
3+
on: [push]
4+
5+
env:
6+
REGISTRY: ghcr.io
7+
IMAGE_NAME: ${{ github.repository }}
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Install uv
15+
uses: astral-sh/setup-uv@v5
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version-file: "pyproject.toml"
20+
- name: Install the project
21+
run: uv sync --dev
22+
- name: Run tests
23+
run: uv run pytest
24+
docker:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
- name: Build and push Docker image
30+
id: push
31+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
32+
with:
33+
context: .
34+
push: false

.python-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.6.9
1+
>=3.11

Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM ubuntu:22.04
2+
3+
RUN apt-get update \
4+
&& apt-get install -y --no-install-recommends \
5+
ffmpeg \
6+
gir1.2-gstreamer-1.0 \
7+
gir1.2-gst-plugins-base-1.0 \
8+
libgstreamer1.0-0 \
9+
gstreamer1.0-libav \
10+
gstreamer1.0-plugins-bad \
11+
gstreamer1.0-plugins-base \
12+
gstreamer1.0-plugins-good \
13+
gstreamer1.0-plugins-ugly \
14+
gstreamer1.0-tools \
15+
python3 \
16+
python3-gi \
17+
python3-pip \
18+
&& rm -rf /var/lib/apt/lists/*
19+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
20+
21+
ADD . /voctomix
22+
WORKDIR /voctomix
23+
RUN uv pip install --system --requirements pyproject.toml
24+
ENTRYPOINT ["python3", "-m", "voctocore"]

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,20 @@ We support all python versions between "latest stable" and "available in
66
debian stable". Older python versions might work, but we don't test on
77
those.
88

9+
## Developer Setup
10+
11+
```bash
12+
uv venv --system-site-packages
13+
uv sync
14+
uv pip install pygobject-stubs --config-settings=config=Gtk3
15+
```
16+
17+
## Tests
18+
19+
```bash
20+
uv run pytest
21+
```
22+
923
## Current Documentation
1024

1125
- [Core](https://github.com/voc/voctomix/tree/voctomix2/voctocore)

example-scripts/gstreamer/ingest.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
Gst.init([])
2727

2828
# this is to use the same code tha gui uses to get config from core
29-
sys.path.insert(0, '../..')
30-
sys.path.insert(0, '.')
31-
3229
import voctogui.lib.connection as Connection
3330

3431

pyproject.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[project]
2+
name = "voctomix"
3+
version = "0.1.0"
4+
description = "voctomix is a video mixing software, written in python."
5+
readme = "README.md"
6+
requires-python = ">=3.11"
7+
dependencies = [
8+
"scipy>=1.15.2",
9+
"sdnotify>=0.3.2",
10+
]
11+
12+
[dependency-groups]
13+
dev = [
14+
"mock>=5.2.0",
15+
"pytest>=8.3.5",
16+
"pygobject-stubs>=2.13.0",
17+
]
18+
19+
[tool.uv]
20+
python-preference = "only-system"
21+
22+
[tool.pytest.ini_options]
23+
testpaths = [
24+
"voctocore/tests",
25+
"voctogui/tests",
26+
]

uv.lock

Lines changed: 198 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vocto/audio_codecs.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import logging
44
import sys
55

6-
from lib.config import Config
76
from gi.repository import Gst
87

98
gi.require_version('GstController', '1.0')
@@ -50,13 +49,13 @@ def create_mixmatrix(in_channels: int, out_channels: int, channel_mapping: str):
5049
return pipeline
5150

5251

53-
def construct_audio_encoder_pipeline(section):
52+
def construct_audio_encoder_pipeline(config, section):
5453
"""
5554
Build audio encoder pipeline block including an adapter matrix for channel mapping
5655
:param section: Name of the config section this block is for
5756
:return: String containing the pipeline block
5857
"""
59-
encoder = Config.get_audio_encoder(section)
58+
encoder = config.get_audio_encoder(section)
6059
encoder_options = None
6160
# check if we have an option string as part of the codec config
6261
if ',' in encoder:
@@ -66,11 +65,11 @@ def construct_audio_encoder_pipeline(section):
6665
if encoder in encoders:
6766
pipeline += """! audioconvert
6867
{mixmatrix} ! {encoder} ! {acaps}
69-
""".format(mixmatrix=create_mixmatrix(Config.getAudioChannels(),
70-
Config.get_sink_audio_channels(section),
71-
Config.get_sink_audio_map(section)),
68+
""".format(mixmatrix=create_mixmatrix(config.getAudioChannels(),
69+
config.get_sink_audio_channels(section),
70+
config.get_sink_audio_map(section)),
7271
encoder=encoder,
73-
acaps=Config.getAudioCaps(section))
72+
acaps=config.getAudioCaps(section))
7473
else:
7574
log.error("Unknown audio encoder {}".format(encoder))
7675
sys.exit(-1)

vocto/composite_commands.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ def from_str(command):
1414
B = None
1515
# match case: c(A,B)
1616
r = re.match(
17-
r'^\s*([|+-]?\w[-_\w]*)\s*\(\s*([-_\w*]+)\s*,\s*([-_\w*]+)\)\s*$', command)
17+
r'^\s*([|+-]?[-_\w*]+)\s*\(\s*([-_\w*]+)\s*,\s*([-_\w*]+)\)\s*$', command)
1818
if r:
1919
A = r.group(2)
2020
B = r.group(3)
2121
else:
2222
# match case: c(A)
23-
r = re.match(r'^\s*([|+-]?\w[-_\w]*)\s*\(\s*([-_\w*]+)\s*\)\s*$', command)
23+
r = re.match(r'^\s*([|+-]?[-_\w*]+)\s*\(\s*([-_\w*]+)\s*\)\s*$', command)
2424
if r:
2525
A = r.group(2)
2626
else:
2727
# match case: c
28-
r = re.match(r'^\s*([|+-]?\w[-_\w]*)\s*$', command)
28+
r = re.match(r'^\s*([|+-]?[-_\w*]+)\s*$', command)
2929
assert r
3030
composite = r.group(1)
3131
if composite == '*':

vocto/config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from configparser import ConfigParser
66

77
from gi.repository import Gst
8-
from lib.args import Args
98

109
from vocto import kind_has_audio, kind_has_video
1110
from vocto.audio_streams import AudioStreams

0 commit comments

Comments
 (0)