---
title: environment | CodeWeaver Docs
description: API reference for codeweaver.core.utils.environment
url: "https://docs.knitli.com/api/core/utils/environment"
type: static
generatedAt: "2026-04-17T17:21:08.282Z"
---

# environment
       [Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Futils%2Fenvironment%2F.%20I%20want%20to%20ask%20questions%20about%20it.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Futils%2Fenvironment%2F.%20I%20want%20to%20ask%20questions%20about%20it.)[View in Markdown](/codeweaver/api/core/utils/environment.md)       [Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Futils%2Fenvironment%2F)[Share on X](https://x.com/intent/tweet?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Futils%2Fenvironment%2F&text=environment)[Share on Threads](https://threads.net/intent/post?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Futils%2Fenvironment%2F&text=environment)[Share on Bluesky](https://bsky.app/intent/compose?text=environment%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Futils%2Fenvironment%2F)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Futils%2Fenvironment%2F)[Share on Reddit](https://reddit.com/submit?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Futils%2Fenvironment%2F&title=environment)[Share on Hacker News](https://news.ycombinator.com/submitlink?u=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Futils%2Fenvironment%2F&t=environment)[Share on Email](mailto:?subject=environment&body=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Futils%2Fenvironment%2F)[Share on WhatsApp](https://wa.me/?text=environment%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Futils%2Fenvironment%2F)[Share on Telegram](https://t.me/share/url?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Futils%2Fenvironment%2F&text=environment)
# `codeweaver.core.utils.environment`
[Section titled “codeweaver.core.utils.environment”](#codeweavercoreutilsenvironment)
Utilities for detecting and determining the environment.

## Function: `detect_root_package`
[Section titled “Function: detect_root_package”](#function-detect_root_package)

**

```
detect_root_package()
```

Detect which package should be root based on what’s installed.

Priority (highest to lowest):

 1. code-weaver-server (full installation)
 1. code-weaver-engine (indexing/chunking only)
 1. code-weaver-providers (providers only)
 1. core (minimal - logging/telemetry only)

Returns: The package type that should serve as root settings

## Function: `find_qdrant_instance`
[Section titled “Function: find_qdrant_instance”](#function-find_qdrant_instance)

**

```
find_qdrant_instance()
```

Attempt to find the port of a local qdrant instance.

## Function: `format_file_link`
[Section titled “Function: format_file_link”](#function-format_file_link)

**

```
format_file_link()
```

Format a file link for IDEs that support it (VSCode, JetBrains).

## Function: `get_codeweaver_config_paths`
[Section titled “Function: get_codeweaver_config_paths”](#function-get_codeweaver_config_paths)

**

```
get_codeweaver_config_paths()
```

Get all possible CodeWeaver configuration file paths.

## Function: `get_codeweaver_prefix`
[Section titled “Function: get_codeweaver_prefix”](#function-get_codeweaver_prefix)

**

```
get_codeweaver_prefix()
```

Return the codeweaver terminal prefix.

## Function: `get_possible_env_vars`
[Section titled “Function: get_possible_env_vars”](#function-get_possible_env_vars)

**

```
get_possible_env_vars()
```

Get a tuple of any resolved environment variables for all providers.

## Function: `get_terminal_width`
[Section titled “Function: get_terminal_width”](#function-get_terminal_width)

**

```
get_terminal_width()
```

Get the terminal width.

## Function: `in_ide`
[Section titled “Function: in_ide”](#function-in_ide)

**

```
in_ide()
```

Detect if we are running inside an IDE.

## Function: `is_codeweaver_config_path`
[Section titled “Function: is_codeweaver_config_path”](#function-is_codeweaver_config_path)

**

```
is_codeweaver_config_path()
```

Check if the given path is a CodeWeaver configuration file path.

## Function: `is_tty`
[Section titled “Function: is_tty”](#function-is_tty)

**

```
is_tty()
```

Check if the output is a TTY in an interactive terminal.

## Function: `qdrant_instance_live_at_port`
[Section titled “Function: qdrant_instance_live_at_port”](#function-qdrant_instance_live_at_port)

**

```
qdrant_instance_live_at_port()
```

Check if a Qdrant instance is live at the given port.

## Function: `settings_type_for_root_package`
[Section titled “Function: settings_type_for_root_package”](#function-settings_type_for_root_package)

**

```
settings_type_for_root_package()
```

Get the settings type for the given root package.

## Function: `we_are_in_jetbrains`
[Section titled “Function: we_are_in_jetbrains”](#function-we_are_in_jetbrains)

**

```
we_are_in_jetbrains()
```

Detect if we are running inside a JetBrains IDE.

## Function: `we_are_in_vscode`
[Section titled “Function: we_are_in_vscode”](#function-we_are_in_vscode)

**

```
we_are_in_vscode()
```

Detect if we are running inside VSCode.