trainingsample 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,203 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ main, develop ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ env:
10
+ CARGO_TERM_COLOR: always
11
+
12
+ jobs:
13
+ rust-tests:
14
+ name: Rust Tests
15
+ runs-on: ubuntu-latest
16
+ strategy:
17
+ matrix:
18
+ rust: [stable, beta]
19
+
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+
23
+ - name: Install FFmpeg dependencies
24
+ run: |
25
+ sudo apt-get update
26
+ sudo apt-get install -y pkg-config libavutil-dev libavformat-dev libavcodec-dev libavdevice-dev libavfilter-dev libswscale-dev libswresample-dev
27
+
28
+ - name: Install Rust toolchain
29
+ uses: dtolnay/rust-toolchain@master
30
+ with:
31
+ toolchain: ${{ matrix.rust }}
32
+ components: rustfmt, clippy
33
+
34
+ - name: Cache cargo registry
35
+ uses: actions/cache@v4
36
+ with:
37
+ path: ~/.cargo/registry
38
+ key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
39
+
40
+ - name: Cache cargo index
41
+ uses: actions/cache@v4
42
+ with:
43
+ path: ~/.cargo/git
44
+ key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
45
+
46
+ - name: Cache cargo target
47
+ uses: actions/cache@v4
48
+ with:
49
+ path: target
50
+ key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
51
+
52
+ - name: Check formatting
53
+ run: cargo fmt --all -- --check
54
+
55
+ - name: Run clippy
56
+ run: cargo clippy --all-targets --all-features -- -D warnings
57
+
58
+ - name: Run tests (no Python bindings)
59
+ run: cargo test --no-default-features --features video
60
+
61
+ - name: Compile tests (all features)
62
+ run: cargo test --all-features --no-run
63
+
64
+ python-tests:
65
+ name: Python Tests
66
+ runs-on: ubuntu-latest
67
+ strategy:
68
+ matrix:
69
+ python-version: [3.9, "3.10", "3.11", "3.12"]
70
+
71
+ steps:
72
+ - uses: actions/checkout@v4
73
+
74
+ - name: Install FFmpeg dependencies
75
+ run: |
76
+ sudo apt-get update
77
+ sudo apt-get install -y pkg-config libavutil-dev libavformat-dev libavcodec-dev libavdevice-dev libavfilter-dev libswscale-dev libswresample-dev
78
+
79
+ - name: Set up Python ${{ matrix.python-version }}
80
+ uses: actions/setup-python@v4
81
+ with:
82
+ python-version: ${{ matrix.python-version }}
83
+
84
+ - name: Install Rust toolchain
85
+ uses: dtolnay/rust-toolchain@stable
86
+
87
+ - name: Install maturin (Linux/macOS)
88
+ if: runner.os != 'Windows'
89
+ run: pip install maturin[patchelf]
90
+
91
+ - name: Install maturin (Windows)
92
+ if: runner.os == 'Windows'
93
+ run: pip install maturin
94
+
95
+ - name: Build Python package (Linux/macOS)
96
+ if: runner.os != 'Windows'
97
+ run: |
98
+ mkdir -p dist
99
+ maturin build --release --out dist
100
+
101
+ - name: Build Python package (Windows)
102
+ if: runner.os == 'Windows'
103
+ run: |
104
+ if not exist dist mkdir dist
105
+ maturin build --release --out dist
106
+
107
+ - name: Install built package (Linux/macOS)
108
+ if: runner.os != 'Windows'
109
+ run: pip install dist/*.whl
110
+
111
+ - name: Install built package (Windows)
112
+ if: runner.os == 'Windows'
113
+ shell: cmd
114
+ run: for %%f in (dist\*.whl) do pip install "%%f"
115
+
116
+ - name: Install test dependencies
117
+ run: pip install pytest pytest-benchmark numpy pillow
118
+
119
+ - name: Run Python tests
120
+ run: pytest tests/ -v
121
+
122
+ pre-commit:
123
+ name: Pre-commit hooks
124
+ runs-on: ubuntu-latest
125
+
126
+ steps:
127
+ - uses: actions/checkout@v4
128
+
129
+ - name: Install FFmpeg dependencies
130
+ run: |
131
+ sudo apt-get update
132
+ sudo apt-get install -y pkg-config libavutil-dev libavformat-dev libavcodec-dev libavdevice-dev libavfilter-dev libswscale-dev libswresample-dev
133
+
134
+ - name: Set up Python
135
+ uses: actions/setup-python@v4
136
+ with:
137
+ python-version: 3.11
138
+
139
+ - name: Install Rust toolchain
140
+ uses: dtolnay/rust-toolchain@stable
141
+ with:
142
+ components: rustfmt, clippy
143
+
144
+ - name: Install cargo-audit
145
+ run: cargo install cargo-audit
146
+
147
+ - name: Install pre-commit
148
+ run: pip install pre-commit
149
+
150
+ - name: Run pre-commit
151
+ run: pre-commit run --all-files
152
+
153
+ build-wheels:
154
+ name: Build wheels
155
+ runs-on: ${{ matrix.os }}
156
+ strategy:
157
+ matrix:
158
+ os: [ubuntu-latest, windows-latest, macos-latest]
159
+
160
+ steps:
161
+ - uses: actions/checkout@v4
162
+
163
+ - name: Install FFmpeg dependencies (Ubuntu)
164
+ if: runner.os == 'Linux'
165
+ run: |
166
+ sudo apt-get update
167
+ sudo apt-get install -y pkg-config libavutil-dev libavformat-dev libavcodec-dev libavdevice-dev libavfilter-dev libswscale-dev libswresample-dev
168
+
169
+
170
+
171
+ - name: Set up Python
172
+ uses: actions/setup-python@v4
173
+ with:
174
+ python-version: 3.11
175
+
176
+ - name: Install Rust toolchain
177
+ uses: dtolnay/rust-toolchain@stable
178
+
179
+ - name: Install maturin (Linux/macOS)
180
+ if: runner.os != 'Windows'
181
+ run: pip install maturin[patchelf]
182
+
183
+ - name: Install maturin (Windows)
184
+ if: runner.os == 'Windows'
185
+ run: pip install maturin
186
+
187
+ - name: Build wheels (Linux)
188
+ if: runner.os == 'Linux'
189
+ run: maturin build --release --out dist
190
+
191
+ - name: Build wheels (macOS - no video features)
192
+ if: runner.os == 'macOS'
193
+ run: maturin build --release --out dist --no-default-features --features python-bindings
194
+
195
+ - name: Build wheels (Windows - no video features)
196
+ if: runner.os == 'Windows'
197
+ run: maturin build --release --out dist --no-default-features --features python-bindings
198
+
199
+ - name: Upload wheels
200
+ uses: actions/upload-artifact@v4
201
+ with:
202
+ name: wheels-${{ matrix.os }}
203
+ path: dist/
@@ -0,0 +1,123 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ jobs:
9
+ linux:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ target: [x86_64]
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-python@v5
17
+ with:
18
+ python-version: '3.11'
19
+
20
+ - name: Install FFmpeg dependencies
21
+ run: |
22
+ sudo apt-get update
23
+ sudo apt-get install -y pkg-config libavutil-dev libavformat-dev libavcodec-dev libavdevice-dev libavfilter-dev libswscale-dev libswresample-dev
24
+
25
+ - name: Build wheels
26
+ uses: PyO3/maturin-action@v1
27
+ with:
28
+ target: ${{ matrix.target }}
29
+ args: --release --out dist --find-interpreter --zig
30
+ sccache: 'true'
31
+ manylinux: auto
32
+ env:
33
+ # Use stable ABI for forward compatibility
34
+ PYO3_USE_ABI3_FORWARD_COMPATIBILITY: '1'
35
+
36
+ - name: Upload wheels
37
+ uses: actions/upload-artifact@v4
38
+ with:
39
+ name: wheels-linux-${{ matrix.target }}
40
+ path: dist
41
+
42
+ windows:
43
+ runs-on: windows-latest
44
+ strategy:
45
+ matrix:
46
+ target: [x64]
47
+ steps:
48
+ - uses: actions/checkout@v4
49
+ - uses: actions/setup-python@v5
50
+ with:
51
+ python-version: '3.11'
52
+ architecture: ${{ matrix.target }}
53
+ - name: Build wheels
54
+ uses: PyO3/maturin-action@v1
55
+ with:
56
+ target: ${{ matrix.target }}
57
+ args: --release --out dist --find-interpreter --no-default-features --features python-bindings
58
+ sccache: 'true'
59
+ env:
60
+ # Use stable ABI for forward compatibility
61
+ PYO3_USE_ABI3_FORWARD_COMPATIBILITY: '1'
62
+ - name: Upload wheels
63
+ uses: actions/upload-artifact@v4
64
+ with:
65
+ name: wheels-windows-${{ matrix.target }}
66
+ path: dist
67
+
68
+ macos:
69
+ runs-on: macos-latest
70
+ strategy:
71
+ matrix:
72
+ target: [aarch64]
73
+ steps:
74
+ - uses: actions/checkout@v4
75
+ - uses: actions/setup-python@v5
76
+ with:
77
+ python-version: '3.11'
78
+
79
+ - name: Build wheels
80
+ uses: PyO3/maturin-action@v1
81
+ with:
82
+ target: ${{ matrix.target }}
83
+ args: --release --out dist --find-interpreter --no-default-features --features python-bindings
84
+ sccache: 'true'
85
+ env:
86
+ # Use stable ABI for forward compatibility
87
+ PYO3_USE_ABI3_FORWARD_COMPATIBILITY: '1'
88
+ - name: Upload wheels
89
+ uses: actions/upload-artifact@v4
90
+ with:
91
+ name: wheels-macos-${{ matrix.target }}
92
+ path: dist
93
+
94
+ sdist:
95
+ runs-on: ubuntu-latest
96
+ steps:
97
+ - uses: actions/checkout@v4
98
+ - name: Build sdist
99
+ uses: PyO3/maturin-action@v1
100
+ with:
101
+ command: sdist
102
+ args: --out dist
103
+ - name: Upload sdist
104
+ uses: actions/upload-artifact@v4
105
+ with:
106
+ name: wheels-sdist
107
+ path: dist
108
+
109
+ release:
110
+ name: Release
111
+ runs-on: ubuntu-latest
112
+ needs: [linux, windows, macos, sdist]
113
+ steps:
114
+ - uses: actions/download-artifact@v4
115
+ with:
116
+ pattern: wheels-*
117
+ merge-multiple: true
118
+ path: dist
119
+ - name: Publish to PyPI
120
+ uses: pypa/gh-action-pypi-publish@v1.12.4
121
+ with:
122
+ user: __token__
123
+ password: ${{ secrets.PYPI_API_TOKEN }}
@@ -0,0 +1,80 @@
1
+ *.code-workspace
2
+ multidatabackend*json
3
+ # Python and virtual environment files
4
+ output/
5
+ temp/
6
+ env.sh
7
+ *.pem
8
+ */config/config.json
9
+ user_prompt_library.json
10
+ __pycache__/
11
+ .venv/
12
+ cache/
13
+ *.pyc
14
+ *.pyo
15
+ *.pyd
16
+ *.pyc
17
+ *.pyo
18
+ *.pyd
19
+ *.so
20
+ *.dylib
21
+ *.egg-info/
22
+ dist/
23
+ build/
24
+ *.egg
25
+ *.pyc
26
+ *.pyo
27
+ *.pyd
28
+ *.so
29
+ *.dylib
30
+ *.egg-info/
31
+ dist/
32
+ build/
33
+ *.egg
34
+ venv/
35
+ *.log
36
+
37
+ # IDE files
38
+ .vscode/
39
+ .idea/
40
+ *.swp
41
+ *.swo
42
+ *.swn
43
+
44
+ # OS generated files
45
+ .DS_Store
46
+ Thumbs.db
47
+
48
+ # Rust generated files
49
+ target/
50
+ Cargo.lock
51
+
52
+ files.tbz
53
+ */config/auth.json
54
+ work
55
+ multidatabackend.json
56
+ multidatabackend_sd2x.json
57
+
58
+ config/*.json
59
+ config/*.env
60
+ wandb/
61
+ cache/
62
+ vae_cache/
63
+ vendor/
64
+ inference/
65
+ webhooks.json
66
+ untracked/
67
+ config/*/
68
+ config/*.toml
69
+ static
70
+ templates
71
+ api_state.json
72
+ images/
73
+ datasets/
74
+ .test_runner_state
75
+ .test_runner_state.json
76
+ checkpoints/
77
+ config/
78
+ webshart_cache/
79
+ poetry.lock
80
+ poetry.lock
@@ -0,0 +1,91 @@
1
+ repos:
2
+ # Rust formatting and linting
3
+ - repo: https://github.com/doublify/pre-commit-rust
4
+ rev: v1.0
5
+ hooks:
6
+ - id: fmt
7
+ name: Rust format
8
+ description: Format Rust code with rustfmt
9
+ entry: cargo fmt
10
+ language: system
11
+ files: \.rs$
12
+ pass_filenames: false
13
+ - id: cargo-check
14
+ name: Rust check
15
+ description: Check Rust code with cargo check
16
+ entry: cargo check --all-targets --all-features
17
+ language: system
18
+ files: \.rs$
19
+ pass_filenames: false
20
+ - id: clippy
21
+ name: Rust clippy
22
+ description: Lint Rust code with clippy
23
+ entry: cargo clippy --all-targets --all-features
24
+ language: system
25
+ files: \.rs$
26
+ pass_filenames: false
27
+
28
+ # Python formatting and linting
29
+ - repo: https://github.com/psf/black
30
+ rev: 25.1.0
31
+ hooks:
32
+ - id: black
33
+ language_version: python3
34
+ files: \.py$
35
+
36
+ - repo: https://github.com/pycqa/isort
37
+ rev: 6.0.1
38
+ hooks:
39
+ - id: isort
40
+ args: ["--profile", "black"]
41
+ files: \.py$
42
+
43
+ - repo: https://github.com/pycqa/flake8
44
+ rev: 7.3.0
45
+ hooks:
46
+ - id: flake8
47
+ args: ["--max-line-length=88", "--extend-ignore=E203,W503"]
48
+ files: \.py$
49
+
50
+ # TOML formatting
51
+ - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
52
+ rev: v2.15.0
53
+ hooks:
54
+ - id: pretty-format-toml
55
+ args: [--autofix]
56
+
57
+ # General hooks
58
+ - repo: https://github.com/pre-commit/pre-commit-hooks
59
+ rev: v6.0.0
60
+ hooks:
61
+ - id: trailing-whitespace
62
+ - id: end-of-file-fixer
63
+ - id: check-yaml
64
+ - id: check-toml
65
+ - id: check-merge-conflict
66
+ - id: check-added-large-files
67
+ args: ['--maxkb=1000']
68
+
69
+ # Rust tests
70
+ - repo: local
71
+ hooks:
72
+ - id: rust-test
73
+ name: Rust tests
74
+ description: Run Rust tests
75
+ entry: cargo test --features video
76
+ language: system
77
+ files: \.rs$
78
+ pass_filenames: false
79
+ stages: [pre-commit]
80
+
81
+ # Python tests (when bindings are built)
82
+ - repo: local
83
+ hooks:
84
+ - id: python-test
85
+ name: Python tests
86
+ description: Run Python tests
87
+ entry: bash -c 'if [ -d "target/wheels" ] || python -c "import trainingsample" 2>/dev/null; then pytest tests/ -v -m "not slow" -x; else echo "Python bindings not built, skipping Python tests"; fi'
88
+ language: system
89
+ files: \.(py|rs)$
90
+ pass_filenames: false
91
+ stages: [pre-commit]
@@ -0,0 +1,13 @@
1
+ edition = "2021"
2
+ force_explicit_abi = true
3
+ hard_tabs = false
4
+ max_width = 100
5
+ merge_derives = true
6
+ newline_style = "Unix"
7
+ remove_nested_parens = true
8
+ reorder_imports = true
9
+ reorder_modules = true
10
+ tab_spaces = 4
11
+ use_field_init_shorthand = false
12
+ use_small_heuristics = "Default"
13
+ use_try_shorthand = false