- Python Development In Visual Studio
- X Code
- Python Tools For Visual Studio
- Visual Studio For Mac Os
- Adding Python To Visual Studio
Python support is presently available only on Visual Studio for Windows; on Mac and Linux, Python support is available through Visual Studio Code. Download and run the latest Visual Studio 2017 installer for Windows (Python support is present in release 15.2 and later). Questions and answers. Is Python support available with Visual Studio for Mac? Not at this time, but you can up vote the request on Developer Community.The Visual Studio for Mac documentation identifies the current types of development that it does support. In the meantime, Visual Studio Code on Windows, Mac, and Linux works well with Python through available extensions.
Linting, Debugging (multi-threaded, web apps, remote), Intellisense, auto-completion, code formatting, snippets, unit testing, and more.
##WikiOnce installed, do remember to configure the path to the python executable.
If you're working in a virtualenv, you can reference the
python
interpreter from your virtualenv (ie ~/.virtualenvs/XXX/bin/python
).##Features
- Linting (Prospector, PyLint, Pep8, Flake8, pydocstyle with config files and plugins)
- Intellisense and autocompletion
- Auto indenting
- Code formatting (autopep8, yapf, with config files)
- Renaming, Viewing references, Going to definitions, Go to Symbols
- View signature and similar by hovering over a function or method
- Debugging with support for local variables, arguments, expressions, watch window, stack information, break points
- Debugging Multiple threads (Web Applications - Flask, etc) and expanding values (on Windows and Mac)
- Debugging remote processes (attaching to local and remote process)
- Debugging with support for shebang (windows)
- Debugging with custom environment variables
- Unit testing (unittests and nosetests, with config files)
- Sorting imports
- Snippets
##Issues and Feature Requests
Feature Details (with configuration)
- IDE Features
- Auto indenting
- Rename and navigate to symbols
- Go to, Peek and hover definition
- Find all references
- View Signature
- Sorting Import statements (use 'Python: Sort Imports' command)
- Full intellisense
- Support for docstring
- Ability to include custom module paths (e.g. include paths for libraries like Google App Engine, etc)
- Use the setting python.autoComplete.extraPaths = []
- For instance getting autocomplete/intellisense for Google App Engine, add the following to your settings file:
- Auto formatting of code upon saving changes (default to 'Off')
- Use either yapf or autopep8 for code formatting (defaults to autopep8)
- auutopep8 configuration files supported
- yapf configuration files supported
- It can be turned off (default is turn it on and use pylint)
- pylint can be turned on/off (default is on), supports standard configuaration files
- pep8 can be turned on/off (default is off), supports standard configuaration files
- flake8 can be turned on/off (default is on), supports standard configuaration files
- pydocstyle can be turned on/off (default is on), supports standard configuaration files
- prospector can be turned on/off (default is on)
- Different categories of errors reported by pylint can be configured as warnings, errors, information or hits
- Path to pylint, pep8 and flake8 and pep8 can be configured
- Custom plugins such as pylint plugin for Django can be easily used by modifying the settings as follows:
- Watch window
- Evaluate Expressions
- Step through code (Step in, Step out, Continue)
- Add/remove break points
- Local variables and arguments
- Multiple Threads and Web Applications (such as Flask) (Windows and Mac)
- Expanding values (viewing children, properties, etc) (Windows and Mac)
- Conditional breakpoints
- Remote debugging
- Unit Testing
- unittests (default is on)
- nosetests (default is off)
- Test resutls are displayed in the 'Python' output window
- Future release will display results in a more structured manner integrated into the IDE
- Snippets
Requirements
- Python is installed on the current system
- Path to python can be configured
- Pylint is installed for linting (optional)
- pip install pylint
- Pep8 is installed for linting (optional)
- pip install pep8
- Flake8 is installed for linting (optional)
- pip install flake8
- pydocstyle is installed for linting (optional)
- pip install pydocstyle
- prospector is installed for linting (optional)
- pip install prospector
- Autopep8 is installed for code formatting (optional)
- pip install pep8
- pip install --upgrade autopep8
- Yapf is installed for code formatting (optional)
- pip install yapf
- nosetests for unit testing (optional)
- pip install nose
Change Log
Version 0.3.9
- Fixed auto indenting issues #137
Version 0.3.8
- Added support for linting using prospector #130
- Fixed issue where environment variables weren't being inherited by the debugger #109 and #77
Version 0.3.7
- Added support for auto indenting of some keywords #83
- Added support for launching console apps for Mac #128
- Fixed issue where configuration files for pylint, pep8 and flake8 commands weren't being read correctly #117
Version 0.3.6
- Added support for linting using pydocstyle #56
- Added support for auto-formatting documents upon saving (turned off by default) #27
- Added support to configure the output window for linting, formatting and unit test messages #112
Version 0.3.5
- Fixed printing of unicode characters when evaulating expressions #73
Version 0.3.4
- Updated snippets
- Fixes to remote debugging #65
- Fixes related to code navigation #58 and #78
- Changes to allow code navigation for methods
Version 0.3.2
- Ability to control how debugger breaks into exceptions raised (always break, never break or only break if unhandled)
- Disabled displaying of errors, as there are a few instances when errors are displayed in the IDE when not required
Version 0.3.1
- Remote debugging (updated documentation and fixed minor issues)
- Fixed issues with formatting of files when path contains spaces
![Studio Studio](/uploads/1/2/6/4/126492657/576019196.gif)
Version 0.3.0
- Remote debugging (attaching to local and remote processes)
- Debugging with support for shebang
- Support for passing environment variables to debug program
- Improved error handling in the extension
Version 0.2.9
- Added support for debugging django applications
- Debugging templates is not supported at this stage
Version 0.2.8
- Added support for conditional break points
- Added ability to optionally display the shell window (Windows Only, Mac is coming soon)
- Allowing an interactive shell window, which isn't supported in VSCode.
- Added support for optionally breaking into python code as soon as debugger starts
- Fixed debugging when current thread is busy processing.
- Updated documentation with samples and instructions
Version 0.2.4
- Fixed issue where debugger would break into all exceptions
- Added support for breaking on all and uncaught exceptions
- Added support for pausing (breaking) into a running program while debugging.
Version 0.2.3
- Fixed termination of debugger
Version 0.2.2
- Improved debugger for Mac, with support for Multi threading, Web Applications, expanding properties, etc
- (Debugging now works on both Windows and Mac)
- Debugging no longer uses PDB
Version 0.2.1
- Improved debugger for Windows, with support for Multi threading, debugging Multi-threaded apps, Web Applications, expanding properties, etc
- Added support for relative paths for extra paths in additional libraries for Auto Complete
- Fixed a bug where paths to custom Python versions weren't respected by the previous (PDB) debugger
- NOTE: PDB Debugger is still supported
Version 0.1.3
- Fixed linting when using pylint
Version 0.1.2
- Fixed autoformatting of code (falling over when using yapf8)
Version 0.1.1
- Added support for linting using flake8
- Added support for unit testing using unittest and nosetest
- Added support for custom module paths for improved intellisense and autocomplete
- Modifications to debugger to display console output (generated using 'print' and the like)
- Modifications to debugger to accept arguments
Version 0.1.0
- Fixed linting of files on Mac
- Added support for linting using pep8
- Added configuration support for pep8 and pylint
- Added support for configuring paths for pep8, pylint and autopep8
- Added snippets
- Added support for formatting using yapf
- Added a number of configuration settings
Version 0.0.4
- Added support for linting using Pylint (configuring pylint is coming soon)
- Added support for sorting Imports (Using the command 'Pythong: Sort Imports')
- Added support for code formatting using Autopep8 (configuring autopep8 is coming soon)
- Added ability to view global variables, arguments, add and remove break points
Version 0.0.3
- Added support for debugging using PDB
Python Development In Visual Studio
Debugging Instructions
- Use the Python debugger, set the name of the startup program
Source
License
Working with Python in Visual Studio Code, using the Microsoft Python extension, is simple, fun, and productive. The extension makes VS Code an excellent IDE, and works on any operating system with a variety of Python interpreters. It leverages all of VS Code's power to provide auto complete and IntelliSense, linting, debugging, and unit testing, along with the ability to easily switch between Python environments, including virtual and conda environments.
This article provides only an overview of the different capabilities of the Python extension for VS Code. For a walkthrough of editing, running, and debugging code, use the button below.
Install Python and the Python extension
The tutorial guides you through installing Python and using the extension. You must install a Python interpreter yourself separately from the extension. For a quick install, use Python 3.7 from python.org and install the extension from the VS Code marketplace.
Once you have a version of Python installed, activate it using the Python: Select Interpreter command. If VS Code doesn't automatically locate the interpreter you're looking for, refer to Environments - Manually specify an interpreter.
You configure the Python extension through settings. See the Settings reference.
Run Python code
To experience Python, create a file (using the File Explorer) named
hello.py
and paste in the following code (assuming Python 3):The Python extension then provides shortcuts to run Python code in the currently selected interpreter (Python: Select Interpreter in the Command Palette):
- In the text editor: right-click anywhere in the editor and select Run Python File in Terminal. If invoked on a selection, only that selection is run.
- In Explorer: right-click a Python file and select Run Python File in Terminal.
You can also use the Terminal: Create New Integrated Terminal command to create a terminal in which VS Code automatically activates the currently selected interpreter. See Environments below. The Python: Start REPL activates a terminal with the currently selected interpreter and then runs the Python REPL.
For a more specific walkthrough on running code, see the tutorial.
Autocomplete and IntelliSense
The Python extension supports code completion and IntelliSense using the currently selected interpreter. IntelliSense is a general term for a number of features, including intelligent code completion (in-context method and variable suggestions) across all your files and for built-in and third-party modules.
IntelliSense quickly shows methods, class members, and documentation as you type, and you can trigger completions at any time with ⌃Space (Windows, Linux Ctrl+Space). You can also hover over identifiers for more information about them.
Tip: Check out the IntelliCode extension for VS Code (preview). IntelliCode provides a set of AI-assisted capabilities for IntelliSense in Python, such as inferring the most relevant auto-completions based on the current code context.
Linting
Linting analyzes your Python code for potential errors, making it easy to navigate to and correct different problems.
The Python extension can apply a number of different linters including Pylint, Pep8, Flake8, mypy, pydocstyle, prospector, and pylama. See Linting.
Debugging
No more
print
statement debugging! Set breakpoints, inspect data, and use the debug console as you run your program step by step. Debug a number of different types of Python applications, including multi-threaded, web, and remote applications.For Python-specific details, including setting up your
launch.json
configuration and remote debugging, see Debugging. General VS Code debugging information is found in the debugging document. The Django and Flask tutorials also demonstrate debugging in the context of those web apps, including debugging Django page templates.Snippets
Snippets take productivity to the next level. You can configure your own snippets and use snippets provided by an extension. Snippets appear in the same way as code completion ⌃Space (Windows, Linux Ctrl+Space). For specific examples with Python, see the Django and Flask tutorials.
Environments
The Python extension automatically detects Python interpreters that are installed in standard locations. It also detects conda environments as well as virtual environments in the workspace folder. See Configuring Python environments. You can also use the
python.pythonPath
setting to point to an interpreter anywhere on your computer.The current environment is shown on the left side of the VS Code Status Bar:
The Status Bar also indicates if no interpreter is selected:
The selected environment is used for IntelliSense, auto-completions, linting, formatting, and any other language-related feature other than debugging. It is also activated when you use run Python in a terminal.
To change the current interpreter, which includes switching to conda or virtual environments, select the interpreter name on the Status Bar or use the Python: Select Interpreter command.
VS Code prompts you with a list of detected environments as well as any you've added manually to your user settings (see Configuring Python environments).
Installing packages
Packages are installed using the Terminal panel and commands like
pip install <package_name>
(Windows) and pip3 install <package_name>
(macOS/Linux). VS Code installs that package into your project along with its dependencies. Examples are given in the Python tutorial as well as the Django and Flask tutorials.Jupyter notebooks
If you open a Jupyter notebook file (
.ipynb
) in VS Code, the Python extension prompts you to import the notebook as a Python code file. The notebook's cells are delimited in the Python file with #%%
comments, and the Python extension shows Run Cell or Run All Cells CodeLens. Selecting either CodeLens starts the Jupyter server and runs the cell(s) in the Python interactive window:You can also connect to a remote Jupyter server for running the code.
X Code
Furthermore, importing a notebook into VS Code allows you to use all of VS Code's debugging capabilities. You can then save the notebook file and open it again as a notebook in Jupyter or upload to a service like Azure Notebooks.
Teradata Studio Express provides an information discovery tool that retrieves data from Aster, Teradata, and Hadoop Database systems and allows the data to. Teradata Studio is an administration toolkit that helps users to create and administer database objects. It also provides a SQL Editor and Result Set Viewer for retrieving and displaying data fron your Teradata Database systems (Teradata, Aster, and Hadoop). Teradata Studio 15.11 for Mac is free to download from our software library. This free software for Mac OS X is an intellectual property of Teradata. The software lies within Developer Tools, more precisely General. This Mac download was checked by our built-in antivirus and was rated as malware free. Download Teradata Studio Express 14.00.00 for Mac from our website for free. Our built-in antivirus scanned this Mac download and rated it as 100% safe. The software relates to Lifestyle Tools. The most popular version among the application users is 14.0. Teradata studio for mac.
For more information, see Jupyter support.
Unit testing
The Python extension supports unit testing with the unittest, pytest, and nose test frameworks.
To run unit tests, you enable one of the frameworks in settings. Each framework also has specific settings, such as arguments that identify paths and patterns for test discovery.
Once discovered, VS Code provides a variety of commands (on the Status Bar, the Command Palette, and elsewhere) to run and debug tests, including ability to run individual test files and individual methods.
Python Tools For Visual Studio
Configuration
The Python extension provides a wide variety of settings for its various features. These are described on their relevant topics, such as Editing code, Linting, Debugging, and Testing. The complete list is found in the Settings reference.
Other popular Python extensions
The Microsoft Python extension provides all of the features described previously in this article. Additional Python language support can be added to VS Code by installing other popular Python extensions. For Jupyter support, we recommend the 'Jupyter' extension from Don Jayamanne.
Visual Studio For Mac Os
- Open the Extensions view (⇧⌘X (Windows, Linux Ctrl+Shift+X)).
- Filter the extension list by typing 'python'.
The extensions shown above are dynamically queried. Click on an extension tile above to read the description and reviews to decide which extension is best for you. See more in the Marketplace.
Next steps
- Python Hello World tutorial - Get started with Python in VS Code.
- Editing Python - Learn about auto-completion, formatting, and refactoring for Python.
- Basic Editing - Learn about the powerful VS Code editor.
- Code Navigation - Move quickly through your source code.
Adding Python To Visual Studio
03/07/2019