-
Notifications
You must be signed in to change notification settings - Fork 0
first release #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| name: Run Tests | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - main | ||
| - 'releases/**' | ||
|
|
||
| env: | ||
| CARGO_NET_GIT_FETCH_WITH_CLI: 'true' | ||
| # GIT_SSH_COMMAND: 'ssh -o UserKnownHostsFile=/github/home/.ssh/known_hosts -o StrictHostKeyChecking=yes' | ||
|
|
||
| jobs: | ||
| ci: | ||
| name: CI - Node.js ${{ matrix.node-version }} & Python ${{ matrix.python-version }} | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| node-version: | ||
| - '20' | ||
| - '22' | ||
| - '24' | ||
| python-version: | ||
| - '3.8' | ||
| - '3.9' | ||
| - '3.10' | ||
| - '3.11' | ||
| - '3.12' | ||
| - '3.13' | ||
| timeout-minutes: 25 | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Setup SSH Agent | ||
| uses: webfactory/ssh-agent@v0.9.0 | ||
| with: | ||
| ssh-private-key: | | ||
| ${{ secrets.SSH_PRIVATE_KEY }} | ||
| ${{ secrets.HTTP_HANDLER_ACCESS_TOKEN }} | ||
| ${{ secrets.HTTP_REWRITER_ACCESS_TOKEN }} | ||
| - uses: actions/setup-node@v5 | ||
| with: | ||
| node-version: ${{ matrix.node-version }} | ||
| - uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: ${{ matrix.python }} | ||
| - uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.pnpm-store | ||
| key: node-modules-${{ hashFiles('package.json') }} | ||
| - uses: pnpm/action-setup@v4 | ||
| with: | ||
| version: latest | ||
| - name: Install dependencies | ||
| run: pnpm install | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| toolchain: stable | ||
| # TODO: replace with `pnpm install` when using published dependency | ||
| - name: Build python-node manually | ||
| run: | | ||
| # Configure git to use SSH host aliases for private repos (needed by cargo) | ||
| git config --global url."ssh://git@github.com-http-handler/platformatic/http-handler".insteadOf "ssh://git@github.com/platformatic/http-handler" | ||
| git config --global url."ssh://git@github.com-http-handler/platformatic/http-handler.git".insteadOf "ssh://git@github.com/platformatic/http-handler.git" | ||
| git config --global url."ssh://git@github.com-http-rewriter/platformatic/http-rewriter".insteadOf "ssh://git@github.com/platformatic/http-rewriter" | ||
| git config --global url."ssh://git@github.com-http-rewriter/platformatic/http-rewriter.git".insteadOf "ssh://git@github.com/platformatic/http-rewriter.git" | ||
|
|
||
| cd node_modules/@platformatic/python-node | ||
| pnpm install --ignore-scripts | ||
| pnpm run build | ||
| pnpm run build:wasm | ||
| pnpm run build:fix | ||
| - name: Run Full Test Suite | ||
| shell: bash | ||
| run: pnpm test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,144 @@ | ||
| .DS_Store | ||
|
|
||
| # Logs | ||
| logs | ||
| *.log | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
| lerna-debug.log* | ||
| .pnpm-debug.log* | ||
|
|
||
| # Diagnostic reports (https://nodejs.org/api/report.html) | ||
| report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
|
||
| # Runtime data | ||
| pids | ||
| *.pid | ||
| *.seed | ||
| *.pid.lock | ||
|
|
||
| # Directory for instrumented libs generated by jscoverage/JSCover | ||
| lib-cov | ||
|
|
||
| # Coverage directory used by tools like istanbul | ||
| coverage | ||
| *.lcov | ||
|
|
||
| # nyc test coverage | ||
| .nyc_output | ||
|
|
||
| # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
| .grunt | ||
|
|
||
| # Bower dependency directory (https://bower.io/) | ||
| bower_components | ||
|
|
||
| # node-waf configuration | ||
| .lock-wscript | ||
|
|
||
| # Compiled binary addons (https://nodejs.org/api/addons.html) | ||
| build/Release | ||
|
|
||
| # Dependency directories | ||
| node_modules/ | ||
| jspm_packages/ | ||
|
|
||
| # Snowpack dependency directory (https://snowpack.dev/) | ||
| web_modules/ | ||
|
|
||
| # TypeScript cache | ||
| *.tsbuildinfo | ||
|
|
||
| # Optional npm cache directory | ||
| .npm | ||
|
|
||
| # Optional eslint cache | ||
| .eslintcache | ||
|
|
||
| # Optional stylelint cache | ||
| .stylelintcache | ||
|
|
||
| # Microbundle cache | ||
| .rpt2_cache/ | ||
| .rts2_cache_cjs/ | ||
| .rts2_cache_es/ | ||
| .rts2_cache_umd/ | ||
|
|
||
| # Optional REPL history | ||
| .node_repl_history | ||
|
|
||
| # Output of 'npm pack' | ||
| *.tgz | ||
|
|
||
| # Yarn Integrity file | ||
| .yarn-integrity | ||
|
|
||
| # dotenv environment variable files | ||
| .env | ||
| .env.development.local | ||
| .env.test.local | ||
| .env.production.local | ||
| .env.local | ||
|
|
||
| # parcel-bundler cache (https://parceljs.org/) | ||
| .cache | ||
| .parcel-cache | ||
|
|
||
| # Next.js build output | ||
| .next | ||
| out | ||
|
|
||
| # Nuxt.js build / generate output | ||
| .nuxt | ||
| dist | ||
|
|
||
| # Gatsby files | ||
| .cache/ | ||
| # Comment in the public line in if your project uses Gatsby and not Next.js | ||
| # https://nextjs.org/blog/next-9-1#public-directory-support | ||
| # public | ||
|
|
||
| # vuepress build output | ||
| .vuepress/dist | ||
|
|
||
| # vuepress v2.x temp and cache directory | ||
| .temp | ||
| .cache | ||
|
|
||
| # vitepress build output | ||
| **/.vitepress/dist | ||
|
|
||
| # vitepress cache directory | ||
| **/.vitepress/cache | ||
|
|
||
| # Docusaurus cache and generated files | ||
| .docusaurus | ||
|
|
||
| # Serverless directories | ||
| .serverless/ | ||
|
|
||
| # FuseBox cache | ||
| .fusebox/ | ||
|
|
||
| # DynamoDB Local files | ||
| .dynamodb/ | ||
|
|
||
| # TernJS port file | ||
| .tern-port | ||
|
|
||
| # Stores VSCode versions used for testing VSCode extensions | ||
| .vscode-test | ||
|
|
||
| # yarn v2 | ||
| .yarn/cache | ||
| .yarn/unplugged | ||
| .yarn/build-state.yml | ||
| .yarn/install-state.gz | ||
| .pnp.* | ||
| plt-python | ||
| wordpress | ||
|
|
||
| package-lock.json | ||
| pnpm-lock.yaml | ||
| yarn.lock | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # CLAUDE.md | ||
|
|
||
| This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. | ||
|
|
||
| ## Project Overview | ||
|
|
||
| This is `@platformatic/python` - a Python stackable for Watt that integrates Python applications with the Platformatic framework. It enables serving Python ASGI applications through a Fastify server with proper request/response handling. | ||
|
|
||
| ## Development Commands | ||
|
|
||
| - `npm test` - Run tests using Node.js built-in test runner | ||
| - `npm run build` - Generate schema.json and config.d.ts from schema definitions | ||
| - `npm run ci` - Run linting and tests (assumes lint script exists) | ||
|
|
||
| ## Architecture | ||
|
|
||
| The project follows Platformatic's stackable pattern: | ||
|
|
||
| ### Core Components | ||
|
|
||
| - **lib/index.js** - Main stackable export with configuration and plugin registration | ||
| - **lib/plugin.js** - Fastify plugin that handles Python request routing and execution | ||
| - **lib/generator.js** - Code generator for creating new Python stackable projects | ||
| - **lib/schema.js** - JSON schema definitions for configuration validation | ||
|
|
||
| ### Key Architecture Patterns | ||
|
|
||
| 1. **Stackable Integration**: Extends `@platformatic/service` with Python-specific functionality | ||
| 2. **Request Handling**: All HTTP methods are captured by wildcard routes and forwarded to Python via `@platformatic/python-node` | ||
| 3. **Static File Serving**: Non-Python files in docroot are served statically with `@fastify/static` | ||
| 4. **Header Processing**: HTTP headers are capitalized for Python compatibility | ||
| 5. **Configuration Schema**: Uses JSON schema with automatic TypeScript generation | ||
|
|
||
| ### Generated Project Structure | ||
|
|
||
| When using the generator, projects include: | ||
| - `public/` directory as Python docroot with `main.py` containing a basic ASGI app | ||
| - `platformatic.json` configuration file | ||
| - `.env` and `.env.sample` for environment variables | ||
| - Node.js v22.18.0+ and Python 3.8+ requirements | ||
|
|
||
| ### Testing Approach | ||
|
|
||
| - Uses Node.js built-in test runner (`node --test`) | ||
| - Tests cover generator functionality, configuration validation, and file generation | ||
| - Test fixtures in `test/fixtures/` for integration testing |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.