
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@platformatic/python
Advanced tools
A Python stackable for Platformatic that enables running Python ASGI applications within the Platformatic ecosystem. This package integrates Python execution with Fastify servers, allowing you to serve Python applications alongside Node.js applications.
@platformatic/python-node.npm install @platformatic/python
npx --package=@platformatic/python create-platformatic-python --dir my-python-app --port 3042
cd my-python-app
npm install
npm start
--dir - Target directory (default: plt-python)--port - Server port (default: 3042)--hostname - Server hostname (default: 0.0.0.0)--main - Main Python file (default: main.py)The stackable uses a platformatic.json configuration file:
{
"$schema": "https://schemas.platformatic.dev/@platformatic/python/0.7.0.json",
"module": "@platformatic/python",
"python": {
"docroot": "public",
"appTarget": "main:app"
},
"server": {
"hostname": "{PLT_SERVER_HOSTNAME}",
"port": "{PORT}",
"logger": { "level": "{PLT_SERVER_LOGGER_LEVEL}" }
},
"watch": true
}
docroot (string, required) - Path to the root directory containing Python filesappTarget (string, optional) - The Python module and function to load in the format module:function (default: main:app)Standard Platformatic server configuration options are supported.
A generated Python project includes:
my-python-app/
├── public/
│ └── main.py # Main Python ASGI application
├── .env # Environment variables
├── .env.sample # Environment template
├── .gitignore
├── package.json
└── platformatic.json # Platformatic configuration
npm start - Start the development servernpm test - Run testsnpm run build - Build schema and typesPLT_SERVER_HOSTNAME - Server hostname (default: 0.0.0.0)PORT - Server port (default: 3042)PLT_SERVER_LOGGER_LEVEL - Log level (default: info)@platformatic/python-nodeimport { stackable } from '@platformatic/python'
// or
import python from '@platformatic/python'
import { Generator } from '@platformatic/python'
const generator = new Generator()
generator.setConfig({
targetDirectory: './my-app',
port: 3042,
hostname: '0.0.0.0'
})
await generator.run()
# public/main.py
import json
from datetime import datetime
async def app(scope, receive, send):
"""
Basic ASGI application
"""
if scope["type"] == "http":
await send({
'type': 'http.response.start',
'status': 200,
'headers': [
[b'content-type', b'application/json'],
],
})
response_data = {
"message": "Hello from Python!",
"timestamp": datetime.now().isoformat()
}
await send({
'type': 'http.response.body',
'body': json.dumps(response_data).encode('utf-8'),
})
# public/api.py
import json
async def app(scope, receive, send):
"""
ASGI application that handles POST requests
"""
if scope["type"] == "http":
method = scope["method"]
if method == "POST":
# Read the request body
body = b''
while True:
message = await receive()
if message['type'] == 'http.request':
body += message.get('body', b'')
if not message.get('more_body', False):
break
# Parse JSON body
try:
input_data = json.loads(body.decode('utf-8'))
except:
input_data = {}
await send({
'type': 'http.response.start',
'status': 200,
'headers': [
[b'content-type', b'application/json'],
],
})
response_data = {
"received": input_data,
"method": method
}
await send({
'type': 'http.response.body',
'body': json.dumps(response_data).encode('utf-8'),
})
This project is part of the Platformatic ecosystem. Please refer to the main repository for contribution guidelines.
Apache-2.0
FAQs
Integration of Python with Wattpm
We found that @platformatic/python demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.