wavespeed 0.0.4__tar.gz → 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.
Files changed (80) hide show
  1. wavespeed-0.1.0/.github/workflows/claude-code-review.yml +77 -0
  2. wavespeed-0.1.0/.github/workflows/claude.yml +63 -0
  3. wavespeed-0.1.0/.github/workflows/pre-commit.yml +29 -0
  4. wavespeed-0.1.0/.github/workflows/python-packages.yml +90 -0
  5. wavespeed-0.1.0/.github/workflows/python-publish.yml +46 -0
  6. wavespeed-0.1.0/.gitignore +213 -0
  7. wavespeed-0.1.0/.pre-commit-config.yaml +34 -0
  8. wavespeed-0.1.0/CLAUDE.md +86 -0
  9. {wavespeed-0.0.4 → wavespeed-0.1.0}/LICENSE +2 -2
  10. wavespeed-0.1.0/MANIFEST.in +5 -0
  11. wavespeed-0.1.0/PKG-INFO +253 -0
  12. wavespeed-0.1.0/README.md +224 -0
  13. wavespeed-0.1.0/VERSIONING.md +60 -0
  14. wavespeed-0.1.0/images/build_and_push.sh +108 -0
  15. wavespeed-0.1.0/images/test_worker/Dockerfile +29 -0
  16. wavespeed-0.1.0/images/test_worker/build_and_test.sh +18 -0
  17. wavespeed-0.1.0/images/test_worker/handler.py +101 -0
  18. wavespeed-0.1.0/images/test_worker/requirements.txt +1 -0
  19. wavespeed-0.1.0/images/test_worker/test_input.json +8 -0
  20. wavespeed-0.1.0/pyproject.toml +51 -0
  21. wavespeed-0.1.0/pytest.ini +6 -0
  22. wavespeed-0.1.0/setup.cfg +26 -0
  23. wavespeed-0.1.0/src/wavespeed/__init__.py +30 -0
  24. wavespeed-0.1.0/src/wavespeed/_config_module.py +404 -0
  25. wavespeed-0.1.0/src/wavespeed/_version.py +2 -0
  26. wavespeed-0.1.0/src/wavespeed/api/__init__.py +95 -0
  27. wavespeed-0.1.0/src/wavespeed/api/client.py +238 -0
  28. wavespeed-0.1.0/src/wavespeed/config.py +209 -0
  29. wavespeed-0.1.0/src/wavespeed/serverless/__init__.py +165 -0
  30. wavespeed-0.1.0/src/wavespeed/serverless/modules/__init__.py +54 -0
  31. wavespeed-0.1.0/src/wavespeed/serverless/modules/fastapi.py +441 -0
  32. wavespeed-0.1.0/src/wavespeed/serverless/modules/handler.py +74 -0
  33. wavespeed-0.1.0/src/wavespeed/serverless/modules/heartbeat.py +140 -0
  34. wavespeed-0.1.0/src/wavespeed/serverless/modules/http.py +247 -0
  35. wavespeed-0.1.0/src/wavespeed/serverless/modules/job.py +236 -0
  36. wavespeed-0.1.0/src/wavespeed/serverless/modules/local.py +147 -0
  37. wavespeed-0.1.0/src/wavespeed/serverless/modules/logger.py +203 -0
  38. wavespeed-0.1.0/src/wavespeed/serverless/modules/progress.py +141 -0
  39. wavespeed-0.1.0/src/wavespeed/serverless/modules/scaler.py +247 -0
  40. wavespeed-0.1.0/src/wavespeed/serverless/modules/state.py +185 -0
  41. wavespeed-0.1.0/src/wavespeed/serverless/utils/__init__.py +23 -0
  42. wavespeed-0.1.0/src/wavespeed/serverless/utils/boto3_utils.py +365 -0
  43. wavespeed-0.1.0/src/wavespeed/serverless/utils/validator.py +173 -0
  44. wavespeed-0.1.0/src/wavespeed/serverless/worker.py +74 -0
  45. wavespeed-0.1.0/src/wavespeed.egg-info/PKG-INFO +253 -0
  46. wavespeed-0.1.0/src/wavespeed.egg-info/SOURCES.txt +67 -0
  47. wavespeed-0.1.0/src/wavespeed.egg-info/not-zip-safe +1 -0
  48. wavespeed-0.1.0/src/wavespeed.egg-info/requires.txt +7 -0
  49. wavespeed-0.1.0/tests/__init__.py +1 -0
  50. wavespeed-0.1.0/tests/conftest.py +36 -0
  51. wavespeed-0.1.0/tests/test_api.py +367 -0
  52. wavespeed-0.1.0/tests/test_config.py +65 -0
  53. wavespeed-0.1.0/tests/test_serverless/__init__.py +1 -0
  54. wavespeed-0.1.0/tests/test_serverless/test_modules/__init__.py +1 -0
  55. wavespeed-0.1.0/tests/test_serverless/test_modules/test_fastapi.py +449 -0
  56. wavespeed-0.1.0/tests/test_serverless/test_modules/test_handler.py +195 -0
  57. wavespeed-0.1.0/tests/test_serverless/test_modules/test_http.py +317 -0
  58. wavespeed-0.1.0/tests/test_serverless/test_modules/test_job.py +394 -0
  59. wavespeed-0.1.0/tests/test_serverless/test_modules/test_local.py +246 -0
  60. wavespeed-0.1.0/tests/test_serverless/test_modules/test_logger.py +216 -0
  61. wavespeed-0.1.0/tests/test_serverless/test_modules/test_progress.py +181 -0
  62. wavespeed-0.1.0/tests/test_serverless/test_modules/test_scaler.py +239 -0
  63. wavespeed-0.1.0/tests/test_serverless/test_modules/test_state.py +222 -0
  64. wavespeed-0.1.0/tests/test_serverless/test_utils/__init__.py +1 -0
  65. wavespeed-0.1.0/tests/test_serverless/test_utils/test_validator.py +282 -0
  66. wavespeed-0.1.0/tests/test_serverless/test_worker.py +175 -0
  67. wavespeed-0.0.4/PKG-INFO +0 -272
  68. wavespeed-0.0.4/README.md +0 -235
  69. wavespeed-0.0.4/pyproject.toml +0 -93
  70. wavespeed-0.0.4/setup.cfg +0 -4
  71. wavespeed-0.0.4/tests/test_client.py +0 -315
  72. wavespeed-0.0.4/wavespeed/__init__.py +0 -18
  73. wavespeed-0.0.4/wavespeed/client.py +0 -147
  74. wavespeed-0.0.4/wavespeed/schemas/__init__.py +0 -7
  75. wavespeed-0.0.4/wavespeed/schemas/prediction.py +0 -76
  76. wavespeed-0.0.4/wavespeed.egg-info/PKG-INFO +0 -272
  77. wavespeed-0.0.4/wavespeed.egg-info/SOURCES.txt +0 -13
  78. wavespeed-0.0.4/wavespeed.egg-info/requires.txt +0 -4
  79. {wavespeed-0.0.4 → wavespeed-0.1.0/src}/wavespeed.egg-info/dependency_links.txt +0 -0
  80. {wavespeed-0.0.4 → wavespeed-0.1.0/src}/wavespeed.egg-info/top_level.txt +0 -0
