### Install Jedi manually from GitHub Source: https://github.com/davidhalter/jedi/blob/master/docs/docs/installation.rst Clones the repository and installs the library using the setup script. ```default git clone --recurse-submodules https://github.com/davidhalter/jedi cd jedi sudo python setup.py install ``` -------------------------------- ### Install Graphviz Source: https://github.com/davidhalter/jedi/blob/master/docs/README.md Installs the graphviz library using apt-get. ```bash sudo apt-get install graphviz ``` -------------------------------- ### Install Sphinx Source: https://github.com/davidhalter/jedi/blob/master/docs/README.md Installs the sphinx documentation generator using pip. ```bash sudo pip install sphinx ``` -------------------------------- ### Install pytest dependency Source: https://github.com/davidhalter/jedi/blob/master/docs/docs/testing.rst Install the required testing framework using pip. ```bash pip install pytest ``` -------------------------------- ### Install Jedi via pip Source: https://github.com/davidhalter/jedi/blob/master/docs/docs/installation.rst Standard installation command for the Jedi library using the Python package index. ```default sudo pip install jedi ``` -------------------------------- ### Install Python Graphviz Interface Source: https://github.com/davidhalter/jedi/blob/master/docs/README.md Installs the Python interface for graphviz using pip. ```bash sudo pip install graphviz ``` -------------------------------- ### Install Jedi development version Source: https://github.com/davidhalter/jedi/blob/master/docs/docs/installation.rst Installs the current master branch directly from the GitHub repository. ```default sudo pip install -e git+https://github.com/davidhalter/jedi.git#egg=jedi ``` -------------------------------- ### Perform code completion with Jedi Source: https://github.com/davidhalter/jedi/blob/master/docs/docs/api.rst Use jedi.Script to initialize a script and call complete() to retrieve completion candidates for a specific position. ```python >>> import jedi >>> code = '''import json; json.l''' >>> script = jedi.Script(code, path='example.py') >>> script > >>> completions = script.complete(1, 19) >>> completions [, ] >>> completions[1] >>> completions[1].complete 'oads' >>> completions[1].name 'loads' ``` -------------------------------- ### Function Annotations for Type Hinting Source: https://github.com/davidhalter/jedi/blob/master/docs/docs/usage.rst Use PEP 484 function annotations to help Jedi identify argument types. ```default def myfunction(node: ProgramNode, foo: str) -> None: """Do something with a ``node``. """ node.| # complete here ``` -------------------------------- ### Enable Jedi in xonsh shell Source: https://github.com/davidhalter/jedi/blob/master/docs/docs/usage.rst Use this command to load the Jedi extension within the xonsh shell environment. ```default xontrib load jedi ``` -------------------------------- ### Assignment and Loop Type Hints Source: https://github.com/davidhalter/jedi/blob/master/docs/docs/usage.rst Apply type hints to variables, loops, and context managers using PEP 484 syntax. ```default import typing x: int = foo() y: typing.Optional[int] = 3 key: str value: Employee for key, value in foo.items(): pass f: Union[int, float] with foo() as f: print(f + 3) ``` -------------------------------- ### Numpydoc Style Type Hinting Source: https://github.com/davidhalter/jedi/blob/master/docs/docs/usage.rst Use Numpydoc format for detailed parameter documentation, requiring the numpydoc package. ```default def foo(var1, var2, long_var_name='hi'): r""" A one-line summary that does not use variable names or the function name. ... Parameters ---------- var1 : array_like Array_like means all those objects -- lists, nested lists, etc. -- that can be converted to an array. We can also refer to variables like `var1`. var2 : int The type above can either refer to an actual Python type (e.g. ``int``), or describe the type of the variable in more detail, e.g. ``(N,) ndarray`` or ``array_like``. long_variable_name : {'hi', 'ho'}, optional Choices in brackets, default first when optional. ... """ var2.| # complete here ``` -------------------------------- ### Sphinx Style Type Hinting Source: https://github.com/davidhalter/jedi/blob/master/docs/docs/usage.rst Use Sphinx-style docstrings to define parameter types for Jedi analysis. ```default def myfunction(node, foo): """ Do something with a ``node``. :type node: ProgramNode :param str foo: foo parameter description """ node.| # complete here ``` -------------------------------- ### Perform type inference and goto definition Source: https://github.com/davidhalter/jedi/blob/master/docs/docs/api.rst Use script.goto() to find definitions and script.infer() to determine the type of an expression at a given line and column. ```python >>> import jedi >>> code = '''\ ... def my_func(): ... print 'called' ... ... alias = my_func ... my_list = [1, None, alias] ... inception = my_list[2] ... ... inception()''' >>> script = jedi.Script(code) >>> >>> script.goto(8, 1) [] >>> >>> script.infer(8, 1) [] ``` -------------------------------- ### Environment Management Source: https://github.com/davidhalter/jedi/blob/master/docs/docs/api.rst Functions for managing Python environments and virtualenvs. ```APIDOC ## Environment Functions ### find_system_environments() Returns a list of system-wide Python environments. ### find_virtualenvs() Returns a list of virtual environments found in the system. ``` -------------------------------- ### jedi.Script Source: https://github.com/davidhalter/jedi/blob/master/docs/docs/api.rst The primary class for interacting with Jedi. It allows for code completion, goto definition, and type inference based on provided source code. ```APIDOC ## jedi.Script(code, path=None) ### Description Initializes a new Script object to perform static analysis on the provided source code. ### Methods - **complete(line, column)**: Returns a list of completions for the given position. - **goto(line, column)**: Returns a list of definitions for the symbol at the given position. - **infer(line, column)**: Returns a list of inferred types for the symbol at the given position. - **get_references(line, column)**: Returns a list of references for the symbol at the given position. ``` -------------------------------- ### Update Typeshed in Jedi Source: https://github.com/davidhalter/jedi/blob/master/jedi/third_party/README_typeshed.md Follow these Git commands to update the Typeshed fork used by Jedi. Ensure you are in the correct directory and handle merge conflicts by prioritizing Jedi's commit. ```bash cd jedi/third_party/typeshed git remote add upstream https://github.com/python/typeshed git fetch upstream git checkout jedi git rebase upstream/master git push -f git push cd ../../.. git commit jedi/third_party/typeshed -m "Upgrade typeshed" ``` -------------------------------- ### Epydoc Style Type Hinting Source: https://github.com/davidhalter/jedi/blob/master/docs/docs/usage.rst Use Epydoc-style docstrings to specify types for function arguments. ```default def myfunction(node): """ Do something with a ``node``. @type node: ProgramNode """ node.| # complete here ``` -------------------------------- ### Find code references Source: https://github.com/davidhalter/jedi/blob/master/docs/docs/api.rst Use script.get_references() to locate all occurrences of a name at a specific position in the code. ```python >>> import jedi >>> code = '''\ ... x = 3 ... if 1 == 2: ... x = 4 ... else: ... del x''' >>> script = jedi.Script(code) >>> rns = script.get_references(5, 8) >>> rns [, , ] >>> rns[1].line 3 >>> rns[1].column 4 ``` -------------------------------- ### Run tests for a specific Python version Source: https://github.com/davidhalter/jedi/blob/master/docs/docs/testing.rst Execute the test suite using a specific Python interpreter version. ```bash python3.14 -m pytest ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.