## Change Summary

This means `pydantic/__init__.py` is now lazy about all imports using `__getattr__`.

Import performance changes:
### Before

```
code/pydantic 0 ➤ pdm run python -m timeit -n 1 -r 1 "import pydantic"
1 loop, best of 1: 29.7 msec per loop
```

```
code/pydantic 0 ➤ pdm run python -m timeit -n 1 -r 1 "from pydantic import BaseModel"
1 loop, best of 1: 30.4 msec per loop
```

### After

```
code/pydantic 0 ➤ pdm run python -m timeit -n 1 -r 1 "import pydantic"
1 loop, best of 1: 4.8 msec per loop
```

```
(env3112) code/pydantic 0 ➤ pdm run python -m timeit -n 1 -r 1 "from pydantic import BaseModel"           
1 loop, best of 1: 18.7 msec per loop
```

Tuna output:

<img width="1421" alt="image" src="https://github.com/pydantic/pydantic/assets/4039449/0a57434e-fdda-4709-8793-d96c0a0ee762">

## Related issue number

As promised in https://github.com/pydantic/pydantic/pull/7423#issuecomment-1733361629.

## Checklist

* [x] The pull request title is a good summary of the changes - it will be used in the changelog
* [ ] Unit tests for the changes exist
* [x] Tests pass on CI
* [ ] Documentation reflects the changes where applicable
* [x] My PR is ready to review, **please add a comment including the phrase "please review" to assign reviewers**


Selected Reviewer: @sydney-runkle
Use `__getattr__` for all package imports, improve import time. ## Change Summary

This means `pydantic/__init__.py` is now lazy about all imports using `__getattr__`.

Import performance changes:
### Before

```
code/pydantic 0 ➤ pdm run python -m timeit -n 1 -r 1 "import pydantic"
1 loop, best of 1: 29.7 msec per loop
```

```
code/pydantic 0 ➤ pdm run python -m timeit -n 1 -r 1 "from pydantic import BaseModel"
1 loop, best of 1: 30.4 msec per loop
```

### After

```
code/pydantic 0 ➤ pdm run python -m timeit -n 1 -r 1 "import pydantic"
1 loop, best of 1: 4.8 msec per loop
```

```
(env3112) code/pydantic 0 ➤ pdm run python -m timeit -n 1 -r 1 "from pydantic import BaseModel"           
1 loop, best of 1: 18.7 msec per loop
```

Tuna output:

<img width="1421" alt="image" src="https://github.com/pydantic/pydantic/assets/4039449/0a57434e-fdda-4709-8793-d96c0a0ee762">

## Related issue number

As promised in https://github.com/pydantic/pydantic/pull/7423#issuecomment-1733361629.

## Checklist

* [x] The pull request title is a good summary of the changes - it will be used in the changelog
* [ ] Unit tests for the changes exist
* [x] Tests pass on CI
* [ ] Documentation reflects the changes where applicable
* [x] My PR is ready to review, **please add a comment including the phrase "please review" to assign reviewers**


Selected Reviewer: @sydney-runkle
"""Short helper script to check that a PR has exactly one relnotes label."""

import json
import os
import sys

if __name__ == '__main__':
    event_path = os.environ.get('GITHUB_EVENT_PATH')
    if event_path is None:
        raise RuntimeError('Can only check changelog on github actions')

    with open(event_path) as event_file:
        event = json.load(event_file)

    labels = [
        label['name']
        for label in event['pull_request']['labels']
        if label['name'].startswith('relnotes-') or label['name'] == 'documentation'
    ]

    if not labels:
        print(
            'No suitable label found, please add either one of the `relnotes-` or `documentation` labels.',
            file=sys.stderr,
        )
        exit(1)

    if len(labels) > 1:
        print(f'Multiple relnotes labels found: `{"`, `".join(labels)}`', file=sys.stderr)
        exit(1)

    print('Found suitable label:', labels[0])
    exit(0)

"""Short helper script to check that a PR has exactly one relnotes label."""

import json
import os
import sys

if __name__ == '__main__':
    event_path = os.environ.get('GITHUB_EVENT_PATH')
    if event_path is None:
        raise RuntimeError('Can only check changelog on github actions')

    with open(event_path) as event_file:
        event = json.load(event_file)

    labels = [
        label['name']
        for label in event['pull_request']['labels']
        if label['name'].startswith('relnotes-') or label['name'] == 'documentation'
    ]

    if not labels:
        print(
            'No suitable label found, please add either one of the `relnotes-` or `documentation` labels.',
            file=sys.stderr,
        )
        exit(1)

    if len(labels) > 1:
        print(f'Multiple relnotes labels found: `{"`, `".join(labels)}`', file=sys.stderr)
        exit(1)

    print('Found suitable label:', labels[0])
    exit(0)
