
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.
pyscript-lang
Advanced tools
🐍 Python-like syntax that transpiles to JavaScript and runs on Node.js | Sintaxe estilo Python que transpila para JavaScript e roda no Node.js
🐍 Python-like syntax that runs on Node.js. No Python installation required!
PyScript is a transpiler that converts Python-like syntax into JavaScript, allowing you to write code with Python's elegant syntax while leveraging the entire Node.js ecosystem.
npm install -g pyscript-lang
Or use it locally:
npm install pyscript-lang
Command Line:
# Run a PyScript file
pyscript myfile.pys
# Or use the short alias
pys myfile.pys
Programmatic:
const PyScript = require('pyscript-lang');
const code = 'log("Hello from PyScript!")';
PyScript.run(code);
Print/Log:
log("Hello, World!")
log("Value:", 42, "Multiple", "arguments")
Variables:
name = "PyScript"
age = 2
active = True
nothing = None
Functions:
def greet(name):
log("Hello,", name)
return "Greeted!"
def add(a, b):
return a + b
result = add(5, 3)
Conditionals:
if age > 18:
log("Adult")
elif age > 13:
log("Teenager")
else:
log("Child")
Loops:
# For loop
for i in range(5):
log("Count:", i)
# While loop
count = 0
while count < 5:
log(count)
count += 1
Lists:
fruits = ["apple", "banana", "orange"]
log(fruits[0])
fruits.append("grape")
log(fruits.length)
Dictionaries:
person = {
"name": "Alice",
"age": 30,
"city": "NYC"
}
log(person["name"])
log(person.age)
Classes:
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def greet(self):
log(f"Hi, I'm {self.name}")
def birthday(self):
self.age += 1
p = Person("Bob", 25)
p.greet()
Import Node.js modules:
import "fs"
import "path" as pathModule
# Use Node.js modules directly!
content = fs.readFileSync("file.txt", "utf8")
String Formatting:
name = "World"
log(f"Hello, {name}!")
log(f"2 + 2 = {2 + 2}")
Try/Except:
try:
risky_operation()
except error:
log("Error:", error.message)
finally:
log("Cleanup")
Fibonacci:
def fibonacci(n):
if n <= 1:
return n
return fibonacci(n - 1) + fibonacci(n - 2)
for i in range(10):
log(f"Fib({i}) = {fibonacci(i)}")
Simple Web Server:
import "http"
def handle_request(req, res):
res.writeHead(200, {"Content-Type": "text/plain"})
res.end("Hello from PyScript!")
server = http.createServer(handle_request)
server.listen(3000)
log("🐍 Server running on port 3000")
PyScript transpiles Python-like syntax to JavaScript in real-time:
MIT License - Free to use in your projects!
🐍 Sintaxe estilo Python rodando no Node.js. Sem necessidade de instalar Python!
PyScript é um transpilador que converte sintaxe estilo Python em JavaScript, permitindo que você escreva código com a sintaxe elegante do Python enquanto aproveita todo o ecossistema do Node.js.
npm install -g pyscript-lang
Ou use localmente:
npm install pyscript-lang
Linha de comando:
# Execute um arquivo PyScript
pyscript meuarquivo.pys
# Ou use o alias curto
pys meuarquivo.pys
Programático:
const PyScript = require('pyscript-lang');
const codigo = 'log("Olá do PyScript!")';
PyScript.run(codigo);
Imprimir/Log:
log("Olá, Mundo!")
log("Valor:", 42, "Múltiplos", "argumentos")
Variáveis:
nome = "PyScript"
idade = 2
ativo = True
nada = None
Funções:
def saudar(nome):
log("Olá,", nome)
return "Saudado!"
def somar(a, b):
return a + b
resultado = somar(5, 3)
Condicionais:
if idade > 18:
log("Adulto")
elif idade > 13:
log("Adolescente")
else:
log("Criança")
Loops:
# Loop for
for i in range(5):
log("Contagem:", i)
# Loop while
contador = 0
while contador < 5:
log(contador)
contador += 1
Listas:
frutas = ["maçã", "banana", "laranja"]
log(frutas[0])
frutas.append("uva")
log(frutas.length)
Dicionários:
pessoa = {
"nome": "Alice",
"idade": 30,
"cidade": "SP"
}
log(pessoa["nome"])
log(pessoa.idade)
Classes:
class Pessoa:
def __init__(self, nome, idade):
self.nome = nome
self.idade = idade
def saudar(self):
log(f"Oi, eu sou {self.nome}")
def aniversario(self):
self.idade += 1
p = Pessoa("Bob", 25)
p.saudar()
Importar módulos Node.js:
import "fs"
import "path" as moduloPath
# Use módulos Node.js diretamente!
conteudo = fs.readFileSync("arquivo.txt", "utf8")
Formatação de Strings:
nome = "Mundo"
log(f"Olá, {nome}!")
log(f"2 + 2 = {2 + 2}")
Try/Except:
try:
operacao_arriscada()
except erro:
log("Erro:", erro.message)
finally:
log("Limpeza")
Fibonacci:
def fibonacci(n):
if n <= 1:
return n
return fibonacci(n - 1) + fibonacci(n - 2)
for i in range(10):
log(f"Fib({i}) = {fibonacci(i)}")
Servidor Web Simples:
import "http"
def processar_requisicao(req, res):
res.writeHead(200, {"Content-Type": "text/plain"})
res.end("Olá do PyScript!")
servidor = http.createServer(processar_requisicao)
servidor.listen(3000)
log("🐍 Servidor rodando na porta 3000")
PyScript transpila sintaxe tipo Python para JavaScript em tempo real:
Licença MIT - Livre para usar nos seus projetos!
Made with 💙 by capybarascript
Write Python, Run JavaScript 🐍
FAQs
🐍 Python-like syntax that transpiles to JavaScript and runs on Node.js | Sintaxe estilo Python que transpila para JavaScript e roda no Node.js
We found that pyscript-lang demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.