Skip to content

Commit 2fe701e

Browse files
committed
initial commit
0 parents  commit 2fe701e

27 files changed

+1423
-0
lines changed

.cursorrules

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<code_style>
2+
When generating or modifying Python code:
3+
4+
1. Follow PEP 8 style guidelines
5+
2. Use consistent import ordering:
6+
- Standard library imports first
7+
- Third-party imports second
8+
- Local imports third
9+
- Within each group, use alphabetical ordering
10+
3. Add trailing commas in multi-line collections
11+
4. Use type hints consistently
12+
5. Follow numpy-style docstring conventions
13+
6. Place imports at the top of the file, never after code
14+
7. Avoid unused imports or variables
15+
8. Use Path from pathlib instead of os.path operations
16+
9. Add leading underscore to unused fixture parameters
17+
10. Use descriptive variable names
18+
11. Keep line length under 88 characters (same as Black)
19+
12. Don't touch code that is not in the focus for what the user wants from you
20+
13. Don't remove code that is unrelated to the change you are doing right now
21+
</code_style>
22+
23+
<testing>
24+
When writing tests:
25+
1. Use pytest fixtures appropriately
26+
2. Mock external dependencies
27+
3. Use descriptive test names with test_ prefix
28+
4. Group related tests in classes with Test prefix
29+
5. Add docstrings to all test functions and classes
30+
6. Use proper assertion messages
31+
7. Handle both success and error cases
32+
8. Mock file operations and external APIs
33+
</testing>
34+
35+
<commit_style>
36+
When writing Git commit messages:
37+
38+
1. Follow single-line format with Angular convention:
39+
- Format: `<type>[optional scope]: <description1>; <description2>; <description3>`
40+
- Types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`
41+
- Scope: Optional, indicates affected codebase area (e.g., `ui`, `api`)
42+
- Multiple changes are separated by semicolons
43+
2. Keep each description concise and in imperative mood
44+
3. For breaking changes, prefix with `BREAKING CHANGE:`
45+
4. Examples:
46+
- `feat(api): add login endpoint; update auth flow; add rate limiting`
47+
- `fix(ui): fix button alignment; update color scheme`
48+
- `docs: update readme; add contributing guide`
49+
5. Keep messages clear and meaningful
50+
</commit_style>

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# UploadThing
2+
UPLOAUPLOADTHING_API_KEY=your-token-here

.github/CODE_OF_CONDUCT.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
- Demonstrating empathy and kindness toward other people
21+
- Being respectful of differing opinions, viewpoints, and experiences
22+
- Giving and gracefully accepting constructive feedback
23+
- Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
- Focusing on what is best not just for us as individuals, but for the
26+
overall community
27+
28+
Examples of unacceptable behavior include:
29+
30+
- The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
- Trolling, insulting or derogatory comments, and personal or political attacks
33+
- Public or private harassment
34+
- Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
- Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at RunPod.
63+
All complaints will be reviewed and investigated promptly and fairly.
64+
65+
All community leaders are obligated to respect the privacy and security of the
66+
reporter of any incident.
67+
68+
## Enforcement Guidelines
69+
70+
Community leaders will follow these Community Impact Guidelines in determining
71+
the consequences for any action they deem in violation of this Code of Conduct:
72+
73+
### 1. Correction
74+
75+
**Community Impact**: Use of inappropriate language or other behavior deemed
76+
unprofessional or unwelcome in the community.
77+
78+
**Consequence**: A private, written warning from community leaders, providing
79+
clarity around the nature of the violation and an explanation of why the
80+
behavior was inappropriate. A public apology may be requested.
81+
82+
### 2. Warning
83+
84+
**Community Impact**: A violation through a single incident or series
85+
of actions.
86+
87+
**Consequence**: A warning with consequences for continued behavior. No
88+
interaction with the people involved, including unsolicited interaction with
89+
those enforcing the Code of Conduct, for a specified period of time. This
90+
includes avoiding interactions in community spaces as well as external channels
91+
like social media. Violating these terms may lead to a temporary or
92+
permanent ban.
93+
94+
### 3. Temporary Ban
95+
96+
**Community Impact**: A serious violation of community standards, including
97+
sustained inappropriate behavior.
98+
99+
**Consequence**: A temporary ban from any sort of interaction or public
100+
communication with the community for a specified period of time. No public or
101+
private interaction with the people involved, including unsolicited interaction
102+
with those enforcing the Code of Conduct, is allowed during this period.
103+
Violating these terms may lead to a permanent ban.
104+
105+
### 4. Permanent Ban
106+
107+
**Community Impact**: Demonstrating a pattern of violation of community
108+
standards, including sustained inappropriate behavior, harassment of an
109+
individual, or aggression toward or disparagement of classes of individuals.
110+
111+
**Consequence**: A permanent ban from any sort of public interaction within
112+
the community.
113+
114+
## Attribution
115+
116+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
117+
version 2.0, available at
118+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
119+
120+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
121+
enforcement ladder](https://github.com/mozilla/diversity).
122+
123+
[homepage]: https://www.contributor-covenant.org
124+
125+
For answers to common questions about this code of conduct, see the FAQ at
126+
https://www.contributor-covenant.org/faq. Translations are available at
127+
https://www.contributor-covenant.org/translations.

.github/CONTRIBUTING.md

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# Contributing to worker-mochi
2+
3+
Thank you for your interest in contributing to worker-mochi! This document provides guidelines and instructions for contributing.
4+
5+
## Prerequisites
6+
7+
- Python 3.10 or higher
8+
- CUDA-compatible GPU
9+
- Docker (for container builds)
10+
11+
## Development Setup
12+
13+
1. Fork and clone the repository:
14+
15+
```bash
16+
git clone https://github.com/runpod-workers/worker-mochi.git
17+
cd worker-mochi
18+
```
19+
20+
2. Create a virtual environment:
21+
22+
```bash
23+
python -m venv venv
24+
source venv/bin/activate # On Windows: venv\Scripts\activate
25+
```
26+
27+
3. Install development dependencies:
28+
29+
```bash
30+
pip install -r requirements-dev.txt
31+
```
32+
33+
4. Set up environment variables:
34+
```bash
35+
# Create a .env file with:
36+
UPLOADTHING_API_KEY=your_api_key_here # Get this from UploadThing dashboard
37+
```
38+
39+
## Storage Configuration
40+
41+
We use UploadThing for video storage and delivery:
42+
43+
- Fast CDN delivery worldwide
44+
- Reliable upload with retry mechanism
45+
- Direct file URLs for easy integration
46+
- Automatic video format handling
47+
48+
## Code Quality
49+
50+
We use ruff for code quality. Before submitting a PR, ensure your code:
51+
52+
1. Passes all ruff checks:
53+
```bash
54+
ruff check .
55+
```
56+
2. Is properly formatted:
57+
```bash
58+
ruff format .
59+
```
60+
61+
### VSCode Integration
62+
63+
Install the ruff extension for VSCode for real-time linting and formatting.
64+
65+
## Testing
66+
67+
### Running Tests
68+
69+
Run all tests:
70+
71+
```bash
72+
pytest
73+
```
74+
75+
Run specific test categories:
76+
77+
```bash
78+
# Run UploadThing integration tests
79+
pytest tests/test_blob_storage.py::test_upload_file_to_uploadthing_real -v
80+
81+
# Run unit tests only
82+
pytest tests/ -m "not integration"
83+
```
84+
85+
### Writing Tests
86+
87+
1. Place tests in the `tests/` directory
88+
2. Name test files with `test_` prefix
89+
3. Name test functions with `test_` prefix
90+
4. Use descriptive test names
91+
5. Include both success and failure cases
92+
6. Mock external services when appropriate
93+
94+
### Testing UploadThing Integration
95+
96+
When writing tests that involve UploadThing:
97+
98+
1. Use the provided mock fixtures for unit tests
99+
2. Use `@pytest.mark.integration` for real API tests
100+
3. Always clean up test files after upload
101+
4. Test retry logic for network failures
102+
5. Verify both `fileUrl` and `appUrl` handling
103+
104+
Example test structure:
105+
106+
```python
107+
def test_upload_success(mock_video_file):
108+
"""Test successful video upload."""
109+
# Test implementation
110+
111+
def test_upload_retry(mock_video_file):
112+
"""Test retry logic on network failure."""
113+
# Test implementation
114+
115+
@pytest.mark.integration
116+
def test_upload_real():
117+
"""Test actual UploadThing integration."""
118+
# Real API test implementation
119+
```
120+
121+
## Pull Request Process
122+
123+
1. Create a feature branch from `main`
124+
2. Make your changes
125+
3. Update tests and documentation
126+
4. Run all tests and quality checks
127+
5. Submit a PR with a clear description of changes
128+
129+
## Release Process
130+
131+
1. Update version in relevant files
132+
2. Update CHANGELOG.md
133+
3. Create a release PR
134+
4. After merge, tag the release
135+
136+
## Questions?
137+
138+
Feel free to open an issue for any questions about contributing.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: "Bug report"
3+
about: "Create a report to help us improve"
4+
title: "[BUG]: …"
5+
labels: "bug"
6+
assignees: ""
7+
---
8+
9+
**Describe the bug**
10+
11+
<!-- A clear and concise description of what the bug is.-->
12+
13+
**Repro MVP (Minimal Viable Procedure)**
14+
15+
<!-- Provide a minimal reproduction procedure.
16+
Include a simple set of steps or a small script that can reproduce the issue.
17+
Attach or link any relevant configuration files or Dockerfiles.
18+
-->
19+
20+
**Expected behavior**
21+
22+
<!-- A clear and concise description of what you expected to happen. -->
23+
24+
**Screenshots**
25+
26+
<!-- If applicable, add screenshots to help explain your problem. -->
27+
28+
**Versions (please complete the following information):**
29+
30+
- Docker version: [e.g. 20.10.7]
31+
- ComfyUI version: [e.g. 1.2.0]
32+
- Host OS: [e.g. Ubuntu 20.04]
33+
34+
**Additional context**
35+
36+
<!-- Add any other context about the problem here, such as specific Docker commands or settings used. -->
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: "Feature request"
3+
about: "Suggest an idea for this project"
4+
title: ""
5+
labels: ""
6+
assignees: ""
7+
---
8+
9+
**Is your feature request related to a problem? Please describe.**
10+
11+
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
12+
13+
**Describe the solution you'd like**
14+
15+
<!-- A clear and concise description of what you want to happen. -->
16+
17+
**Describe alternatives you've considered**
18+
19+
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
20+
21+
**Additional context**
22+
23+
<!-- Add any other context or screenshots about the feature request here.-->

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Motivation
2+
3+
<!-- List motivation and changes here -->
4+
5+
## Issues closed
6+
7+
<!-- List closed issues here -->

0 commit comments

Comments
 (0)