Fast-Track pyRevit Systemβ„’

Lesson 4

Quick-Start: VS Code

Setup your VS Code editor and configure Revit API and pyRevit Autocomplete.

Written Summary

Setup your VS Code editor and configure Revit API and pyRevit Autocomplete.

Set Up VS Code for pyRevit Development πŸ› οΈ

Hey, welcome back. We're getting closer to writing actual pyRevit code β€” but first, we need to download and set up your code editor correctly.

Could you theoretically write Python in Notepad? Sure. But let's be honest, you're not going to be the greatest programmer with that. In this lesson we'll install VS Code, connect Python, and unlock real Revit API autocomplete with a single package.

Download VS Code (and Cursor too)

We're going to grab the two most popular code editors right now:

  • VS Code β€” the OG, still used by around 70% of developers

  • Cursor IDE β€” the new industry leader, basically a copy of VS Code with a few bells and whistles (everyone swears it has the best Tab autocomplete experience)

Because they're so similar, they share the same settings and extensions β€” so you can set up both, jump between them, and use them in parallel. It's super easy to keep them identical.

Let's download both:

  1. Search for VS Code, open the official Visual Studio Code website, and hit the download button for Windows.

  2. Search for Cursor β€” careful, the first result might be an ad β€” go to the official Cursor website and download it for Windows too.

πŸ’‘ Tip: Both editors are free. The paid subscriptions only unlock things like AI agents and unlimited autocompletes. If you code a lot, it's genuinely worth it β€” but in the beginning, go with the free version and see how far you can push it. You can always upgrade later.

Install both editors

The installers are nearly identical, so this goes fast:

  1. Double-click the VS Code installer and accept the terms.

  2. Click Next through the screens, but make sure you check the two "Open with Code" options β€” they let you right-click any file or folder and open it as a project. Really useful.

  3. Hit Install.

  4. Now do exactly the same for Cursor β€” accept terms, Next, Next, select the same options, Install.

When you open them side by side, you'll see they're almost twins. The logo changed, some text changed β€” same experience. We'll configure VS Code first, then repeat everything in Cursor. And if you use any other editor, that's fine β€” the whole process is the same.

First launch: theme, GitHub, and what to skip

Open VS Code for the first time and you'll get the welcome screen:

  1. You can skip the sign-in completely β€” but honestly, if you're planning to stick with VS Code, create a GitHub account so you can store your code somewhere. Go through the authentication, grant access, and come back.

  2. How do you want it to look? I go for dark. Don't overthink it β€” everything is 100% customizable later.

  3. The agent setup screen? Skip it. We're not going to use the built-in Visual Studio agent anyway β€” I'll use Claude Code as the main one, and sometimes Cursor.

Open a project folder

Now we need a project to work in. I highly recommend opening the .extension folder you created in the previous lesson.

I'm on another machine and forgot to copy mine, so I'll just go File β†’ Open Folder, head to Documents, right-click β†’ New Folder, and name it something simple. It's okay to trust the authors when VS Code asks.

Now you've got the Explorer panel with your files. Click New File and create something like test.py.

πŸ–ΌοΈ [IMAGE: VS Code Explorer panel with a fresh project folder open and a new test.py file created]

Install the Python extension

Start typing print in your new file and... nothing. No autocomplete, no run button, nothing happens. That's because VS Code doesn't know Python yet.

  1. Click the Extensions icon in the sidebar.

  2. You'll probably see the Python extension right in the recommended list β€” it has over 200 million downloads. That's crazy. If not, just type "python" in the search.

  3. Make sure it's the one from Microsoft with those 200 million downloads β€” then you know it's the right one. Click Install.

πŸ–ΌοΈ [IMAGE: Extensions marketplace showing the Microsoft Python extension with 200M+ downloads]

Close the "Get Started" tab and test it. Start typing pr β€” now you get suggestions like the built-in print function:

print("Hello World")

You'll see documentation pop-ups as you type, and a Run button appears for Python files. Click it and the terminal opens with your Hello World. We just executed our first script.

The real goal: Revit API autocomplete

Here's the thing. Plain Python autocomplete works now β€” but our goal is pyRevit and Revit API autocomplete. Try typing from Autodesk and... nothing is suggested.

