Commit Graph

5858 Commits

Author SHA1 Message Date
Dave Halter
ecb922c6ff Fix a few issues around duplicated import paths, fixes #2033
Some checks are pending
ci / tests (3.10, ubuntu-20.04, 3.10) (push) Waiting to run
ci / tests (3.10, ubuntu-20.04, 3.11) (push) Waiting to run
ci / tests (3.10, ubuntu-20.04, 3.12) (push) Waiting to run
ci / tests (3.10, ubuntu-20.04, 3.13) (push) Waiting to run
ci / tests (3.10, ubuntu-20.04, 3.6) (push) Waiting to run
ci / tests (3.10, ubuntu-20.04, 3.7) (push) Waiting to run
ci / tests (3.10, ubuntu-20.04, 3.8) (push) Waiting to run
ci / tests (3.10, ubuntu-20.04, 3.9) (push) Waiting to run
ci / tests (3.10, windows-2019, 3.10) (push) Waiting to run
ci / tests (3.10, windows-2019, 3.11) (push) Waiting to run
ci / tests (3.10, windows-2019, 3.12) (push) Waiting to run
ci / tests (3.10, windows-2019, 3.13) (push) Waiting to run
ci / tests (3.10, windows-2019, 3.6) (push) Waiting to run
ci / tests (3.10, windows-2019, 3.7) (push) Waiting to run
ci / tests (3.10, windows-2019, 3.8) (push) Waiting to run
ci / tests (3.10, windows-2019, 3.9) (push) Waiting to run
ci / tests (3.11, ubuntu-20.04, 3.10) (push) Waiting to run
ci / tests (3.11, ubuntu-20.04, 3.11) (push) Waiting to run
ci / tests (3.11, ubuntu-20.04, 3.12) (push) Waiting to run
ci / tests (3.11, ubuntu-20.04, 3.13) (push) Waiting to run
ci / tests (3.11, ubuntu-20.04, 3.6) (push) Waiting to run
ci / tests (3.11, ubuntu-20.04, 3.7) (push) Waiting to run
ci / tests (3.11, ubuntu-20.04, 3.8) (push) Waiting to run
ci / tests (3.11, ubuntu-20.04, 3.9) (push) Waiting to run
ci / tests (3.11, windows-2019, 3.10) (push) Waiting to run
ci / tests (3.11, windows-2019, 3.11) (push) Waiting to run
ci / tests (3.11, windows-2019, 3.12) (push) Waiting to run
ci / tests (3.11, windows-2019, 3.13) (push) Waiting to run
ci / tests (3.11, windows-2019, 3.6) (push) Waiting to run
ci / tests (3.11, windows-2019, 3.7) (push) Waiting to run
ci / tests (3.11, windows-2019, 3.8) (push) Waiting to run
ci / tests (3.11, windows-2019, 3.9) (push) Waiting to run
ci / tests (3.12, ubuntu-20.04, 3.10) (push) Waiting to run
ci / tests (3.12, ubuntu-20.04, 3.11) (push) Waiting to run
ci / tests (3.12, ubuntu-20.04, 3.12) (push) Waiting to run
ci / tests (3.12, ubuntu-20.04, 3.13) (push) Waiting to run
ci / tests (3.12, ubuntu-20.04, 3.6) (push) Waiting to run
ci / tests (3.12, ubuntu-20.04, 3.7) (push) Waiting to run
ci / tests (3.12, ubuntu-20.04, 3.8) (push) Waiting to run
ci / tests (3.12, ubuntu-20.04, 3.9) (push) Waiting to run
ci / tests (3.12, windows-2019, 3.10) (push) Waiting to run
ci / tests (3.12, windows-2019, 3.11) (push) Waiting to run
ci / tests (3.12, windows-2019, 3.12) (push) Waiting to run
ci / tests (3.12, windows-2019, 3.13) (push) Waiting to run
ci / tests (3.12, windows-2019, 3.6) (push) Waiting to run
ci / tests (3.12, windows-2019, 3.7) (push) Waiting to run
ci / tests (3.12, windows-2019, 3.8) (push) Waiting to run
ci / tests (3.12, windows-2019, 3.9) (push) Waiting to run
ci / tests (3.13, ubuntu-20.04, 3.10) (push) Waiting to run
ci / tests (3.13, ubuntu-20.04, 3.11) (push) Waiting to run
ci / tests (3.13, ubuntu-20.04, 3.12) (push) Waiting to run
ci / tests (3.13, ubuntu-20.04, 3.13) (push) Waiting to run
ci / tests (3.13, ubuntu-20.04, 3.6) (push) Waiting to run
ci / tests (3.13, ubuntu-20.04, 3.7) (push) Waiting to run
ci / tests (3.13, ubuntu-20.04, 3.8) (push) Waiting to run
ci / tests (3.13, ubuntu-20.04, 3.9) (push) Waiting to run
ci / tests (3.13, windows-2019, 3.10) (push) Waiting to run
ci / tests (3.13, windows-2019, 3.11) (push) Waiting to run
ci / tests (3.13, windows-2019, 3.12) (push) Waiting to run
ci / tests (3.13, windows-2019, 3.13) (push) Waiting to run
ci / tests (3.13, windows-2019, 3.6) (push) Waiting to run
ci / tests (3.13, windows-2019, 3.7) (push) Waiting to run
ci / tests (3.13, windows-2019, 3.8) (push) Waiting to run
ci / tests (3.13, windows-2019, 3.9) (push) Waiting to run
ci / tests (3.6, ubuntu-20.04, 3.10) (push) Waiting to run
ci / tests (3.6, ubuntu-20.04, 3.11) (push) Waiting to run
ci / tests (3.6, ubuntu-20.04, 3.12) (push) Waiting to run
ci / tests (3.6, ubuntu-20.04, 3.13) (push) Waiting to run
ci / tests (3.6, ubuntu-20.04, 3.6) (push) Waiting to run
ci / tests (3.6, ubuntu-20.04, 3.7) (push) Waiting to run
ci / tests (3.6, ubuntu-20.04, 3.8) (push) Waiting to run
ci / tests (3.6, ubuntu-20.04, 3.9) (push) Waiting to run
ci / tests (3.6, windows-2019, 3.10) (push) Waiting to run
ci / tests (3.6, windows-2019, 3.11) (push) Waiting to run
ci / tests (3.6, windows-2019, 3.12) (push) Waiting to run
ci / tests (3.6, windows-2019, 3.13) (push) Waiting to run
ci / tests (3.6, windows-2019, 3.6) (push) Waiting to run
ci / tests (3.6, windows-2019, 3.7) (push) Waiting to run
ci / tests (3.6, windows-2019, 3.8) (push) Waiting to run
ci / tests (3.6, windows-2019, 3.9) (push) Waiting to run
ci / tests (3.7, ubuntu-20.04, 3.10) (push) Waiting to run
ci / tests (3.7, ubuntu-20.04, 3.11) (push) Waiting to run
ci / tests (3.7, ubuntu-20.04, 3.12) (push) Waiting to run
ci / tests (3.7, ubuntu-20.04, 3.13) (push) Waiting to run
ci / tests (3.7, ubuntu-20.04, 3.6) (push) Waiting to run
ci / tests (3.7, ubuntu-20.04, 3.7) (push) Waiting to run
ci / tests (3.7, ubuntu-20.04, 3.8) (push) Waiting to run
ci / tests (3.7, ubuntu-20.04, 3.9) (push) Waiting to run
ci / tests (3.7, windows-2019, 3.10) (push) Waiting to run
ci / tests (3.7, windows-2019, 3.11) (push) Waiting to run
ci / tests (3.7, windows-2019, 3.12) (push) Waiting to run
ci / tests (3.7, windows-2019, 3.13) (push) Waiting to run
ci / tests (3.7, windows-2019, 3.6) (push) Waiting to run
ci / tests (3.7, windows-2019, 3.7) (push) Waiting to run
ci / tests (3.7, windows-2019, 3.8) (push) Waiting to run
ci / tests (3.7, windows-2019, 3.9) (push) Waiting to run
ci / tests (3.8, ubuntu-20.04, 3.10) (push) Waiting to run
ci / tests (3.8, ubuntu-20.04, 3.11) (push) Waiting to run
ci / tests (3.8, ubuntu-20.04, 3.12) (push) Waiting to run
ci / tests (3.8, ubuntu-20.04, 3.13) (push) Waiting to run
ci / tests (3.8, ubuntu-20.04, 3.6) (push) Waiting to run
ci / tests (3.8, ubuntu-20.04, 3.7) (push) Waiting to run
ci / tests (3.8, ubuntu-20.04, 3.8) (push) Waiting to run
ci / tests (3.8, ubuntu-20.04, 3.9) (push) Waiting to run
ci / tests (3.8, windows-2019, 3.10) (push) Waiting to run
ci / tests (3.8, windows-2019, 3.11) (push) Waiting to run
ci / tests (3.8, windows-2019, 3.12) (push) Waiting to run
ci / tests (3.8, windows-2019, 3.13) (push) Waiting to run
ci / tests (3.8, windows-2019, 3.6) (push) Waiting to run
ci / tests (3.8, windows-2019, 3.7) (push) Waiting to run
ci / tests (3.8, windows-2019, 3.8) (push) Waiting to run
ci / tests (3.8, windows-2019, 3.9) (push) Waiting to run
ci / tests (3.9, ubuntu-20.04, 3.10) (push) Waiting to run
ci / tests (3.9, ubuntu-20.04, 3.11) (push) Waiting to run
ci / tests (3.9, ubuntu-20.04, 3.12) (push) Waiting to run
ci / tests (3.9, ubuntu-20.04, 3.13) (push) Waiting to run
ci / tests (3.9, ubuntu-20.04, 3.6) (push) Waiting to run
ci / tests (3.9, ubuntu-20.04, 3.7) (push) Waiting to run
ci / tests (3.9, ubuntu-20.04, 3.8) (push) Waiting to run
ci / tests (3.9, ubuntu-20.04, 3.9) (push) Waiting to run
ci / tests (3.9, windows-2019, 3.10) (push) Waiting to run
ci / tests (3.9, windows-2019, 3.11) (push) Waiting to run
ci / tests (3.9, windows-2019, 3.12) (push) Waiting to run
ci / tests (3.9, windows-2019, 3.13) (push) Waiting to run
ci / tests (3.9, windows-2019, 3.6) (push) Waiting to run
ci / tests (3.9, windows-2019, 3.7) (push) Waiting to run
ci / tests (3.9, windows-2019, 3.8) (push) Waiting to run
ci / tests (3.9, windows-2019, 3.9) (push) Waiting to run
ci / tests (interpreter, ubuntu-20.04, 3.10) (push) Waiting to run
ci / tests (interpreter, ubuntu-20.04, 3.11) (push) Waiting to run
ci / tests (interpreter, ubuntu-20.04, 3.12) (push) Waiting to run
ci / tests (interpreter, ubuntu-20.04, 3.13) (push) Waiting to run
ci / tests (interpreter, ubuntu-20.04, 3.6) (push) Waiting to run
ci / tests (interpreter, ubuntu-20.04, 3.7) (push) Waiting to run
ci / tests (interpreter, ubuntu-20.04, 3.8) (push) Waiting to run
ci / tests (interpreter, ubuntu-20.04, 3.9) (push) Waiting to run
ci / tests (interpreter, windows-2019, 3.10) (push) Waiting to run
ci / tests (interpreter, windows-2019, 3.11) (push) Waiting to run
ci / tests (interpreter, windows-2019, 3.12) (push) Waiting to run
ci / tests (interpreter, windows-2019, 3.13) (push) Waiting to run
ci / tests (interpreter, windows-2019, 3.6) (push) Waiting to run
ci / tests (interpreter, windows-2019, 3.7) (push) Waiting to run
ci / tests (interpreter, windows-2019, 3.8) (push) Waiting to run
ci / tests (interpreter, windows-2019, 3.9) (push) Waiting to run
ci / code-quality (push) Waiting to run
ci / coverage (push) Waiting to run
2024-11-25 00:53:09 +01:00
Dave Halter
41e9e957e7 Increase Jedi version 2024-11-11 02:39:18 +01:00
wutingjia
be6df62434 filter imported names during completion 2024-10-17 19:20:39 +08:00
Nguyễn Hồng Quân
91ffdead32 Sort completions by input resemblance. (#2018)
* Sort completions by input resemblance.

Fixes #2017

* Clean code
2024-07-15 08:15:20 +00:00
WutingjiaX
2859e4f409 Support inferring not expr to bool (#2016)
* support inferring some not expr

* format

---------

Co-authored-by: wutingjia <wutingjia@bytedance.com>
2024-07-12 12:58:39 +00:00
wutingjia
4d09ac07e4 When inferring comparison operators, return a definite type instead of NO_VALUES for the in/not in operator 2024-07-10 11:20:11 +08:00
Peter Law
255186376e Cope with Python 3.13 moving pathlib's implementation
Jedi passes pickles to subprocesses which are running the target
version of Python and thus may not be the same as the version
under which Jedi itself is running. In Python 3.13, pathlib is
being refactored to allow for easier extension and has thus moved
most of its internal implementation to a submodule. Unfortunately
this changes the paths of the symbols, causing pickles of those
types to fail to load in earlier versions of Python.

This commit introduces a custom unpickler which accounts for this
move, allowing bi-directional passing of pickles to work.
2024-07-02 21:37:34 +01:00
Peter Law
d543d1d004 Support Python 3.13
This moves to using the 3.13 grammar as well as testing 3.13 in CI.
2024-07-02 21:37:34 +01:00
Peter Law
a67deeb602 Fix race condition around subprocess inference state tidyup
There was a race condition due to the combination of Python's
object ids being re-usable and Jedi persisting such ids beyond
the real lifeteime of some objects. This could lead to the
subprocess' view of the lifetime of `InferenceState` contexts
getting out of step with that in the parent process and
resulting in errors when removing them. It is also possible
that this could result in erroneous results being reported,
however this was not directly observed.

The race was specifically:
- `InferenceState` A created, gets id 1
- `InferenceStateSubprocess` A' created, uses `InferenceState`
  A which it stores as a weakref and an id
- `InferenceStateSubprocess` A' is used, the sub-process learns
  about an `InferenceState` with id 1
- `InferenceState` A goes away, `InferenceStateSubprocess` A' is
  not yet garbage collected
- `InferenceState` B created, gets id 1
- `InferenceStateSubprocess` B' created, uses `InferenceState` B
  which it stores as a weakref and an id
- `InferenceStateSubprocess` B' is used, the sub-process re-uses
  its entry for an `InferenceState` with id 1

At this point the order of operations between the two
`InferenceStateSubprocess` instances going away is immaterial --
both will trigger a removal of a state with id 1. As long as B'
doesn't try to use the sub-process again after the first removal
has happened then the second removal will fail.

This commit resolves the race condition by coupling the context
in the subprocess to the corresponding manager class instance
in the parent process, rather than to the consumer `InferenceState`.

See inline comments for further details.
2024-07-02 21:37:34 +01:00
Peter Law
9d18b7c36d Document how Jedi manages its subprocesses
This is derived from my understanding of the code, plus a bit of
experimentation.
2024-07-02 21:37:34 +01:00
Peter Law
fff6e0ce2e Drop unused member
I'm not sure where this was used in the past, however it appears
to be unused now. Removing this simplifies a change I'm about to
make to _InferenceStateProcess.
2024-07-02 21:37:34 +01:00
Peter Law
a0527a5af5 Pass through the inference state id rather than recomputing it
This removes some of the coupling between the management of the
underlying process and the inference state itself, which intends
to enable changing the origin of the id. This will be useful in
the next commit.
2024-07-02 21:37:34 +01:00
HairlessVillager
8792c6d432 Add a windows path in _get_executable_path() 2024-05-06 17:04:38 +08:00
pyscripter
a4574a50d0 Fix resolving of names that are not annotations (#1989), fixes #1988
* Fix #1988

* Fix failing code quality test.

* Fix  flake W504 line break after binary operator.  Now as formatted by Black.

* Added test to test/completion/pep0484_basic.py
Addressed feedback from Dave
2024-04-25 09:11:24 +00:00
Ehsan Iran-Nejad
54a6dadde3 properties with setters are now reported as 'property' for completion (#1983)
* properties with setters are now reported as 'property' for completion

* code cleanups

* fixed test

* fixed tests

* Revert "fixed test"

This reverts commit a80c955a48.

* code quality cleanup

* so picky

* Revert "Revert "fixed test""

This reverts commit 58dfc5292e.

* updated test per maintainer comments #1983

* removed extra char
2024-02-19 12:07:47 +00:00
Martin Vielsmaier
950ce70239 Prioritize conftest over plugins for pytest fixtures 2024-01-26 10:39:15 +01:00
Martin Vielsmaier
6982a49977 Fix codestyle 2024-01-24 13:11:26 +01:00
Martin Vielsmaier
9b8cece7ef Improve pytest plugin loading 2024-01-23 20:54:21 +01:00
Martin Vielsmaier
162034b387 Fix line length. 2024-01-23 20:54:21 +01:00
Martin Vielsmaier
7d77f61040 Add support for pytest fixtures from local pytest plugins. 2024-01-23 20:54:21 +01:00
HairlessVillager
94ec4b873a Fix some misalignment of docstrings 2023-12-28 13:26:12 +08:00
Dave Halter
4e175ca82b Prepare for release 0.19.1 2023-10-02 10:55:17 +02:00
Peter Law
770cdade00 Claim support for Python 3.12 2023-09-16 21:41:06 +01:00
Dave Halter
51f4a99a1e Bump version to 0.19.0 2023-07-29 00:57:34 +02:00
Dave Halter
57aefed6ea Allow unsafe custom __getitem__ executions when allow unsafe executions is on 2023-07-29 00:33:09 +02:00
Dave Halter
8a4b079d0f allow_descriptor_getattr -> allow_unsafe_interpreter_executions 2023-07-29 00:06:55 +02:00
Dave Halter
62cbcb0844 Make nested dict completions possible.
See also https://github.com/ipython/ipython/issues/13866
2023-07-28 23:50:38 +02:00
Dave Halter
d8420d0f72 Add a note to the changelog 2023-07-28 22:59:03 +02:00
Dave Halter
886279fb6d Try to use the return annotations of properties, if available, fixes #1933 2023-07-28 22:35:15 +02:00
Dave Halter
ff3a7f367f Avoid evaluating properties just for the api type, improves #1933 2023-07-28 22:11:15 +02:00
Dave Halter
1f70e3301e Revert "Avoid one layer of caching that is probably useless"
This reverts commit a34c348a55.
2023-07-28 16:10:30 +02:00
Dave Halter
a34c348a55 Avoid one layer of caching that is probably useless 2023-07-28 16:05:56 +02:00
Dave Halter
972123c9c9 Introduce the property return annotation 2023-07-28 15:54:54 +02:00
Dave Halter
6455a14841 Avoid multiple getattrs instead of a single one, see also #1933 2023-07-28 15:10:37 +02:00
Dave Halter
8d9e3ab3a7 Simplify 2023-07-28 13:10:26 +02:00
Dave Halter
048173e467 Remove a piece of unimportant code, see discussion in #1933 2023-07-28 10:15:28 +02:00
Dave Halter
1947e7dd56 Avoid dynamic params search for Interpreter, fixes #1899 2023-07-27 13:49:27 +02:00
Dave Halter
01d8da8f73 Reset the recursion limitations at the start of the main Script calls, fixes #1796 2023-07-27 13:14:24 +02:00
Dave Halter
6ea5ad7b19 Fix issue around completions with multiple with with_items, fixes 1931 2023-07-27 11:54:39 +02:00
Dave Halter
cd4ca74d7a Satisfy flake8 2023-07-27 11:36:16 +02:00
Dave Halter
5f19237a3e Fix renaming of namespace packages, fixes #1779 2023-07-27 03:09:25 +02:00
Luc Khai Hai
72d34f3d7d Support typing.Annotated inference 2023-06-17 20:46:03 +09:00
Peter Law
a28bd24bef Merge branch 'importlib-metadata-entry-points' 2023-05-28 12:08:09 +01:00
Peter Law
54cb64292c Support importlib.metadata entry points for newer python
pkg_resources is deprecated and liable to be dropped at some point.
2023-05-28 11:48:19 +01:00
Peter Law
c137eb6918 Modernise importlib usage
`find_module` is deprecated in all supported version of Python and
is slated for removal in the upcoming 3.12. Happily it seems we
can move to the related `find_spec` and just hoist the loader from
the spec which that returns. (This is mostly what current `find_module`
implementations do anyway).
2023-05-27 22:03:51 +01:00
Peter Law
483e78993d attrs' frozen decorator also acts like a dataclass
In 23.1.0 (specifically in 46053d703d)
the definition of the `frozen` decorator was tweaked slightly, such
that its type stub is separate from that for `define`. This means
that Jedi needs to be told about it as a separate member.

I've manually checked that this still works with the prior version
of `attrs`.

Fixes https://github.com/davidhalter/jedi/issues/1929
2023-05-27 00:13:55 +01:00
Peter Law
ca36fcfa4b Fix typo in comment 2023-05-26 21:38:42 +01:00
David Hotham
0fbc2aafa3 fix help when in column zero 2023-03-12 14:21:09 +00:00
Peter Law
67e0bec597 Support Python 3.11
This adds support for targetting Python 3.11 via picking up the
latest grammar from parso while also validating support for running
on 3.11 by adding it to the CI matrix.
2023-02-13 19:58:35 +00:00
Peter Law
bbd5bcf3ca Merge branch 'update-mypy' 2023-02-13 19:57:20 +00:00