PyCharm 2023.2: New Live Templates for Django, Black Formatter Integration, Run Anything, and AI Assistant
PyCharm 2023.2 extends the list of Django live templates. New live templates will let you insert common code constructs for Django views, forms, and models (including admin) by typing short abbreviations. You can manage them in Settings | Editor | Live Templates | Django. To edit the existing templates or create a new one, refer to the PyCharm help page.
We’ve also expanded the list of live templates that can be used to quickly create Django tags in template files. You can find the updated list via Settings | Editor | Live Templates | Django Templates.
The Endpoints tool window now has initial support for the Django REST framework. You can search for endpoint declarations, navigate to specific endpoint declarations, and rename URL path segments. While working with the HTTP Client tab, you will get code completion when modifying endpoints. Try the feature and share what functionality you would like to see added in future PyCharm releases!
PyCharm 2023.2 includes integration with the Black formatter. If you already have Black installed, PyCharm will detect it and suggest setting it up for your project.
In PyCharm, Black works with .py
and .pyi
files. Whole
files and file fragments can both be formatted. You can run Black instead of the
built-in formatter either when you reformat your code manually
(by pressing Ctrl+Alt+L or selecting
Code | Reformat Code from the main menu) or when you save changes to your
files. Learn more about configuration options for Black on the
dedicated help page.
PyCharm 2023.2 introduces Run Anything – a tool that allows you to literally run anything, no matter which file is currently open. Use it to quickly create and launch run/debug configurations, launch the Python console, manage Python packages, or run applications, scripts, commands, and tasks. To open the Run Anything popup, press Ctrl twice.
With this release, we introduce a major addition to PyCharm Professional – AI Assistant. With the current starting set of AI-powered features, AI Assistant offers integrated AI chat and can do things like automatically write documentation comments for you, suggest names, generate commit messages, and more.
AI Assistant is powered by the JetBrains AI service, which can connect you to OpenAI for now and will include other language model providers in the future. To access the assistant’s AI features, you’ll need to install the JetBrains AI plugin and log into the JetBrains AI service using your JetBrains Account. The availability of the JetBrains AI service may vary initially. For more information on AI Assistant and instructions on how to access it, refer to this blog post.
If you use the Qt Modeling Language (QML) in your code, you will now benefit from QML syntax support in PyCharm. This includes:
PyCharm uses built-in code style settings for QML code by default. You can configure Qt and QML paths, qmlformat as a formatting tool, and the QML language server in Settings | Languages & Frameworks | QML.
We simplified the Run/Debug Configurations dialog for Python run configurations. Now, once the dialog is opened, you have immediate access to the most commonly used settings. All additional settings, such as Run with Python Console, Emulate terminal in output console, and Before Launch, now reside under the Modify options menu.
The Python Packages tool window is a quick and easy way to manage PyPI, Conda, or private packages for your project.
In PyCharm 2023.2, you will be able to see a list of new package versions on the left-hand side of the Python Packages tool window, and if necessary, you can download and install the new versions directly from that list.
To improve code readability, PyCharm 2023.2 provides an option to fold complicated type hints. If you prefer reading code without type annotations, you can toggle Settings | Editor | General | Code Folding | Python | Type annotations so your projects open with type annotations folded by default. You can also use the Collapse Python Type Annotations and Expand Python Type Annotations actions to quickly move type annotations out of your way or bring them back when needed.
Search Everywhere (Double Shift) is primarily used for searching through files, classes, methods, actions, and settings. Now, text search results are displayed when there are few or no other search results available for a given query.
To make function calls that contain a lot of arguments easier to read, PyCharm 2023.2 provides inlay parameter name hints. You can set up their behavior in Settings | Editor | Inlay Hints. You can disable parameter name hints for specific methods using the Ctrl+Click shortcut.
PyCharm 2023.2 recognizes function calls annotated with typing.NoReturn
.
The IDE now provides correct information about unreachable code and potentially
uninitialized variables when you call such functions.
For overridden pytest fixtures, PyCharm 2023.2 provides correct type inference,
navigation, and code completion. The IDE now resolves the fixtures in the same way
pytest does: by checking the fixture first inside the test class, then inside the
current file and in the import statements, and finally in the nearest
conftest.py
file.
As it does with .j2
and .jinja2
, PyCharm 2023.2 now
automatically recognizes files with the .jinja
file extension as Jinja
templates and provides the respective syntax highlighting and code completion.
Files with composite extensions, for example Ansible templates, now have proper syntax
highlighting and code completion for both the template language and the data language.
Among the recognized text-based formats are .xml
, .yaml
,
and .properties
. *-playbook.yaml
files are now also
detected as Jinja2 files with the YAML data language.
pyproject.toml
files, PyCharm 2023.2 now provides code completion
for package names in dependencies
and requires
attributes.
The IDE will also suggest installing missing packages from those attributes.
<py-config>
tag. Additionally, inside the
<py-script>
tag PyCharm now provides code completion for the
display
, Element
, and Element.write
elements,
and it checks the types of their arguments.
You can now assign a unique color and icon to each of your projects, and you can customize the predefined colors of the headers. To do so, right-click on a header to access the context menu. Select the Change Project Color option and choose your desired color. To disable this feature, simply deselect the Show Project Gradient option in the context menu.
For v2023.2, we’ve refined the user experience with the Light theme by introducing the Light with Light Header alternative, which features matching light colors for window headers, tooltips, and notification balloons.
PyCharm 2023.2 brings the long-awaited ability to arrange your files in the Project view based on their modification times. This new functionality automatically reorders the files whenever the changes in your project are saved. To enable this feature, open the kebab menu (three vertical dots) in the Project view and then select Tree Appearance | Sort by Modification Time.
To make managing multiple run configurations easier, we’ve implemented the option to pin preferred configurations in the Run widget. To add a run configuration to the Pinned section, open the kebab menu (three vertical dots) next to its name and select Pin. If you have multiple pinned configurations, you can easily rearrange them by dragging and dropping within the list.
With PyCharm 2023.2 you can
configure managed Jupyter servers. You can specify
environment variables for managed servers, configure managed servers to launch
from any directory, and launch managed servers through a separate
jupyter.exe
file located outside of the selected Python interpreter.
You can also specify additional parameters for Jupyter or JupyterLab servers.
In PyCharm 2023.2 you can work with interactive Polars tables in Jupyter notebooks. In the Python console, you can inspect Polars DataFrames via the View as DataFrame option in the Special Variables list. The Python and Jupyter debuggers both work with Polars. PyCharm will provide information about the types and dimensions of the tables, complete the names and types of the columns, and allow you to sort the tables.
Note that Polars DataFrames are not supported in Scientific mode.
PyCharm 2023.2 features a new command-line tool for quickly building and uploading shared indexes. It is designed to streamline teamwork and eliminate time wasted on locally indexing large projects. The new tool simplifies the process of generating shared indexes for your team, requiring just a few clicks instead of multiple scripts and services. Learn more.
In this release, we have eliminated the pain of configuring static analysis by fully integrating the Qodana code quality platform.
You can now trigger an analysis right from within PyCharm, view a list of problems across your entire project, and set up quality gates in your preferred CI/CD system. Furthermore, you will be able to see the server-side analysis results without even leaving PyCharm.
Qodana has just been released out of preview, and you can learn more about the release in this blog post.
In PyCharm 2023.2, we’ve been looking at improving how we present type errors in JavaScript and TypeScript. Your errors and warnings will now be formatted in a more readable way, making it easier to spot problems in your code. This works for all TypeScript errors, some of the most common JavaScript errors, and even localized errors.
PyCharm 2023.2 now supports CSS nesting. We’ve implemented syntax support and an inspection that alerts you if the nested selector starts with an identifier or functional notation.
The OpenAPI Specifications plugin is now bundled with PyCharm 2023.2. This plugin provides support for OpenAPI and Swagger specification files. The main features include validation by JSON schema, navigation, and code generation with Swagger Codegen and OpenAPI Generator.
PyCharm now supports Redoc UI previews for OpenAPI and Swagger specification files, including YAML and JSON files, allowing you to switch between the Redoc and Swagger UIs within the IDE. With the Redocly integration, you can access the Try it console from within PyCharm and use it to set parameters and send requests to your API.
Working with the AsyncAPI specification format in PyCharm is now much easier. The IDE supports schema validation functionality and provides code completion for references, the Endpoints view, and the Editor Preview pane.
You can now send gRPC requests over Transport Layer Security (TLS) in the HTTP Client.
TLS provides encryption and authentication, ensuring the confidentiality and integrity
of your data transmission. Both https://
and grpcs://
schemas
are supported in the request syntax.
The HTTP Client is now capable of understanding Swagger and OpenAPI specifications and providing corresponding code completion options for JSON request bodies.
With PyCharm 2023.2, it is now possible to share common JavaScript code for HTTP Client request handlers via imported modules.
PyCharm is now able to display previews of PDF and HTML files right in the request results in the HTTP Client.
You can now use the HTTP Client CLI in PyCharm to interact with GraphQL APIs and establish WebSocket connections with services, for example for tests or automation scripts.
PyCharm 2023.2 introduces integration with GitLab to streamline your development workflow. You can now work with the Merge Request functionality right from the IDE: review the list of requests, check the changes, leave comments, and navigate to relevant views.
PyCharm 2023.2 introduces a highly anticipated feature to selectively commit specific parts of code chunks. To perform a partial commit, select the lines within a chunk and call Include these lines into commit from the context menu. The chunk will be divided into individual lines, with the selected ones highlighted. You can add or exclude lines from the selection using checkboxes or the context menu.
It is now easy to access and preview the contents of a Docker image layer in the Services tool window. Select the image from the list, select Show layers, and click Analyze image for more information. This opens a list of the files stored in the layer, from which you can easily open the selected file in the editor by right-clicking on the file and clicking Open File (or Download File for binaries).
It is now possible to set a Docker run configuration to run before another configuration by designating it as a Before Launch task. The IDE will wait for the container that is currently running to become healthy, and then it will launch the next run configuration. To put a Docker run configuration in a queue, first create it and then add it to the relevant container via Modify options | Add before launch task | Run configuration.
kubeconfig
files within a single project
We have introduced a new feature that allows you to set up multiple
kubeconfig
files within a single project. This simplifies the experience
of handling multiple clusters or working with environments on different clusters in
the same project. To set the files up, go to
File | Settings | Build, Execution, Deployment | Kubernetes.
You can now view logs for deployments in Kubernetes clusters in the Services tool window. Right-click on Deployment in the tree and then select Follow Log or Download Log from the context menu.
You can now connect to Redis Cluster and have the same feature set as with standalone
Redis. When connecting to a cluster, jdbc:redis:cluster:
must be entered
before the desired URL. Choose the appropriate connection type to achieve this. If SSH
tunneling is required for the connection to the cluster, then the hosts and ports for
all nodes in the cluster should be indicated in the URL.
For v2023.2, we’ve reworked the schema migration functionality. The main difference is that the same object is now placed on the same line in both parts of the dialog, making it easier to understand which objects are going to be added, removed, or changed in the target schema.
The Data Editor and Viewer settings page has a new Time zone field for setting the time zone in which the datetime value should be displayed.
Shared databases and their contents are now introspected. The datashares that these databases are created on are also introspected.