You might see grayed-out text you can accept with Tab β€” that's AI autocomplete, not real Python autocomplete. It's guessing. Most of the time it guesses right, but sometimes β€” exactly when it matters β€” it misses.

I'll be honest: configuring this used to be a hassle. You had to download stubs, configure paths, and something always went wrong β€” someone misspelled something somewhere and got a bunch of weird issues. Now it's super simple. One package, and you get Revit API + pyRevit autocomplete. Easy.

⚠️ Important: Huge disclaimer β€” listen carefully. We use code editors for writing our Python scripts, but we will never execute Revit API code through the editor. If you try running it from the terminal, you'll get errors β€” no reference, no module, whatever. That's not the point. pyRevit has its own Python engine connected to the running Revit application β€” that's the missing piece. Write here, execute from Revit using pyRevit. The editor is just a helping tool.

Create your virtual environments

  1. Find the Python icon in the sidebar. If you don't see it, right-click the side menu and activate Python.

  2. This opens the Python projects and Environments manager, where you'll see Global and Virtual environments.

  3. Check if you have any Python version installed under Global. If you don't β€” stop here, go to python.org β†’ Downloads, grab a version (3.14 is fine), and install it. If you already have any version, leave it β€” you don't need a specific one.

Now let's create virtual environments β€” isolated boxes with the Python settings for this specific project:

  1. Click the + button next to Virtual Environments.

  2. In the pop-up, use the arrow keys and choose Custom.

  3. Choose the latest Python version available.

  4. Name it venv-rvt-25 (venv = virtual environment, rvt + the Revit version).

  5. Skip package installation for now and hit Enter.

  6. While it's creating, make another one the same way: Custom β†’ latest version β†’ venv-rvt-26 β†’ skip packages.

πŸ–ΌοΈ [IMAGE: Python Environments manager showing venv-rvt-25 and venv-rvt-26 virtual environments]

Install pyrevit-stubs

Normally you'd add packages through the managed packages list, but pyrevit-stubs might not show up there by default (it needs the latest pip). So we'll use the terminal β€” don't get afraid, it's one line of code. Promise.

  1. Click the Create Python Terminal icon next to your environment.

  2. Check the prompt first β€” it should say you're in the 25 environment.

  3. Run:

pip install pyrevit-stubs-25

That installs the Revit API and pyRevit autocomplete for that version. It usually takes 20–30 seconds β€” just wait for it to finish.

Now the same for Revit 26 β€” but careful here:

  1. If you open a new terminal right away, you're still in 25. First click on venv-rvt-26 to set it as your project environment.

  2. Now open a new Python Terminal β€” it should show 26.

  3. Run pip install pyrevit-stubs-26.

⚠️ Important: Always check which environment your terminal shows before installing. It's the easiest way to accidentally install packages into the wrong version.

Close the terminal β€” you now have both 25 and 26 set up. You could add more, but two is enough, and you get the principle.

Test your autocomplete

Clear your test file and type from Autodesk β€” now you'll see real suggestions: Revit, DB, and friends. Let's write a quick test:

from Autodesk.Revit.DB import *

collector = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls)

If the AI suggestions conflict with the real ones, hit Ctrl+Space to trigger the real Python autocomplete pop-up and pick from the actual Revit API classes.

πŸ–ΌοΈ [IMAGE: Ctrl+Space autocomplete pop-up showing FilteredElementCollector and other Revit API class suggestions]

Don't overthink the code yet β€” I'll explain all of it in the next modules. For now, you just need your coding environment working smoothly with auto-suggestions.

Want to verify the versions really are different? Revit API 26 has a new class called ViewPosition:

  • Set 26 as your environment, type ViewP, hit Ctrl+Space β€” there's ViewPosition. You're in Revit API 26.

  • Switch to 25, Ctrl+Space again β€” no ViewPosition, but Viewport is there.

That's the API changing between versions β€” classes occasionally get added or removed. There aren't many of them, and I'll show you how to deal with that later. For now: autocomplete works correctly. That's a win.

And that's it β€” your VS Code is configured for the Revit API and pyRevit. If you hit any issues, comment below the video and I'll help you out β€” maybe even update the video if something turns out to be a common problem.

What's next

Next lesson, we'll do the exact same setup in Cursor IDE β€” which is going to be our main code editor. See you there!