Skip to content

Commit 9278c45

Browse files
committed
first release
1 parent 714a670 commit 9278c45

File tree

23 files changed

+5586
-0
lines changed

23 files changed

+5586
-0
lines changed

.github/workflows/ci.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: Run Tests
3+
on: [push, pull_request, workflow_dispatch]
4+
jobs:
5+
ci:
6+
strategy:
7+
matrix:
8+
node-version: [22, 24]
9+
os: [ubuntu-latest]
10+
runs-on: ${{matrix.os}}
11+
timeout-minutes: 10
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
- name: Use supported Node.js Version
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: ${{ matrix.node-version }}
19+
- name: Restore cached dependencies
20+
uses: actions/cache@v4
21+
with:
22+
path: ~/.pnpm-store
23+
key: node-modules-${{ hashFiles('package.json') }}
24+
- name: Setup pnpm
25+
uses: pnpm/action-setup@v4
26+
with:
27+
version: latest
28+
- name: Set private package config
29+
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}"
30+
env:
31+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
32+
- name: Install dependencies
33+
run: pnpm install
34+
- name: Run Tests
35+
run: pnpm run test

.gitignore

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
.DS_Store
2+
3+
# Logs
4+
logs
5+
*.log
6+
npm-debug.log*
7+
yarn-debug.log*
8+
yarn-error.log*
9+
lerna-debug.log*
10+
.pnpm-debug.log*
11+
12+
# Diagnostic reports (https://nodejs.org/api/report.html)
13+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
14+
15+
# Runtime data
16+
pids
17+
*.pid
18+
*.seed
19+
*.pid.lock
20+
21+
# Directory for instrumented libs generated by jscoverage/JSCover
22+
lib-cov
23+
24+
# Coverage directory used by tools like istanbul
25+
coverage
26+
*.lcov
27+
28+
# nyc test coverage
29+
.nyc_output
30+
31+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
32+
.grunt
33+
34+
# Bower dependency directory (https://bower.io/)
35+
bower_components
36+
37+
# node-waf configuration
38+
.lock-wscript
39+
40+
# Compiled binary addons (https://nodejs.org/api/addons.html)
41+
build/Release
42+
43+
# Dependency directories
44+
node_modules/
45+
jspm_packages/
46+
47+
# Snowpack dependency directory (https://snowpack.dev/)
48+
web_modules/
49+
50+
# TypeScript cache
51+
*.tsbuildinfo
52+
53+
# Optional npm cache directory
54+
.npm
55+
56+
# Optional eslint cache
57+
.eslintcache
58+
59+
# Optional stylelint cache
60+
.stylelintcache
61+
62+
# Microbundle cache
63+
.rpt2_cache/
64+
.rts2_cache_cjs/
65+
.rts2_cache_es/
66+
.rts2_cache_umd/
67+
68+
# Optional REPL history
69+
.node_repl_history
70+
71+
# Output of 'npm pack'
72+
*.tgz
73+
74+
# Yarn Integrity file
75+
.yarn-integrity
76+
77+
# dotenv environment variable files
78+
.env
79+
.env.development.local
80+
.env.test.local
81+
.env.production.local
82+
.env.local
83+
84+
# parcel-bundler cache (https://parceljs.org/)
85+
.cache
86+
.parcel-cache
87+
88+
# Next.js build output
89+
.next
90+
out
91+
92+
# Nuxt.js build / generate output
93+
.nuxt
94+
dist
95+
96+
# Gatsby files
97+
.cache/
98+
# Comment in the public line in if your project uses Gatsby and not Next.js
99+
# https://nextjs.org/blog/next-9-1#public-directory-support
100+
# public
101+
102+
# vuepress build output
103+
.vuepress/dist
104+
105+
# vuepress v2.x temp and cache directory
106+
.temp
107+
.cache
108+
109+
# vitepress build output
110+
**/.vitepress/dist
111+
112+
# vitepress cache directory
113+
**/.vitepress/cache
114+
115+
# Docusaurus cache and generated files
116+
.docusaurus
117+
118+
# Serverless directories
119+
.serverless/
120+
121+
# FuseBox cache
122+
.fusebox/
123+
124+
# DynamoDB Local files
125+
.dynamodb/
126+
127+
# TernJS port file
128+
.tern-port
129+
130+
# Stores VSCode versions used for testing VSCode extensions
131+
.vscode-test
132+
133+
# yarn v2
134+
.yarn/cache
135+
.yarn/unplugged
136+
.yarn/build-state.yml
137+
.yarn/install-state.gz
138+
.pnp.*
139+
plt-python
140+
wordpress
141+
142+
package-lock.json
143+
pnpm-lock.yaml
144+
yarn.lock

CLAUDE.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
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.
8+
9+
## Development Commands
10+
11+
- `npm test` - Run tests using Node.js built-in test runner
12+
- `npm run build` - Generate schema.json and config.d.ts from schema definitions
13+
- `npm run ci` - Run linting and tests (assumes lint script exists)
14+
15+
## Architecture
16+
17+
The project follows Platformatic's stackable pattern:
18+
19+
### Core Components
20+
21+
- **lib/index.js** - Main stackable export with configuration and plugin registration
22+
- **lib/plugin.js** - Fastify plugin that handles Python request routing and execution
23+
- **lib/generator.js** - Code generator for creating new Python stackable projects
24+
- **lib/schema.js** - JSON schema definitions for configuration validation
25+
26+
### Key Architecture Patterns
27+
28+
1. **Stackable Integration**: Extends `@platformatic/service` with Python-specific functionality
29+
2. **Request Handling**: All HTTP methods are captured by wildcard routes and forwarded to Python via `@platformatic/python-node`
30+
3. **Static File Serving**: Non-Python files in docroot are served statically with `@fastify/static`
31+
4. **Header Processing**: HTTP headers are capitalized for Python compatibility
32+
5. **Configuration Schema**: Uses JSON schema with automatic TypeScript generation
33+
34+
### Generated Project Structure
35+
36+
When using the generator, projects include:
37+
- `public/` directory as Python docroot with `main.py` containing a basic ASGI app
38+
- `platformatic.json` configuration file
39+
- `.env` and `.env.sample` for environment variables
40+
- Node.js v22.14.0+ and Python 3.8+ requirements
41+
42+
### Testing Approach
43+
44+
- Uses Node.js built-in test runner (`node --test`)
45+
- Tests cover generator functionality, configuration validation, and file generation
46+
- Test fixtures in `test/fixtures/` for integration testing

0 commit comments

Comments
 (0)