# PythonParser

**Kind:** Class

**Source:** [`atloria-monorepo/libs/parser-core/src/parsers/backend/python.parser.ts`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/libs/parser-core/src/parsers/backend/python.parser.ts#L68)

Python Project Parser implementation

**Implements:** `IParser`

## Methods

| Method | Signature | Returns |
|---|---|---|
| `initialize` | `initialize(_config: ParserConfig)` | `Promise<void>` |
| `canParse` | `canParse(filePath: string)` | `boolean` |
| `parseFile` | `parseFile(filePath: string, content: string)` | `Promise<ParseResult>` |
| `parseFiles` | `parseFiles(files: ParseFileInput[])` | `Promise<ParseResult[]>` |
| `destroy` | `destroy()` | `Promise<void>` |

## Properties

| Property | Type |
|---|---|
| `name` | `any` |
| `version` | `any` |
| `supportedPatterns` | `any` |

## Where it refuses work

- `PythonParser` stops the work with an early return when `/\.python-version$/.test(filePath) || /runtime\.txt$/.test(filePath)`.
- `PythonParser` stops the work with an early return when `!match`.
- `PythonParser` stops the work with an early return when `versionSpec === '*' || versionSpec === ''`.
- `PythonParser` stops the work with an early return when `/^[0-9.]+$/.test(versionSpec)`.
- `PythonParser` stops the work with an early return when `/^[><=!]/.test(versionSpec)`.

## When something fails

- `PythonParser` handles failure in 3 places: it turns it into a return value in all 3.
