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

# metadata
       [Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Fmetadata%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%2Fmetadata%2F.%20I%20want%20to%20ask%20questions%20about%20it.)[View in Markdown](/codeweaver/api/core/metadata.md)       [Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Fmetadata%2F)[Share on X](https://x.com/intent/tweet?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Fmetadata%2F&text=metadata)[Share on Threads](https://threads.net/intent/post?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Fmetadata%2F&text=metadata)[Share on Bluesky](https://bsky.app/intent/compose?text=metadata%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Fmetadata%2F)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Fmetadata%2F)[Share on Reddit](https://reddit.com/submit?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Fmetadata%2F&title=metadata)[Share on Hacker News](https://news.ycombinator.com/submitlink?u=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Fmetadata%2F&t=metadata)[Share on Email](mailto:?subject=metadata&body=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Fmetadata%2F)[Share on WhatsApp](https://wa.me/?text=metadata%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Fmetadata%2F)[Share on Telegram](https://t.me/share/url?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fcore%2Fmetadata%2F&text=metadata)
# `codeweaver.core.metadata`
[Section titled “codeweaver.core.metadata”](#codeweavercoremetadata)
Defines metadata types and enums for code chunks in CodeWeaver.

## Class: `ChunkKind`
[Section titled “Class: ChunkKind”](#class-chunkkind)
Represents the kind of a code chunk.

### Method: `from_path`
[Section titled “Method: from_path”](#method-from_path)

**

```
from_path()
```

Create a ChunkKind from a file path.

## Class: `ChunkSource`
[Section titled “Class: ChunkSource”](#class-chunksource)
Represents the type of a code chunk — basically how it was extracted.

## Class: `ExtCategory`
[Section titled “Class: ExtCategory”](#class-extcategory)
Represents a file extension and its associated category.

### Method: `from_file`
[Section titled “Method: from_file”](#method-from_file)

**

```
from_file()
```

Create an ExtCategory from a file path.

### Method: `from_language`
[Section titled “Method: from_language”](#method-from_language)

**

```
from_language()
```

Create an ExtKind from a string representation.

### Method: `resolve_extension_tests`
[Section titled “Method: resolve_extension_tests”](#method-resolve_extension_tests)

**

```
resolve_extension_tests()
```

Resolve the extension tests for a given file path.

### Method: `serialize_for_cli`
[Section titled “Method: serialize_for_cli”](#method-serialize_for_cli)

**

```
serialize_for_cli()
```

Serialize the ExtCategory for CLI output.

## Class: `ExtLangPair`
[Section titled “Class: ExtLangPair”](#class-extlangpair)
Mapping of file extensions to their corresponding programming languages.

Not all ‘extensions’ are actually file extensions, some are file names or special cases, like `Makefile` or `Dockerfile`.

### Method: `is_same`
[Section titled “Method: is_same”](#method-is_same)

**

```
is_same()
```

Check if the given filename is the same filetype as the extension.

## Class: `ExtTestDef`
[Section titled “Class: ExtTestDef”](#class-exttestdef)
A NamedTuple defining a file extension test. Consists of the extension, the language if the test passes, and the test — a callable that takes the file content and returns a bool.

### Method: `test_ext`
[Section titled “Method: test_ext”](#method-test_ext)

**

```
test_ext()
```

Run the test callable with the given extension and content.

## Class: `Metadata`
[Section titled “Class: Metadata”](#class-metadata)
Metadata associated with a code chunk.

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

**

```
determine_ext_category()
```

Determine the ExtCategory based on validated data. Validated data here is the partially validated data field dictionary for a CodeChunk during pydantic model validation (i.e. what a default_factory can optionally receive).

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

**

```
get_ext_lang_pair_for_file()
```

Get the `ExtLangPair` for a given file path.

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

**

```
get_ext_lang_pairs()
```

Yield all `ExtLangPair` instances for code, config, and docs files.

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

**

```
get_language_from_extension()
```

Get the language associated with a given file extension.

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

**

```
get_semantic_or_config_lang()
```

Get the `SemanticSearchLanguage` or `ConfigLanguage` for a given file path.