RSSAmplifier

Blog

PyDev adventures

Posting about venturing (and creating) PyDev. LINKS: PyDev.org Blog RSS Twitter RSS

pydev.blogspot.comRSS feed ↗25 posts

Latest posts

Using (or really misusing) Path.resolve() in Python

I just stumbled upon a code in Python that uses a simple ` Path(...).resolve() ` after receiving a path in an API and suddenly reminded myself on the many the bugs I've tripped over due to it, so, decided to share why I hope at some point this function stops being so pervasive as it's usually the wrong thing to call.. (maybe because when Python went from os.path to pathlib they added no real…

PyDev Debugger and sys.monitoring (PEP 669) -- i.e.: really fast debugging for Python 3.12!

The latest release of PyDev (12.0.0) is now available and it brings a really nice speed improvement for those who are already in Python 3.12! -- If you're a LiClipse user, it's now available in LiClipse 11 . The PyDev Debugger now uses sys.monitoring , which enables faster debugging (on my tests it can be up to 15 times faster than the version using sys.setttrace , depending on the use case --…

robocorp.log: a library to answer what happened in a Python run.

It's been a while since I don't post, so, I decided to shed some details on what I'm working now (which I think is a really nice -- open source -- tool for the Python ecosystem -- in my view it's something close to a "Time travel debugger" for Python, although it's mostly labelled as automatic logging for Python 😄). I'll start with a bit of history though: I'm working with Robocorp right now (…

PyDev debugger: Going from async to sync to async... oh, wait.

In Python asyncio land it's always a bit of a hassle when you have existing code which runs in sync mode which needs to be retrofitted to run in async , but it's usually doable -- in many cases, slapping async on the top of a bunch of definitions and adding the needed await statements where needed does the trick -- even though it's not always that easy. Now, unfortunately a debugger has no such…

PyDev 9.3.0 (debugger improvements / last version with Python 2.7 - 3.5 support)

PyDev 9.3.0 is now available. The main changes in this release are related to the debugger, with improvements such as: Major issue fixed issue where variable children sometimes wouldn't expand correctly. Fixed some case where automatic connection to subprocesses wouldn't work. Debugging with Pandas is much improved with the addition of some custom converters. Opt-in support to show paused…

PyDev 8.3.0 (Java 11, Flake 8 , Code-completion LRU, issue on Eclipse 4.19)

PyDev 8.3.0 is now available! Let me start with some warnings here: First, PyDev now requires Java 11 . I believe that Java 11 is pretty standard nowadays and the latest Eclipse also requires Java 11 (if you absolutely need Java 8 , please keep using PyDev 8.2.0 -- or earlier -- indefinitely, otherwise, if you are still using Java 8 , please upgrade to Java 11 -- or higher). Second, Eclipse…

PyDev 8.2.0 released (external linters, Flake8, path mappings, ...)

PyDev 8.2.0 is now available for download. This release has many improvements for dealing with external linters. The main ones are the inclusion of support for the Flake8 linter as well as using a single linter call for analyzing a directory, so, that should be much faster now (previously it called external linters once for each file) . Note: to request code analysis for all the contents below a…

PyDev 8.1.0 released (Python 3.9, Code analysis, f-string quick-fixes)

PyDev 8.1.0 is now available for download. As a note, I didn't really create a post on 8.0.1, so, I'm covering some of the features in that version in this blog post too! 😊 Some nice things added: Python 3.9 is officially supported in PyDev -- definitely a must if you plan on using Python 3.9! There are quick-fixes ( Ctrl+1 ) to convert a string into an f-string (see image below): Note that even…

PyDev 8.0 released (17 years of PyDev, typing support, MyPy and Debugger)

Wow, PyDev is turning 8.0... the 8.0 version probably doesn't do much justice as it's actually being developed for 17 years already! 😊 I'm actually pretty happy on how things are working around it right now... Some interesting points: Many users now support PyDev through Patreon or PayPal -- so, it's been a while since I spent time to do a dedicated crowdfunding campaign (which usually demands…

PyDev 7.7.0 released (mypy integration improvements, namespace packages)

This release brings multiple improvements for dealing with type hints as well as improvements in the Mypy integration in PyDev: The MYPYPATH can now be set automatically to the source folders set on PyDev and the --follow-imports flag is set to silent by default (this flag is required because only one file is analyzed at a time in PyDev as failing to do so would end up showing errors for other…

PyDev 7.6.0 (Python 3.8 parsing fixes and debugger improvements)

PyDev 7.6.0 is now available for download. This release brings multiple fixes to parsing the Python 3.8 grammar (in particular, dealing with f-strings and iterable unpacking had some corner cases that weren't well supported). Also, the debugger had a number of improvements, such as: Grouping variables which were previously hidden -- note that they can be hidden/shown when debugging from the…

How is frame evaluation used in pydevd?

First some background in frame evaluation: Since Python 3.6, CPython has a mechanism which allows clients to override how it evaluates frames. This is done by changing PyThreadState.interp.eval_frame to a different C-function (the default being _PyEval_EvalFrameDefault ). See: pydevd_frame_evaluator.pyx#L370 in pydevd (note that Cython is used there). Note that this affects the Python runtime…

PyDev 7.5.0 Released (Python 3.8 and Cython)

PyDev 7.5.0 is now available for download. The major changes in this release are Python 3.8 support and improved Cython parsing. Python 3.8 should've been in 7.4.0 (but because of an oversight on my part during the build it wasn't, so, this release fixes that). As for the Cyhon AST, Cython is now parsed using Cython itself (so, it needs to be installed and available in the default interpreter for…

PyDev 7.2.0 released

PyDev 7.2.0 is now available for download. This version brings some improvements to the debugger and a fix for when PyDev could not properly find pipenv which could impact some users. See: http://pydev.org for more details.

PyDev 7.0 (mypy, black, pipenv, faster debugger)

PyDev 7.0 (actually, PyDev 7.0.3 after some critical bugfixes on 7.0.0) is now available. Some of the improvements available in this version include: Mypy may be used as an additional backend for code analysis (see the preferences in the Preferences > PyDev > Editor > Code Analysis > Mypy ). It is is similar to the PyLint integration, and will run Mypy whenever a file is saved in the editor. Black…

PyDev 6.5.0 (#region code folding)

PyDev 6.5.0 is now available for download. There are some nice features and fixes available in this release: #region / #endregion comments can now be used by the code-folding engine. An action to easily switch the default interpreter is now available (default binding: Ctrl+Shift+Alt+I -- note that it must be executed with an opened editor). It's possible to create local imports from global imports…

Profiling pytest startup

I'm a fan of pytest ( http://www.pytest.org ), yet, it seems that the startup time for running tests locally in the app I'm working on is slowly ramping up, so, I decided to do a profile to see if there was anything I could do to improve that. The first thing I did was creating a simple test and launching it from the PyDev ( http://www.pydev.org/ ) profile view -- it enables any launch done in…

PyDev 6.4.3 (code formatter standalone, debugger improvements and f-strings handling)

The latest version of PyDev is now out... Major changes in this release include: 1. Being able to use the PyDev code formatter as a standalone tool. To use it it's possible to install it as pip install pydevf (the command line is provided as a python library which will call the actual formatter from PyDev -- see the README at https://github.com/fabioz/PyDev.Formatter for more details on how to use…

Howto launch and debug in VSCode using the debug adapter protocol (part 2)

Ok, after the basic infracstructure, the next thing to do is actually launch some program without worrying about the debugger, so, we'll just run a program without being in debug mode to completion, show its output and terminate it when requested. To launch a program, our debug adapter must treat the ' LaunchRequest ' message and actually run the program (bear in mind that we'll just launch it…

Howto launch and debug in VSCode using the debug adapter protocol (part 1)

This is a walkthrough with the steps I'm taking to add support to launch and debug a Python script in PyDev for VSCode (note that I'm writing as I'm learning). The debugger protocol is the protocol used in VSCode to talk to debuggers and handle launching in general (the naming may be a bit weird as the same protocol is used for regular launches and debugging, but apparently the team first did the…

PyDev 6.3.2: support for .pyi files

PyDev 6.3.2 is now available for download. The main change in this release is that PyDev will now consider .pyi (stub) files when doing type inference, although there's still a shortcoming: the .pyi file must be in the same directory where the typed .py file is and it's still not possible to use it to get type inference for modules which are compiled (for instance PyQt). I hope to address that in…

PyDev 6.3.1 (implicit namespace packages and Visual Studio Code support)

The major change in this release is that PyDev now recognizes that folders no longer require __init__.py files to be considered a package ( PEP 420 ). Although this is only available for Python 3.3 onwards, PyDev will now always display valid folders under the PYTHONPATH as if they were packages. There were also some improvements, such as recognizing that dlls may have a postfix (so that dlls for…

Python with PyDev on Visual Studio Code

PyDev can now be used for Python development on Visual Studio Code ! The first release already provides features such as code analysis, code completion, go to definition, symbols for the workspace and editor, code formatting, find references, quick fixes and more (see http://www.pydev.org/vscode/ for details). All features have a strong focus on speed and have been shaped by the usage on PyDev…

Creating extension to profile Python with PyVmMonitor from Visual Studio Code

Ok, so, the target here is doing a simple extension with Visual Studio Code which will help in profiling the current module using PyVmMonitor ( http://www.pyvmmonitor.com/ ). The extension will provide a command which should open a few options for the user on how he wants to do the profile (with yappi , cProfile or start without profiling but connected with the live sampling view). I went with…

PyDev 6.2.0: Interactive Console word wrapping, pytest hyperlinking

PyDev 6.2.0 is mostly a bugfix release, although it does bring some features to the table to such as adding the possibility of activating word-wrapping in the console and support for code-completion using the Python 3.6 variable typing. Another interesting change is that pytest filenames are properly hyperlinked in the console (until now PyDev resorted to mocking some functions of pytest so that…