Skip to main content

Download VSCode binaries and extensions offline.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vscod-0.1.0.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

vscod-0.1.0-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file vscod-0.1.0.tar.gz.

File metadata

  • Download URL: vscod-0.1.0.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for vscod-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bc9818caa2a399e3eb3fb14ca3be18d3d3aedbcf19082c3a1e4c8329a1fd9bb0
MD5 83c7503df1626f567104dd608715ab22
BLAKE2b-256 ce826155a12882c352d98b3cec25d256feebb311e2ff3d8e76719abc26e492b0

See more details on using hashes here.

File details

Details for the file vscod-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: vscod-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for vscod-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f7915aa7b211c28400ab9c9bcb9181671a1c076e187353a13f109e5ed78fb041
MD5 58361fd06512a380c3ac2d7722d7db38
BLAKE2b-256 666c9775f2b2201a69bc2990a2957ef2bede912f2a4b222628d7fc69c9189849

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page