IDE integration#
Once Coord2Region is installed, you can wire your preferred IDE to the same environment so that linting, notebooks, and tests reuse the packages you just installed.
Visual Studio Code#
Open the Coord2Region repository folder in VS Code.
Select the interpreter that points to your virtualenv or conda env (
Ctrl+Shift+P→ Python: Select Interpreter → choose.venvorcoord2region).(Optional) Create a
.vscode/settings.jsonwith the following snippet so terminals pick up the environment for you:{ "python.defaultInterpreterPath": ".venv/bin/python", "terminal.integrated.env.osx": { "PYTHONPATH": "${workspaceFolder}" } }
Use the built-in debugger to run
coord2regionCLI commands by adding alaunch.jsonentry such as:{ "name": "Coord2Region CLI", "type": "python", "request": "launch", "module": "coord2region.cli", "args": ["--help"], "cwd": "${workspaceFolder}" }
PyCharm / IntelliJ#
Go to Settings → Project → Python Interpreter and add the interpreter from your virtualenv or conda environment.
Mark
coord2regionandtestsas source roots so import resolution matchespython -mexecution.Create a Run/Debug Configuration of type Module name with
coord2region.clior run the scripts inscripts/directly for guided configuration.Enable Emulate terminal in output console so environment variables (such as
OPENAI_API_KEY) propagate to the run configuration.
Notebook-friendly workflow#
If you author tutorials or examples in Jupyter or VS Code notebooks, install
ipykernel inside the same environment and register it once:
python -m pip install ipykernel
python -m ipykernel install --user --name coord2region --display-name "Coord2Region"
The interpreter will now appear in IDE kernel selectors, making it easy to test API calls and iterate on documentation examples without leaving the IDE.