Skip to content

Commit

Permalink
fix: python code execution
Browse files Browse the repository at this point in the history
  • Loading branch information
drochetti committed Apr 20, 2023
1 parent 853b528 commit 3a47ade
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ vsc-extension-quickstart.md
**/.eslintrc.json
**/*.map
**/*.ts
.mypy_cache/**
python/tests/**
out/test/**
40 changes: 35 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,39 @@
# Change Log
# Changelog

All notable changes to the "serverless" extension will be documented in this file.
All notable changes to this project will be documented in this file.

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
<!-- ## [Unreleased] -->

- Initial release
## [0.0.3] - 2023-04-20

### Added

- Command to refresh the extension's own virtualenv.

### Fixed

- Python code execution path.
- Remove mypy and other test files from final bundle.


## [0.0.2] - 2023-04-19

### Added

- README with more information about the extension.

### Fixed

- Extension metadata.

## [0.0.1] - 2023-04-19

### Added

First release, added basic functionality, such as:

- Auto create and manage virtual environments for the fal-serverless `@isolated` functions.
- Allows you to run the fal-serverless `@isolated` functions in the cloud with a click.
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "fal-serverless-vscode",
"displayName": "fal-serverless vscode plugin",
"description": "The fal-serverless extension with @isolated and Python cloud execution support",
"description": "The fal-serverless extension with @isolated and Python cloud execution support.",
"publisher": "fal-ai",
"version": "0.0.2",
"version": "0.0.3",
"preview": true,
"license": "MIT",
"repository": {
Expand Down Expand Up @@ -47,7 +47,7 @@
"commands": [
{
"command": "falServerless.run",
"title": "Run fal-serverless function",
"title": "fal-serverless: Run function",
"arguments": [
{
"name": "filename",
Expand All @@ -58,6 +58,10 @@
"description": "The line of the isolated decorator"
}
]
},
{
"command": "falServerless.refreshExtensionEnv",
"title": "fal-serverless: Refresh extension virtualenv"
}
]
},
Expand Down
3 changes: 3 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export async function activate(context: vscode.ExtensionContext) {
await installExtensionModule(context.globalStorageUri.fsPath, isDevelopment);

vscode.commands.registerCommand("falServerless.run", runFunction);
vscode.commands.registerCommand("falServerless.refreshExtensionEnv", () => {
installExtensionModule(context.globalStorageUri.fsPath, true);
});

const activeEditor = vscode.window.activeTextEditor;
if (activeEditor && isPythonDocument(activeEditor.document)) {
Expand Down
3 changes: 2 additions & 1 deletion src/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ export async function installExtensionModule(
const envPath = path.resolve(storagePath, "venv");

const pythonExec = path.join(envPath, "bin", "python");
const install = [pythonExec, "-m", "pip", "install", "./python"].join(" ");
const modulePath = path.join(__dirname, "..", "python");
const install = [pythonExec, "-m", "pip", "install", modulePath].join(" ");

if (!fs.existsSync(envPath)) {
const result = await exec(`virtualenv ${envPath}`);
Expand Down

0 comments on commit 3a47ade

Please sign in to comment.