Early Access Program Releases Web Development

PyCharm 2023.2 EAP 5: Black Formatter Integration, Endpoints Tool Window for Django REST Framework

This EAP build includes the Black formatter integration, a new Endpoints tool window for Django REST framework, the Run Anything tool to quickly run anything or create a new run configuration, support for installing dependencies from pyproject.toml, inlay parameter name hints, and much more.

To catch up on all of the new features PyCharm 2023.2 will bring, check out our previous EAP blog posts.

The Toolbox App is the easiest way to get the EAP builds and keep both your stable and EAP versions up to date. You can also manually download the EAP builds from our website.

Download PyCharm 2023.2 EAP

Important! PyCharm EAP builds are not fully tested and might be unstable.

Below you can find the most interesting improvements available in PyCharm 2023.2 EAP 5. Please try them out and share your feedback in the comments below or by using our issue tracker.

User experience

Run Anything

With Run Anything, you can 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, launch applications, scripts, commands, and tasks.
  • Open recent projects.

Run Anything can also help you use proper command syntax by showing suggestions as you type.

To start working with the Run Anything popup, press ^ (Ctrl) twice. Start typing the run/debug configuration name or the command you want to run. To narrow down the suggestions, filter for the specific types of configurations you want to work with.

Run Anything popup

To start the Python console, run the python command without parameters. To create a Python configuration or run a file, use the python command, and PyCharm will suggest the list of available files from the current project to run. You can run pip install, and packages will be installed for the current interpreter.

If, while composing an HTTP request, you specified its name, you can find and send this HTTP request from the Run Anything popup.

Black formatter integration

PyCharm 2023.2 will include integration with the Black formatter. If you already have Black installed, PyCharm will detect it and suggest setting it up for your project.

If there’s a pyproject.toml file with the formatting settings in your project, PyCharm will apply these settings automatically. Alternatively, you can specify the command-line arguments manually via Settings | Tools | Black and put the desired arguments in the Settings field. Learn more about configuration options for Black on the dedicated help page.

Black formatter integration

In PyCharm, Black works with .py and .pyi files. Both whole files and file fragments can be formatted. You can run Black either on code reformat (by pressing ⌘⌥L / Ctrl+Alt+L or selecting Code | Reformat Code from the main menu) instead of the built-in formatter or when you are saving changes to your files.

At the moment, Black cannot be used with remote interpreters.

Endpoints tool window for Django

PyCharm has an Endpoints tool window for working with URLs and endpoints. Starting from version 2023.2, this tool window will have dedicated support for Django.

If you’re developing a Django application or an API based on the Django REST framework, you can get an overview of all declared URLs and endpoints in this new tool window. It can also assist you when developing microservices and backend-frontend communication or working with RESTful APIs.

You can open the Endpoints tool window via View | Tool Windows | Endpoints or by clicking the More tool windows icon on the left-side editor toolbar.

In the Endpoints tool window, you can filter the list of endpoints by module, type, or framework. To list all Django endpoints, select Django under Framework.

If the route is declared in library files, you can see it by choosing the filter option Show From Libraries under the Options icon in the top-right corner of the tool window.

Use the Jump to source action to navigate to the relevant endpoint declaration from the Endpoints tool window or from endpoint usages.

To search for endpoint declarations, go to Navigate | URL Mapping… from the main menu and select the relevant declaration from the list.

When you select an endpoint, you can see the details in the dedicated pane that provides information in the Documentation, HTTP Client, and OpenAPI tabs.

You can use Rename URL Path Segment refactoring to change parts of URL paths. All changes will be immediately visible in the Endpoints tool window and in the HTTP Client tab. You can find usages of the route using the ⌥F7 / Alt+F7 shortcut.

While working with the HTTP Client tab, you will get code completion when modifying an endpoint.

Pinned run configurations in the Run widget

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, click the kebab menu (three dots) next to its name and select Pin. If you have multiple pinned configurations, you can easily rearrange them by dragging and dropping them within the list.