@@ -0,0 +1,77 @@
1
+ name: Claude Code Review
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, synchronize]
6
+ # Optional: Only run on specific file changes
7
+ # paths:
8
+ # - "src/**/*.ts"
9
+ # - "src/**/*.tsx"
10
+ # - "src/**/*.js"
11
+ # - "src/**/*.jsx"
12
+
13
+ jobs:
14
+ claude-review:
15
+ # Optional: Filter by PR author
16
+ # if: |
17
+ # github.event.pull_request.user.login == 'external-contributor' ||
18
+ # github.event.pull_request.user.login == 'new-developer' ||
19
+ # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
20
+
21
+ runs-on: ubuntu-latest
22
+ permissions:
23
+ contents: read
24
+ pull-requests: read
25
+ issues: read
26
+ id-token: write
27
+
28
+ steps:
29
+ - name: Checkout repository
30
+ uses: actions/checkout@v4
31
+ with:
32
+ fetch-depth: 1
33
+
34
+ - name: Run Claude Code Review
35
+ id: claude-review
36
+ uses: anthropics/claude-code-action@beta
37
+ with:
38
+ claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
39
+
40
+ # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4.1)
41
+ # model: "claude-opus-4-1-20250805"
42
+
43
+ # Direct prompt for automated review (no @claude mention needed)
44
+ direct_prompt: |
45
+ Please review this pull request and provide feedback on:
46
+ - Code quality and best practices
47
+ - Potential bugs or issues
48
+ - Performance considerations
49
+ - Security concerns
50
+ - Test coverage
51
+
52
+ Be constructive and helpful in your feedback.
53
+
54
+ # Optional: Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR
55
+ # use_sticky_comment: true
56
+
57
+ # Optional: Customize review based on file types
58
+ # direct_prompt: |
59
+ # Review this PR focusing on:
60
+ # - For TypeScript files: Type safety and proper interface usage
61
+ # - For API endpoints: Security, input validation, and error handling
62
+ # - For React components: Performance, accessibility, and best practices
63
+ # - For tests: Coverage, edge cases, and test quality
64
+
65
+ # Optional: Different prompts for different authors
66
+ # direct_prompt: |
67
+ # ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' &&
68
+ # 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' ||
69
+ # 'Please provide a thorough code review focusing on our coding standards and best practices.' }}
70
+
71
+ # Optional: Add specific tools for running tests or linting
72
+ # allowed_tools: "Bash(npm run test),Bash(npm run lint),Bash(npm run typecheck)"
73
+
74
+ # Optional: Skip review for certain conditions
75
+ # if: |
76
+ # !contains(github.event.pull_request.title, '[skip-review]') &&
77
+ # !contains(github.event.pull_request.title, '[WIP]')
@@ -0,0 +1,63 @@
1
+ name: Claude Code
2
+
3
+ on:
4
+ issue_comment:
5
+ types: [created]
6
+ pull_request_review_comment:
7
+ types: [created]
8
+ issues:
9
+ types: [opened, assigned]
10
+ pull_request_review:
11
+ types: [submitted]
12
+
13
+ jobs:
14
+ claude:
15
+ if: |
16
+ (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17
+ (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18
+ (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19
+ (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
20
+ runs-on: ubuntu-latest
21
+ permissions:
22
+ contents: read
23
+ pull-requests: read
24
+ issues: read
25
+ id-token: write
26
+ actions: read # Required for Claude to read CI results on PRs
27
+ steps:
28
+ - name: Checkout repository
29
+ uses: actions/checkout@v4
30
+ with:
31
+ fetch-depth: 1
32
+
33
+ - name: Run Claude Code
34
+ id: claude
35
+ uses: anthropics/claude-code-action@beta
36
+ with:
37
+ claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
38
+
39
+ # This is an optional setting that allows Claude to read CI results on PRs
40
+ additional_permissions: |
41
+ actions: read
42
+
43
+ # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4.1)
44
+ # model: "claude-opus-4-1-20250805"
45
+
46
+ # Optional: Customize the trigger phrase (default: @claude)
47
+ # trigger_phrase: "/claude"
48
+
49
+ # Optional: Trigger when specific user is assigned to an issue
50
+ # assignee_trigger: "claude-bot"
51
+
52
+ # Optional: Allow Claude to run specific commands
53
+ # allowed_tools: "Bash(npm install),Bash(npm run build),Bash(npm run test:*),Bash(npm run lint:*)"
54
+
55
+ # Optional: Add custom instructions for Claude to customize its behavior for your project
56
+ # custom_instructions: |
57
+ # Follow our coding standards
58
+ # Ensure all new code has tests
59
+ # Use TypeScript for new files
60
+
61
+ # Optional: Custom environment variables for Claude
62
+ # claude_env: |
63
+ # NODE_ENV: test
@@ -0,0 +1,29 @@
1
+ name: pre-commit
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+ push:
8
+ branches:
9
+ - main
10
+ tags:
11
+ - "v[0-9]+*"
12
+ workflow_dispatch:
13
+
14
+ jobs:
15
+ pre-commit:
16
+ runs-on: ubuntu-latest
17
+ env:
18
+ ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: "true"
19
+ ACTIONS_RUNNER_FORCED_INTERNAL_NODE_VERSION: node16
20
+ ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16
21
+ steps:
22
+ - uses: actions/checkout@v3
23
+ with:
24
+ path: "."
25
+ - name: Set up Python
26
+ uses: actions/setup-python@v3
27
+ with:
28
+ python-version: '3.10'
29
+ - uses: pre-commit/action@v3.0.1
@@ -0,0 +1,90 @@
1
+ name: python-packages
2
+
3
+ on:
4
+ # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-when-a-pull-request-is-approved
5
+ # pull_request:
6
+ # types:
7
+ # - review_requested
8
+ # branches:
9
+ # - main
10
+ push:
11
+ branches:
12
+ - main
13
+ tags:
14
+ - "v[0-9]+*"
15
+ workflow_dispatch:
16
+
17
+ jobs:
18
+ build:
19
+ runs-on: ubuntu-latest
20
+
21
+ steps:
22
+ - name: Recursive checkout
23
+ uses: actions/checkout@v3
24
+ with:
25
+ submodules: recursive
26
+ path: "."
27
+ fetch-depth: 0 # for tags
28
+
29
+ - name: Set up Python
30
+ uses: actions/setup-python@v3
31
+ with:
32
+ python-version: '3.x'
33
+
34
+ - name: Install dependencies
35
+ run: |
36
+ python -m pip install --upgrade pip
37
+ pip install build wheel 'setuptools>=64' 'setuptools_scm>=8'
38
+
39
+ - name: Build package
40
+ run: python -m build
41
+
42
+ - run: du -h dist/*
43
+ - uses: actions/upload-artifact@v4
44
+ with:
45
+ name: python-packages
46
+ path: |
47
+ dist/*.whl
48
+ dist/*.tar.gz
49
+
50
+ # publish to GitHub Release
51
+ gh_release:
52
+ name: gh_release
53
+ needs: build
54
+ runs-on: ubuntu-latest
55
+ permissions: write-all
56
+
57
+ timeout-minutes: 60
58
+ defaults:
59
+ run:
60
+ shell: bash
61
+ steps:
62
+ - uses: actions/download-artifact@v4
63
+ with:
64
+ path: dist
65
+
66
+ - run: ls -R dist/
67
+
68
+ # create night release if it's a push to main
69
+ - if: github.repository == 'WaveSpeedAI/wavespeed-python' && github.event_name == 'push' && github.ref == 'refs/heads/main'
70
+ name: Nightly Release
71
+ uses: andelf/nightly-release@v1
72
+ env:
73
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74
+ with:
75
+ tag_name: nightly
76
+ name: 'Nightly Release $$'
77
+ prerelease: true
78
+ body: 'TODO: Add nightly release notes'
79
+ files: |
80
+ dist/*/*.whl
81
+ dist/*/*.tar.gz
82
+
83
+ # create release if it's a tag like vx.y.z
84
+ - if: github.repository == 'WaveSpeedAI/wavespeed-python' && github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v')
85
+ name: Release
86
+ uses: softprops/action-gh-release@v1
87
+ with :
88
+ files: |
89
+ dist/*/*.whl
90
+ dist/*/*.tar.gz
@@ -0,0 +1,46 @@
1
+ # This workflow will upload a Python Package using Twine when a release is created
2
+ # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3
+
4
+ # This workflow uses actions that are not certified by GitHub.
5
+ # They are provided by a third-party and are governed by
6
+ # separate terms of service, privacy policy, and support
7
+ # documentation.
8
+
9
+ name: python-publish
10
+
11
+ on:
12
+ release:
13
+ types: [published]
14
+ workflow_dispatch:
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ jobs:
20
+ deploy:
21
+ runs-on: ubuntu-latest
22
+ env:
23
+ ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: "true"
24
+ permissions:
25
+ # IMPORTANT: this permission is mandatory for trusted publishing
26
+ id-token: write
27
+ steps:
28
+ - name: Recursive checkout
29
+ uses: actions/checkout@v3
30
+ with:
31
+ submodules: recursive
32
+ path: "."
33
+ fetch-depth: 0 # for tags
34
+
35
+ - name: Set up Python
36
+ uses: actions/setup-python@v3
37
+ with:
38
+ python-version: '3.10'
39
+ - name: Install dependencies
40
+ run: |
41
+ python -m pip install --upgrade pip
42
+ pip install build 'setuptools>=64' 'setuptools_scm>=8'
43
+ - name: Build package
44
+ run: python -m build --sdist -n
45
+ - name: Publish package
46
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,213 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # setuptools_scm version file (auto-generated)
30
+ _version.py
31
+
32
+ # macOS
33
+ .DS_Store
34
+
35
+ # PyInstaller
36
+ # Usually these files are written by a python script from a template
37
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
38
+ *.manifest
39
+ *.spec
40
+
41
+ # Installer logs
42
+ pip-log.txt
43
+ pip-delete-this-directory.txt
44
+
45
+ # Unit test / coverage reports
46
+ htmlcov/
47
+ .tox/
48
+ .nox/
49
+ .coverage
50
+ .coverage.*
51
+ .cache
52
+ nosetests.xml
53
+ coverage.xml
54
+ *.cover
55
+ *.py.cover
56
+ .hypothesis/
57
+ .pytest_cache/
58
+ cover/
59
+
60
+ # Translations
61
+ *.mo
62
+ *.pot
63
+
64
+ # Django stuff:
65
+ *.log
66
+ local_settings.py
67
+ db.sqlite3
68
+ db.sqlite3-journal
69
+
70
+ # Flask stuff:
71
+ instance/
72
+ .webassets-cache
73
+
74
+ # Scrapy stuff:
75
+ .scrapy
76
+
77
+ # Sphinx documentation
78
+ docs/_build/
79
+
80
+ # PyBuilder
81
+ .pybuilder/
82
+ target/
83
+
84
+ # Jupyter Notebook
85
+ .ipynb_checkpoints
86
+
87
+ # IPython
88
+ profile_default/
89
+ ipython_config.py
90
+
91
+ # pyenv
92
+ # For a library or package, you might want to ignore these files since the code is
93
+ # intended to run in multiple environments; otherwise, check them in:
94
+ # .python-version
95
+
96
+ # pipenv
97
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
98
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
99
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
100
+ # install all needed dependencies.
101
+ #Pipfile.lock
102
+
103
+ # UV
104
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ #uv.lock
108
+
109
+ # poetry
110
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
111
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
112
+ # commonly ignored for libraries.
113
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
114
+ #poetry.lock
115
+ #poetry.toml
116
+
117
+ # pdm
118
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
119
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
120
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
121
+ #pdm.lock
122
+ #pdm.toml
123
+ .pdm-python
124
+ .pdm-build/
125
+
126
+ # pixi
127
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
128
+ #pixi.lock
129
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
130
+ # in the .venv directory. It is recommended not to include this directory in version control.
131
+ .pixi
132
+
133
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
134
+ __pypackages__/
135
+
136
+ # Celery stuff
137
+ celerybeat-schedule
138
+ celerybeat.pid
139
+
140
+ # SageMath parsed files
141
+ *.sage.py
142
+
143
+ # Environments
144
+ .env
145
+ .envrc
146
+ .venv
147
+ env/
148
+ venv/
149
+ ENV/
150
+ env.bak/
151
+ venv.bak/
152
+
153
+ # Spyder project settings
154
+ .spyderproject
155
+ .spyproject
156
+
157
+ # Rope project settings
158
+ .ropeproject
159
+
160
+ # mkdocs documentation
161
+ /site
162
+
163
+ # mypy
164
+ .mypy_cache/
165
+ .dmypy.json
166
+ dmypy.json
167
+
168
+ # Pyre type checker
169
+ .pyre/
170
+
171
+ # pytype static type analyzer
172
+ .pytype/
173
+
174
+ # Cython debug symbols
175
+ cython_debug/
176
+
177
+ # PyCharm
178
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
179
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
180
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
181
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
182
+ #.idea/
183
+
184
+ # Abstra
185
+ # Abstra is an AI-powered process automation framework.
186
+ # Ignore directories containing user credentials, local state, and settings.
187
+ # Learn more at https://abstra.io/docs
188
+ .abstra/
189
+
190
+ # Visual Studio Code
191
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
192
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
193
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
194
+ # you could uncomment the following to ignore the entire vscode folder
195
+ # .vscode/
196
+
197
+ # Ruff stuff:
198
+ .ruff_cache/
199
+
200
+ # PyPI configuration file
201
+ .pypirc
202
+
203
+ # Cursor
204
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
205
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
206
+ # refer to https://docs.cursor.com/context/ignore-files
207
+ .cursorignore
208
+ .cursorindexingignore
209
+
210
+ # Marimo
211
+ marimo/_static/
212
+ marimo/_lsp/
213
+ __marimo__/
@@ -0,0 +1,34 @@
1
+ exclude: '((^src/mdeploy/libs/.*)|(^src/mdeploy/song_generation/codeclm/.*))$'
2
+ repos:
3
+ - repo: https://github.com/pre-commit/pre-commit-hooks
4
+ rev: v4.0.1
5
+ hooks:
6
+ - id: check-docstring-first
7
+ - id: check-toml
8
+ - id: check-yaml
9
+ exclude: packaging/.*
10
+ args:
11
+ - --allow-multiple-documents
12
+ - id: mixed-line-ending
13
+ args: [--fix=lf]
14
+ - id: end-of-file-fixer
15
+
16
+ - repo: https://github.com/omnilib/ufmt
17
+ rev: v1.3.3
18
+ hooks:
19
+ - id: ufmt
20
+ additional_dependencies:
21
+ - black == 22.3.0
22
+ - usort == 1.0.2
23
+
24
+ - repo: https://github.com/PyCQA/flake8
25
+ rev: 7.1.1
26
+ hooks:
27
+ - id: flake8
28
+ name: flake8-main
29
+ args: [--config=setup.cfg]
30
+
31
+ - repo: https://github.com/PyCQA/pydocstyle
32
+ rev: 6.1.1
33
+ hooks:
34
+ - id: pydocstyle
@@ -0,0 +1,86 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ WaveSpeed Python SDK - Official Python SDK for WaveSpeedAI inference platform. Provides a serverless worker implementation compatible with RunPod infrastructure.
8
+
9
+ ## Commands
10
+
11
+ ### Testing
12
+ ```bash
13
+ # Run all tests
14
+ python -m pytest
15
+
16
+ # Run a single test file
17
+ python -m pytest tests/test_serverless/test_modules/test_job.py
18
+
19
+ # Run a specific test
20
+ python -m pytest tests/test_serverless/test_modules/test_job.py::TestRunJob::test_sync_handler_success -v
21
+ ```
22
+
23
+ ### Local Development
24
+ ```bash
25
+ # Install in editable mode
26
+ pip install -e .
27
+
28
+ # Run handler locally with test input
29
+ python handler.py --test_input '{"input": {"message": "hello"}}'
30
+
31
+ # Run FastAPI development server
32
+ python handler.py --waverless_serve_api --waverless_api_port 8000
33
+ ```
34
+
35
+ ### Docker (test_worker image)
36
+ ```bash
37
+ # Build and test
38
+ ./images/test_worker/build_and_test.sh
39
+ ```
40
+
41
+ ## Architecture
42
+
43
+ ### Serverless Worker (`src/wavespeed/serverless/`)
44
+
45
+ Entry point: `serverless.start({"handler": handler})` in `__init__.py`
46
+
47
+ Three execution modes:
48
+ 1. **Local test mode** - `--test_input` flag or `test_input.json` file
49
+ 2. **API server mode** - `--waverless_serve_api` for FastAPI dev server
50
+ 3. **Worker mode** - Production mode polling for jobs
51
+
52
+ Key modules in `modules/`:
53
+ - `job.py` - Job execution (`run_job`, `run_job_generator`, `handle_job`)
54
+ - `scaler.py` - Concurrent job fetching and processing (`JobScaler`)
55
+ - `handler.py` - Handler type detection (sync/async/generator)
56
+ - `http.py` - HTTP communication (`fetch_jobs`, `send_result`, `stream_result`)
57
+ - `fastapi.py` - Local development API server (`WorkerAPI`)
58
+ - `local.py` - Local test execution
59
+ - `state.py` - Job and worker state management
60
+ - `validator.py` - Input validation (RunPod-compatible)
61
+
62
+ ### Handler Types
63
+
64
+ Handlers can be sync/async functions or generators:
65
+ ```python
66
+ def sync_handler(job): return {"output": result}
67
+ async def async_handler(job): return {"output": result}
68
+ def generator_handler(job): yield partial_result
69
+ async def async_gen_handler(job): yield partial_result
70
+ ```
71
+
72
+ ### Validation (RunPod-compatible)
73
+
74
+ ```python
75
+ from wavespeed.serverless.utils import validate
76
+
77
+ schema = {
78
+ "prompt": {"type": str, "required": True},
79
+ "temperature": {"type": float, "required": False, "default": 0.7, "constraints": lambda x: 0 <= x <= 2},
80
+ }
81
+ result = validate(job_input, schema) # Returns {"validated_input": ...} or {"errors": [...]}
82
+ ```
83
+
84
+ ### Environment Detection
85
+
86
+ Auto-detects RunPod (`RUNPOD_*` env vars) or native Waverless (`WAVERLESS_*` env vars) environments.
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 WaveSpeed AI
3
+ Copyright (c) 2025 WaveSpeedAI
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
@@ -0,0 +1,5 @@
1
+ include MANIFEST.in
2
+ include LICENSE
3
+ include requirements.txt
4
+ prune */__pycache__
5
+ global-exclude *.o *.so *.dylib *.a .git *.pyc *.swp