Skip to main content

VSCOD

License: MIT PyPI pyversions PyPI version fury.io Code style: black

VSCOD is short for Visual Studio Code Offline Downloader. This tool will allow you to download batches of extensions as well as VSCode binaries so you can later on use them to install your favorite editor and it's extensions. This tool could help greatly if you're a frustrated admin that needs to update a local artifact repository, if you don't have access to the official repositories from your station and need to pass things by hand or just if you're an automation freak and for some reason want to mess up with the Visual Studio Marketplace.

I tried to find a tool that does that and when I failed I tried to at least find a convenient API to use but to my surprise the Marketplace doesn't have one at the time of writing these lines (and if you find one, feel free to send a PR!), and so I ended up writing VSCOD!

Installation

Use the Python package manager pip to install vscod.

pip install vscod

Usage

Shell

# Display the help
vscod --help
# Download the insider binaries for Linux (64bit deb), Windows (32bit) and Mac to the 'downloads' dir.
vscod download editor --output 'downloads' --build insider linux-deb-x64 win32-archive darwin
# Download the official Python extension and the Vim keymap to the 'extensions' dir.
vscod download extensions --output 'extensions' ms-python.python vscodevim.vim
# Download the requested config data (see below) to the current directory (the default path if none is specified btw).
vscod download config --output '.' /path/to/config.json
# List all the supported platform and build strings.
vscod list-opts

Python

from vscod import extensions_downloader, vscode_downloader
from vscod.vscode_downloader import BUILDS, PLATFORMS, LATEST_VERSION
import asyncio
import aiohttp

async def vscod_demo():
    async with aiohttp.ClientSession() as session:  # It's all asynchronous!
        # Download the latest version of the official Python extension to the path.
        await extensions_downloader.download_extension_by_id(session, 'ms-python.python', 'latest', '/path/to/save')
        # Find what the latest version of the Vim keymap is.
        vim_version = await extensions_downloader.get_extension_version(session, 'vscodevim.vim')
        # Download the latest stable Linux deb version to the path.
        await vscode_downloader.download_vscode(session, PLATFORMS.LINUX64_DEB, '/path/to/save', build=BUILDS.STABLE, version=LATEST_VERSION)

asyncio.run(vscod_demo())

Config

You can also supply a JSON configuration that looks something like this:

{
    "vscode": [
        {
            "platform": "linux-deb-x64"
        },
        {
            "platform": "win32-x64-user",
            "version": "latest",
            "build": "stable"
        }
    ],
    "extensions": {
        "gitlens": "eamodio.gitlens",
        "languages": {
            "go": "ms-vscode.go",
            "python": {
                "python": "ms-python.python",
                "auto_docstring": "njpwerner.autodocstring"
            }
        }
    }
}

The top level "vscode" and "extensions" signals that these are the editor and extensions download settings respectively (duh). The parsing process then goes as follows:

  • For extensions:
    1. Go through the loaded dictionary's items recursively:
      • If the value is a string, we got to the extension ID.
      • If the value is a dict, delve deeper.
    2. Build a directory hierarchy using the keys as directories.
    3. Download each extension ID to it's designated location.
  • For VSCode binaries:
    1. Go through the loaded list of specification dicts. If the value of the top level "vscode" key is a dict, treat it like a list with a single dict.
    2. For each of them download the binary according to the specification given in the dict into a designated directory.

So it will generate the following hierarchy:

|-- root_path
    |-- gitlens
    |   |-- eamodio.gitlens-9.9.3.vsix
    |-- languages
    |   |-- go
    |   |   |-- ms-vscode.go-0.11.4.vsix
    |   |-- python
    |       |-- auto_docstring
    |       |   |-- njpwerner.autodocstring-0.3.0.vsix
    |       |-- python
    |           |-- ms-python.python-2019.8.30787.vsix
    |-- linux-deb-x64
    |   |-- code_1.37.1-1565886362_amd64.deb
    |-- win32-x64-user
        |-- VSCodeUserSetup-x64-1.37.1.exe

License

MIT

Release files for vscod 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vscod 0.1.0
File Size Uploaded
vscod-0.1.0.tar.gz 11.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vscod 0.1.0
File Interpreter ABI Platform
vscod-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 23.9 kB

Release files / vscod-0.1.0.tar.gz

Download URL vscod-0.1.0.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
bc9818caa2a399e3eb3fb14ca3be18d3d3aedbcf19082c3a1e4c8329a1fd9bb0
BLAKE2b-256 checksum
How to use checksums
ce826155a12882c352d98b3cec25d256feebb311e2ff3d8e76719abc26e492b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.6.8

Release files / vscod-0.1.0-py3-none-any.whl

Download URL vscod-0.1.0-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f7915aa7b211c28400ab9c9bcb9181671a1c076e187353a13f109e5ed78fb041
BLAKE2b-256 checksum
How to use checksums
666c9775f2b2201a69bc2990a2957ef2bede912f2a4b222628d7fc69c9189849
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.6.8

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page