Metadata-Version: 2.4
Name: youtrack-python
Version: 0.1.3
Summary: YouTrack SDK
Project-URL: Repository, https://github.com/ninjaneers-team/youtrack-sdk
Project-URL: Homepage, https://github.com/ninjaneers-team/youtrack-sdk
Author-email: Michael Gerhold <michael.gerhold@ninjaneers.de>, moneymeets <service@moneymeets.com>
License: MIT License
        
        Copyright (c) 2023-2024 moneymeets GmbH
        Copyright (c) 2026 Ninjaneers GmbH
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: sdk,youtrack
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.13
Requires-Dist: httpx>=0.28.1
Requires-Dist: pydantic>=2.12.5
Description-Content-Type: text/markdown

# YouTrack REST API Client

A client library for accessing YouTrack REST API.

This is a fork of [moneymeets/youtrack-sdk](https://github.com/moneymeets/youtrack-sdk) with several enhancements.

## Key Changes from Original

This fork includes the following improvements over the original repository:

- **AsyncClient Implementation**: Full async/await support with `AsyncClient` for non-blocking I/O operations
- **Project Custom Fields API**: New `get_project_custom_fields()` method to retrieve custom field definitions for projects
- **Migrated to UV**: Switched from Poetry to UV for dependency management
- **Enhanced Testing**: Migrated test suite from unittest to Pytest with async test support
- **Modern Python**: Updated to require Python 3.13+ with improved type hints and linting
- **Improved Code Quality**: Enhanced linting with Ruff and type checking with Pyright

## Usage

### Synchronous Client

```python
from datetime import date
from youtrack_sdk import Client
from youtrack_sdk.entities import (
    DateIssueCustomField,
    EnumBundleElement,
    Issue,
    Tag,
    Project,
    SingleEnumIssueCustomField,
    SingleUserIssueCustomField,
    StateBundleElement,
    StateIssueCustomField,
    User,
)

with Client(base_url="https://dummy.myjetbrains.com/youtrack", token="dummy") as client:
    result = client.create_issue(
        issue=Issue(
            project=Project(id="0-0"),
            summary="Created from YouTrack SDK",
            description="Description **text**.",
            tags=[
                Tag(id="6-0"),
            ],
            custom_fields=[
                StateIssueCustomField(
                    name="State",
                    value=StateBundleElement(
                        name="In Progress",
                    ),
                ),
                SingleUserIssueCustomField(
                    name="Assignee",
                    value=User(
                        ring_id="00000000-a31c-4174-bb27-abd3387df67a",
                    ),
                ),
                SingleEnumIssueCustomField(
                    name="Type",
                    value=EnumBundleElement(
                        name="Bug",
                    ),
                ),
                DateIssueCustomField(
                    name="Due Date",
                    value=date(2005, 12, 31),
                ),
            ],
        ),
    )
```

### Async Client

```python
import asyncio
from youtrack_sdk import AsyncClient
from youtrack_sdk.entities import Project

async def main():
    async with AsyncClient(base_url="https://dummy.myjetbrains.com/youtrack", token="dummy") as client:
        projects = await client.get_projects()
        for project in projects:
            print(f"Project: {project.name}")

asyncio.run(main())
```

### Fetching Project Custom Fields

```python
from youtrack_sdk import Client

with Client(base_url="https://dummy.myjetbrains.com/youtrack", token="dummy") as client:
    custom_fields = client.get_project_custom_fields(project_id="0-0")

    for field in custom_fields:
        print(f"Field: {field.field.name}, Type: {type(field).__name__}")
```

See [examples/list_project_custom_fields.py](examples/list_project_custom_fields.py) for a complete example.

## Note

- You should prefer to use internal entity IDs everywhere. Some methods accept readable issue IDs (e.g. HD-99) but it's not supported everywhere.
