We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Add PYODIDE_MINIMAL build option
From the added documentation,

> Minimal pyodide build can be enabled by setting the `PYODIDE_MINIMAL`
environment variable.  For instance,
> ```            
> PYODIDE_MINIMAL=true PYODIDE_PACKAGES="micropip" make
> ```            
>                
> This will,
>  - not include freetype and libpng libraries (it won't be possible to build matplotlib)
>  - not include the jedi library, disabling auto-completion in iodide
> 
> As as a result the size will of the core pyodide binaries will be ~15% smaller.

Addresses two points from https://github.com/iodide-project/pyodide/issues/646

Before (master),
```
6,6M  pyodide.asm.data
310K  pyodide.asm.data.js
2,8M  pyodide.asm.js
 11M  pyodide.asm.wasm
 16K  pyodide.js
 16K  pyodide_dev.js

Total: 20.7 MB
```
after (this PR with PYODIDE_MINIMAL=true)
```
5,1M  build/pyodide.asm.data
124K  build/pyodide.asm.data.js
2,6M  build/pyodide.asm.js
9,9M  build/pyodide.asm.wasm
 16K  build/pyodide.js
 16K  build/pyodide_dev.js

Total: 17.7 MB
```

so it's not that different (14% less), but it's start. 

Draft PR for now, as I think I need to go in a bit more details through tests that are run in the minimal build CI job.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/pyodide-py/pyodide/console.py`
Content:
```
1 from typing import List, Optional
2 
3 
4 def get_completions(
5     code: str, cursor: Optional[int] = None, namespaces: Optional[List] = None
6 ) -> List[str]:
7     """
8     Get code autocompletion candidates
9 
10     Note that this function requires to have the jedi module loaded.
11 
12     Parameters
13     ----------
14     code
15        the Python code to complete.
16     cursor
17        optional position in the code at which to autocomplete
18     namespaces
19        a list of namespaces
20 
21     Returns
22     -------
23     a list of autocompleted modules
24     """
25     import jedi
26     import __main__
27 
28     if namespaces is None:
29         namespaces = [__main__.__dict__]
30 
31     if cursor is None:
32         cursor = len(code)
33     code = code[:cursor]
34     interp = jedi.Interpreter(code, namespaces)
35     completions = interp.completions()
36 
37     return [x.name for x in completions]
38
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/pyodide-py/pyodide/console.py b/src/pyodide-py/pyodide/console.py
--- a/src/pyodide-py/pyodide/console.py
+++ b/src/pyodide-py/pyodide/console.py
@@ -32,6 +32,6 @@
         cursor = len(code)
     code = code[:cursor]
     interp = jedi.Interpreter(code, namespaces)
-    completions = interp.completions()
+    completions = interp.complete()
 
     return [x.name for x in completions]

{"golden_diff": "diff --git a/src/pyodide-py/pyodide/console.py b/src/pyodide-py/pyodide/console.py\n--- a/src/pyodide-py/pyodide/console.py\n+++ b/src/pyodide-py/pyodide/console.py\n@@ -32,6 +32,6 @@\n         cursor = len(code)\n     code = code[:cursor]\n     interp = jedi.Interpreter(code, namespaces)\n-    completions = interp.completions()\n+    completions = interp.complete()\n \n     return [x.name for x in completions]\n", "issue": "Add PYODIDE_MINIMAL build option\nFrom the added documentation,\r\n\r\n> Minimal pyodide build can be enabled by setting the `PYODIDE_MINIMAL`\r\nenvironment variable.  For instance,\r\n> ```            \r\n> PYODIDE_MINIMAL=true PYODIDE_PACKAGES=\"micropip\" make\r\n> ```            \r\n>                \r\n> This will,\r\n>  - not include freetype and libpng libraries (it won't be possible to build matplotlib)\r\n>  - not include the jedi library, disabling auto-completion in iodide\r\n> \r\n> As as a result the size will of the core pyodide binaries will be ~15% smaller.\r\n\r\nAddresses two points from https://github.com/iodide-project/pyodide/issues/646\r\n\r\nBefore (master),\r\n```\r\n6,6M  pyodide.asm.data\r\n310K  pyodide.asm.data.js\r\n2,8M  pyodide.asm.js\r\n 11M  pyodide.asm.wasm\r\n 16K  pyodide.js\r\n 16K  pyodide_dev.js\r\n\r\nTotal: 20.7 MB\r\n```\r\nafter (this PR with PYODIDE_MINIMAL=true)\r\n```\r\n5,1M  build/pyodide.asm.data\r\n124K  build/pyodide.asm.data.js\r\n2,6M  build/pyodide.asm.js\r\n9,9M  build/pyodide.asm.wasm\r\n 16K  build/pyodide.js\r\n 16K  build/pyodide_dev.js\r\n\r\nTotal: 17.7 MB\r\n```\r\n\r\nso it's not that different (14% less), but it's start. \r\n\r\nDraft PR for now, as I think I need to go in a bit more details through tests that are run in the minimal build CI job.\n", "before_files": [{"content": "from typing import List, Optional\n\n\ndef get_completions(\n    code: str, cursor: Optional[int] = None, namespaces: Optional[List] = None\n) -> List[str]:\n    \"\"\"\n    Get code autocompletion candidates\n\n    Note that this function requires to have the jedi module loaded.\n\n    Parameters\n    ----------\n    code\n       the Python code to complete.\n    cursor\n       optional position in the code at which to autocomplete\n    namespaces\n       a list of namespaces\n\n    Returns\n    -------\n    a list of autocompleted modules\n    \"\"\"\n    import jedi\n    import __main__\n\n    if namespaces is None:\n        namespaces = [__main__.__dict__]\n\n    if cursor is None:\n        cursor = len(code)\n    code = code[:cursor]\n    interp = jedi.Interpreter(code, namespaces)\n    completions = interp.completions()\n\n    return [x.name for x in completions]\n", "path": "src/pyodide-py/pyodide/console.py"}], "after_files": [{"content": "from typing import List, Optional\n\n\ndef get_completions(\n    code: str, cursor: Optional[int] = None, namespaces: Optional[List] = None\n) -> List[str]:\n    \"\"\"\n    Get code autocompletion candidates\n\n    Note that this function requires to have the jedi module loaded.\n\n    Parameters\n    ----------\n    code\n       the Python code to complete.\n    cursor\n       optional position in the code at which to autocomplete\n    namespaces\n       a list of namespaces\n\n    Returns\n    -------\n    a list of autocompleted modules\n    \"\"\"\n    import jedi\n    import __main__\n\n    if namespaces is None:\n        namespaces = [__main__.__dict__]\n\n    if cursor is None:\n        cursor = len(code)\n    code = code[:cursor]\n    interp = jedi.Interpreter(code, namespaces)\n    completions = interp.complete()\n\n    return [x.name for x in completions]\n", "path": "src/pyodide-py/pyodide/console.py"}]}