Skip to content

Commit

Permalink
Update pydantic version, drop python 3.7 support
Browse files Browse the repository at this point in the history
  • Loading branch information
monim67 committed Dec 4, 2023
1 parent b79986c commit 1eca8a2
Show file tree
Hide file tree
Showing 11 changed files with 281 additions and 126 deletions.
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"ms-python.python",
"ms-python.isort",
"ms-python.black-formatter",
"ms-python.mypy-type-checker"
"ms-python.mypy-type-checker",
"mhutchie.git-graph"
]
}
}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
python-version: ["3.12"]
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
needs: pre-build
strategy:
matrix:
python-version: ["3.10", "3.9", "3.8", "3.7"]
python-version: ["3.11", "3.10", "3.9", "3.8"]
steps:
- uses: actions/checkout@v3

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ __pycache__/
.pytest_cache/
*.py[cod]
*$py.class
.DS_Store

# IDE - VSCode
.vscode/*
Expand Down Expand Up @@ -47,4 +48,3 @@ wheels/
*.egg-info/
.installed.cfg
*.egg

8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"ms-python.mypy-type-checker",
"ms-python.black-formatter",
"ms-python.isort",
"ms-python.python"
]
}
3 changes: 0 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"python.formatting.provider": "black",
"python.linting.mypyEnabled": true,
"python.linting.pydocstyleEnabled": true,
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"[python]": {
Expand Down
7 changes: 6 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Getting Started

Prerequisites
^^^^^^^^^^^^^
- Python >= 3.7
- Python >= 3.8
- Django >= 2.0


Expand Down Expand Up @@ -67,6 +67,11 @@ A better example is `here <file_custom_form_html_>`_.
{{ form.media }} {# Adds all flatpickr JS/CSS files from CDN #}
{{ form.as_p }} {# Renders the form #}

<form method="post">
{% csrf_token %}
{% bootstrap_form form %}
</form>


You can use it `with generic views without a model form <generic_view_block_>`_.
It can also be used with custom forms and model forms as below.
Expand Down
364 changes: 254 additions & 110 deletions poetry.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ classifiers = [
[tool.poetry.dependencies]
python = "^3.8"
Django = ">=2,<5"
pydantic = "*"
pydantic = "^2"
pydantic-settings = "*"
typing-extensions = "*"

[tool.poetry.group.build.dependencies]
Expand All @@ -44,7 +45,7 @@ pytest-dotenv = "^0.5.2"
black = "^22.6.0"
isort = "^5.10.1"
pydocstyle = {extras = ["toml"], version = "^6.1.1"}
mypy = "*"
mypy = "^1.0.1"
django-stubs = "^1.12.0"
coverage = { extras = ["toml"], version = "^6.5.0" }
pylint = "^2.12.0"
Expand Down Expand Up @@ -115,15 +116,14 @@ source = [
legacy_tox_ini = """
[tox]
isolated_build = True
envlist = py{3.11,310,39,38,37}
envlist = py{311,310,39,38}
[testenv]
allowlist_externals = poetry
skip_install = true
commands =
poetry install --no-root --only build
pip install -c tests/pip-constraints.txt .
poe lint
pytest
"""

Expand Down
2 changes: 1 addition & 1 deletion src/django_flatpickr/_config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Any, Dict, Optional

from pydantic import BaseModel, Field
from pydantic.v1 import BaseModel, Field

from .schemas import FlatpickrOptions

Expand Down
2 changes: 1 addition & 1 deletion src/django_flatpickr/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from enum import Enum
from typing import Any, Dict, List, NoReturn, Optional

from pydantic import BaseModel, Extra, Field, validator
from pydantic.v1 import BaseModel, Extra, Field, validator
from typing_extensions import TypeAlias

InputAttrs: TypeAlias = Dict[str, Any]
Expand Down
4 changes: 2 additions & 2 deletions src/django_flatpickr/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from typing import Any, Dict, Optional, Tuple

from django.conf import settings as django_settings
from pydantic import Field
from pydantic.env_settings import BaseSettings, SettingsSourceCallable
from pydantic.v1 import Field
from pydantic.v1.env_settings import BaseSettings, SettingsSourceCallable

from .schemas import FlatpickrOptions, ThemeEnum

Expand Down

0 comments on commit 1eca8a2

Please sign in to comment.