Skip to content

Turn tzdata install requirement into optional timezone dependency #10331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ jobs:
- name: install deps
run: |
pdm venv create --with-pip --force $PYTHON
pdm install -G testing -G email
pdm install -G testing -G email -G timezone

- run: pdm info && pdm list

Expand All @@ -156,7 +156,7 @@ jobs:
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}-without-deps

- name: install extra deps
run: pdm install -G testing-extra -G email
run: pdm install -G testing-extra -G email -G timezone

- name: test with deps
run: make test
Expand Down
1 change: 1 addition & 0 deletions .hyperlint/styles/config/vocabularies/hyperlint/accept.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Hyperlint
preprocess
tokenization
tokenizer
tzdata
API
APIs
SDKs
Expand Down
12 changes: 8 additions & 4 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,26 @@ conda install pydantic -c conda-forge

Pydantic has the following optional dependencies:

* Email validation provided by the [email-validator](https://pypi.org/project/email-validator/) package.
* `email`: Email validation provided by the [email-validator](https://pypi.org/project/email-validator/) package.
* `timezone`: Fallback IANA time zone database provided by the [tzdata](https://pypi.org/project/tzdata/) package.

To install optional dependencies along with Pydantic:

```bash
# with the `email` extra:
pip install pydantic[email]
# or with `email` and `timezone` extras:
pip install pydantic[email,timezone]
```

Of course, you can also install requirements manually with `pip install email-validator`.
Of course, you can also install requirements manually with `pip install email-validator tzdata`.

## Install from repository

And if you prefer to install Pydantic directly from the repository:

```bash
pip install git+https://github.com/pydantic/pydantic@main#egg=pydantic
# or with the `email` extra:
pip install git+https://github.com/pydantic/pydantic@main#egg=pydantic[email]
# or with `email` and `timezone` extras:
pip install git+https://github.com/pydantic/pydantic@main#egg=pydantic[email,timezone]
```
4 changes: 2 additions & 2 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ dependencies = [
'typing-extensions>=4.12.2; python_version >= "3.13"',
'annotated-types>=0.6.0',
"pydantic-core==2.23.2",
# See: https://docs.python.org/3/library/zoneinfo.html#data-sources
'tzdata; python_version >= "3.9"',
]
dynamic = ['version', 'readme']

[project.optional-dependencies]
email = ['email-validator>=2.0.0']
timezone = [
# See: https://docs.python.org/3/library/zoneinfo.html#data-sources
'tzdata; python_version >= "3.9" and sys_platform == "win32"',
]

[project.urls]
Homepage = 'https://github.com/pydantic/pydantic'
Expand Down
Loading