Upload Runner - VS Code ExtensionA VS Code extension that adds an upload icon to the status bar. When clicked, it executes a Python script for custom upload operations. Features
InstallationFrom VSIX (Local Installation)
From MarketplaceOnce published, you can install directly from the VS Code Marketplace. Quick Start1. Create Configuration FileCreate a file named
2. Create Your Upload ScriptCreate your Python script (e.g.,
3. Use the ExtensionThe upload button (📤) will automatically appear in the status bar when ConfigurationThe extension reads configuration from Configuration File:
|
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
pythonPath |
string | No | "python3" |
Path to Python executable |
scriptPath |
string | No | bundled script | Path to your Python script (relative or absolute) |
Configuration Examples
Basic Configuration:
{
"pythonPath": "python3",
"scriptPath": "scripts/upload.py"
}
Custom Python Installation:
{
"pythonPath": "/usr/local/bin/python3.11",
"scriptPath": "deploy/upload.py"
}
Using Virtual Environment:
{
"pythonPath": ".venv/bin/python",
"scriptPath": "upload.py"
}
Windows Configuration:
{
"pythonPath": "C:\\Python311\\python.exe",
"scriptPath": "scripts\\upload.py"
}
See CONFIG_SCHEMA.md for detailed configuration documentation.
How It Works
- Detection: Extension checks for
upload-runner.jsonin your workspace root - Button Visibility: Upload button appears only when the config file exists
- Auto-Update: Button automatically appears/disappears when you create/delete the config file
- Execution: When clicked, reads config and executes your Python script
- Feedback: Shows progress, output, and any errors
Python Script Examples
Example 1: Simple File Upload
#!/usr/bin/env python3
import sys
import os
def main():
print("Starting upload...")
# Your upload logic here
files = ["file1.txt", "file2.txt"]
for file in files:
print(f"Uploading {file}...")
# Upload logic here
print("Upload complete!")
return 0
if __name__ == "__main__":
sys.exit(main())
Example 2: Upload to S3
#!/usr/bin/env python3
import sys
import boto3
def main():
print("Uploading to S3...")
s3 = boto3.client('s3')
s3.upload_file('local_file.txt', 'my-bucket', 'remote_file.txt')
print("Upload complete!")
return 0
if __name__ == "__main__":
sys.exit(main())
Example 3: FTP Upload
#!/usr/bin/env python3
import sys
from ftplib import FTP
def main():
print("Connecting to FTP...")
ftp = FTP('ftp.example.com')
ftp.login('username', 'password')
with open('file.txt', 'rb') as f:
ftp.storbinary('STOR file.txt', f)
ftp.quit()
print("Upload complete!")
return 0
if __name__ == "__main__":
sys.exit(main())
Development
Prerequisites
- Node.js (v14 or higher)
- npm
- Python 3.x
Setup
# Clone or navigate to the extension directory
cd /path/to/upload-runner
# Install dependencies
npm install
# Install vsce (VS Code Extension Manager)
npm install -g @vscode/vsce
Testing
- Open the extension folder in VS Code
- Press F5 to open a new Extension Development Host window
- Test the extension in this window
Debugging
- Set breakpoints in
extension.js - Check the Debug Console for logs
- Use
console.log()for debugging
Publishing to VS Code Marketplace
One-Time Setup
Create a Microsoft Account (if you don't have one)
Create an Azure DevOps Organization
- Visit https://dev.azure.com
- Create a new organization
Get a Personal Access Token (PAT)
- In Azure DevOps, click User Settings → Personal Access Tokens
- Click "New Token"
- Name:
vscode-marketplace - Organization: Select your organization
- Scopes: Select "Marketplace" → "Manage"
- Click "Create"
- SAVE THE TOKEN - you won't see it again!
Create a Publisher
- Go to https://marketplace.visualstudio.com/manage
- Click "Create publisher"
- Enter a unique publisher ID (lowercase, no spaces)
- This will be your publisher name in
package.json
Update package.json
Before publishing, update these fields:
{
"publisher": "your-publisher-id",
"repository": {
"type": "git",
"url": "https://github.com/your-username/upload-runner"
}
}
Package the Extension
# Create a .vsix package
vsce package
# This creates: upload-runner-1.0.0.vsix
Publish to Marketplace
# Login with your Personal Access Token
vsce login your-publisher-id
# Enter your PAT when prompted
# Publish the extension
vsce publish
# Or publish with a specific version
vsce publish minor # 1.0.0 → 1.1.0
vsce publish major # 1.0.0 → 2.0.0
vsce publish patch # 1.0.0 → 1.0.1
Update an Existing Extension
# Make your changes
# Update version in package.json or use:
vsce publish patch
# This will:
# 1. Increment the version
# 2. Package the extension
# 3. Publish to marketplace
Publishing Checklist
- [ ] Update version number in
package.json - [ ] Test the extension thoroughly
- [ ] Update README.md with any new features
- [ ] Add/update icon.png (128x128 px recommended)
- [ ] Update CHANGELOG.md
- [ ] Ensure repository URL is correct
- [ ] Verify publisher name
- [ ] Test the packaged .vsix locally
- [ ] Publish to marketplace
- [ ] Verify on marketplace website
Files Structure
upload-runner/
├── extension.js # Main extension code
├── upload_script.py # Default Python script
├── package.json # Extension manifest
├── README.md # Documentation
├── .vscodeignore # Files to exclude from package
├── .gitignore # Git ignore rules
└── icon.png # Extension icon (add your own)
Troubleshooting
Upload Button Not Appearing
Most Common Issue!
- ✅ Verify
upload-runner.jsonexists in your workspace root folder (not a subfolder) - ✅ Check the file name is exactly
upload-runner.json(case-sensitive) - ✅ Ensure you have a folder open in VS Code (not just individual files)
- ✅ Try reloading the window: Ctrl+Shift+P → "Developer: Reload Window"
Python Not Found
- ✅ Ensure Python is installed: Run
python3 --versionin terminal - ✅ Use absolute path in
upload-runner.json:{ "pythonPath": "/usr/local/bin/python3" } - ✅ On Windows, use escaped backslashes:
"C:\\Python311\\python.exe"
Script Not Running
- ✅ Check the Debug Console for errors (Help → Toggle Developer Tools)
- ✅ Verify
scriptPathinupload-runner.jsonpoints to an existing file - ✅ If using relative path, ensure it's relative to workspace root
- ✅ Ensure script has execute permissions (Linux/Mac):
chmod +x script.py
Configuration File Errors
- ✅ Validate JSON syntax: Use a JSON validator
- ✅ Check for trailing commas (invalid in JSON)
- ✅ Ensure all strings use double quotes, not single quotes
- ✅ Example valid config:
{ "pythonPath": "python3", "scriptPath": "upload.py" }
Extension Not Working
- ✅ Check if extension is enabled in Extensions panel
- ✅ Look for errors in Output panel (View → Output → "Extension Host")
- ✅ Try uninstalling and reinstalling the extension
- ✅ Reload VS Code window
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
If you encounter any issues or have suggestions, please file an issue on the GitHub repository.