File sorting by modification time in the Project view

PyCharm 2023.2 EAP 4 brings the long-awaited option to arrange your files in the Project view based on their modification time. This new functionality automatically reorders the files whenever the changes in your project are saved. To enable this feature, click the kebab menu (three dots) in the Project view and then select Tree Appearance | Sort by Modification Time.

Option to update packages from the Python Packages tool window

The Python Packages tool window is a quick and easy way to manage PyPI, Conda, or private packages for your project.


Inlay parameter name hints

PyCharm 2023.2 will provide inlay parameter name hints, the main purpose of which is to improve code readability – especially when the function call contains a lot of arguments. Inlay parameter hints will not clutter the editor when the purpose of the argument is obvious, for example, for keyword arguments.

By default, inlay parameter name hints are disabled for non-literal arguments. You can set up their behavior or switch them off entirely in Settings | Editor | Inlay Hints. You can disable parameter name hints for a specific method using the Ctrl+Click / ⌘+Click shortcut.

Enhancements to type hints

PyCharm 2023.2 will recognize function calls annotated with typing.NoReturn. It will help provide correct information about unreachable code and potentially uninitialized variables after calling such functions.

We also added an option for the complicated type hints to fold them, which makes reading code easier. Now, PyCharm can collapse and expand Python type annotations. If you prefer reading code without type annotations here and there, you can toggle Settings | Editor | General | Code Folding | Python | Type annotations so your projects would 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 when needed.

Use parentheses instead of backslashes for line breaks

If you’re breaking long lines of code, you probably know that by default, PyCharm uses a backslash as a sign for line continuation. However, PEP 8 recommends using parentheses for this purpose.

That’s why for PyCharm 2023.2, we’ve introduced an option to wrap the code in parentheses when breaking lines. This option is now disabled by default and can be enabled by ticking the Use parentheses instead of backslashes for breaking lines checkbox in Editor / General / Smart Keys / Python.

Support for installing dependencies from pyproject.toml

PEP 621 provides a way to store project dependencies in pyproject.toml in dependencies/optional-dependencies attributes.

To support this change, PyCharm 2023.2 will provide code completion in pyproject.toml files for package names in dependencies and required attributes. The IDE will also check if any of the listed dependencies are not installed and suggest installing the missing packages.

You can apply this option when using line breaks with binary expressions, call chains, strings, and relative import statements.

In PyCharm 2023.2, you will be able to see if a new version of the installed package is available and download it, if necessary, directly from the list of packages in the Python Packages tool window.


Syntax highlighting for both TOML and JSON in the <py-config> tag

PyScript has recently introduced the <py-config> tag for configuring general metadata and declaring dependencies for PyScript applications.

In PyCharm 2023.1, we introduced basic code insight for the tag and its attributes. PyCharm 2023.2 will provide syntax highlighting for content inside the <py-config> tag, whether in TOML or JSON format.

Inside the <py-script> tag, PyCharm will provide code completion for the display, Element, and Element.write elements, as well as check the types of their arguments.

Static code insight for the Python console and Evaluate Expression dialog

PyCharm used to offer runtime code completion for the Python and Debug console. In some cases, this led to side effects caused by the nature of runtime completion. In PyCharm 2022.3, we added an ability to switch off runtime code completion in the Python and Debug consoles by going to File | Settings | Build, Execution, Deployment | Console and disabling the option Auto-display runtime code completion.

For PyCharm 2023.2, we’re adding code completion based on the static analysis of already executed commands to the consoles and Evaluate Expression. It works in Evaluate Expression by default and in the consoles once the runtime completion is disabled.

These are the most notable highlights of the PyCharm 2023.2 EAP 5 build. To see the full list of changes in this EAP build, please refer to the release notes.

Try out these new features and let us know what you think in the comments below or on Twitter. If you encounter any bugs, please report them via our issue tracker.

image description