Skip to content

Commit 9739545

Browse files
committed
Add support for django 6 & python 3.14
- Drop python<3.10 support - Drop pydantic v1 support
1 parent a3be637 commit 9739545

File tree

15 files changed

+809
-327
lines changed

15 files changed

+809
-327
lines changed

.github/copilot-instructions.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# AI Coding Agent Instructions for django-bootstrap-datepicker-plus
2+
3+
## Project Overview
4+
This is a Django package providing Bootstrap datepicker widgets (DatePickerInput, TimePickerInput, DateTimePickerInput, MonthPickerInput, YearPickerInput) that integrate bootstrap-datetimepicker v4. Supports Bootstrap 3/4/5 with date-range functionality.
5+
6+
## Architecture
7+
- **Core Components**: Widgets inherit from `BasePickerInput` (in `_base.py`), configured via `WidgetConfig` (Pydantic model in `_config.py`)
8+
- **Configuration Flow**: Django settings (`BOOTSTRAP_DATEPICKER_PLUS`) → `WidgetSettings` (Pydantic BaseSettings) → widget options
9+
- **Rendering**: Uses Django templates (`bootstrap_datepicker_plus/input.html`) with data attributes for JS initialization
10+
- **Data Flow**: Widget options → JSON in `data-dbdp-config` attribute → JS bootstrap-datetimepicker
11+
12+
## Key Files
13+
- `src/bootstrap_datepicker_plus/widgets.py`: Widget classes (variants: date/time/datetime/month/year)
14+
- `src/bootstrap_datepicker_plus/_base.py`: Base widget logic, attrs building, context
15+
- `src/bootstrap_datepicker_plus/_config.py`: Pydantic config merging options
16+
- `src/bootstrap_datepicker_plus/settings.py`: Django settings integration with defaults
17+
- `src/bootstrap_datepicker_plus/schemas.py`: Type definitions (WidgetVariant enum, WidgetOptions dict)
18+
19+
## Developer Workflows
20+
- **Dependencies**: Use Poetry (`poetry install`, `poetry add`)
21+
- **Testing**: `pytest` with pytest-django; fixtures in `tests/conftest.py` clear settings cache
22+
- **Docs Build**: `poetry run make -C docs html` (Sphinx)
23+
- **Dev Server**: `cd dev && python manage.py runserver` (includes demo forms)
24+
- **Linting/Formatting**: Black for code formatting
25+
26+
## Conventions
27+
- **Options Merging**: Settings → variant_options → widget.options → instance options (last wins)
28+
- **Date Formats**: `_date_format` (Python strftime) vs `backend_date_format` (Moment.js)
29+
- **Deprecations**: Use `typing_extensions.deprecated` decorator for old APIs
30+
- **Pydantic Usage**: v2 with pydantic-settings for Django settings integration
31+
- **Testing**: Use `SettingsWrapper` fixture to reset cached settings between tests
32+
33+
## Examples
34+
- **Basic Widget**: `DatePickerInput(options={'format': 'YYYY-MM-DD'})`
35+
- **Range Picker**: `DatePickerInput(range_from='start_date')` links inputs
36+
- **Custom Settings**: `BOOTSTRAP_DATEPICKER_PLUS = {'options': {'locale': 'en'}}` in Django settings
37+
- **Variant Options**: `BOOTSTRAP_DATEPICKER_PLUS['variant_options']['time'] = {'format': 'HH:mm'}`
38+
39+
## Integration Points
40+
- **Django Forms**: Widgets used in ModelForm fields
41+
- **Bootstrap Versions**: Static files served via settings URLs (CDN defaults)
42+
- **External Deps**: moment.js, bootstrap-datetimepicker JS/CSS, bootstrap-icons CSS</content>
43+
<parameter name="filePath">/Users/monim/monim67/django-bootstrap-datepicker-plus/.github/copilot-instructions.md

.github/workflows/build.yml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
python-version: ["3.12"]
13+
python-version: ["3.14"]
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v6
1616

1717
- name: Install poetry
1818
run: pipx install poetry
1919

20+
- name: Add pipx to PATH
21+
if: github.actor == 'nektos/act'
22+
run: echo "/root/.local/bin" >> ${GITHUB_PATH}
23+
2024
- uses: actions/setup-python@v5
2125
with:
2226
python-version: ${{ matrix.python-version }}
@@ -25,7 +29,7 @@ jobs:
2529
- name: Check poetry.lock
2630
run: |
2731
poetry env use ${{ matrix.python-version }}
28-
poetry lock --check
32+
poetry check --lock
2933
3034
- name: Install dependencies
3135
run: |
@@ -41,14 +45,15 @@ jobs:
4145

4246
- name: Coveralls Parallel
4347
uses: coverallsapp/github-action@master
48+
if: github.actor != 'nektos/act'
4449
with:
4550
github-token: ${{ secrets.GITHUB_TOKEN }}
4651
flag-name: run-${{ matrix.python-version }}
4752
parallel: true
4853

4954
- name: Upload pages artifact
50-
uses: actions/upload-pages-artifact@v2
51-
if: github.event_name == 'push' && github.ref_name == 'master' && github.repository_owner == 'monim67'
55+
uses: actions/upload-pages-artifact@v4
56+
if: github.actor != 'nektos/act' && github.event_name == 'push' && github.ref_name == 'master' && github.repository_owner == 'monim67'
5257
with:
5358
path: ./pages
5459

@@ -57,13 +62,17 @@ jobs:
5762
needs: pre-build
5863
strategy:
5964
matrix:
60-
python-version: ["3.11", "3.10", "3.9", "3.8"]
65+
python-version: ["3.13", "3.12", "3.11", "3.10"]
6166
steps:
62-
- uses: actions/checkout@v4
67+
- uses: actions/checkout@v6
6368

6469
- name: Install poetry
6570
run: pipx install poetry
6671

72+
- name: Add pipx to PATH
73+
if: github.actor == 'nektos/act'
74+
run: echo "/root/.local/bin" >> ${GITHUB_PATH}
75+
6776
- uses: actions/setup-python@v5
6877
with:
6978
python-version: ${{ matrix.python-version }}
@@ -80,6 +89,7 @@ jobs:
8089

8190
- name: Coveralls Parallel
8291
uses: coverallsapp/github-action@master
92+
if: github.actor != 'nektos/act'
8393
with:
8494
github-token: ${{ secrets.GITHUB_TOKEN }}
8595
flag-name: run-${{ matrix.python-version }}
@@ -88,6 +98,7 @@ jobs:
8898
coveralls:
8999
runs-on: ubuntu-latest
90100
needs: build
101+
if: github.actor != 'nektos/act'
91102
steps:
92103
- name: Coveralls Finished
93104
uses: coverallsapp/github-action@master
@@ -98,7 +109,7 @@ jobs:
98109
deploy-pages:
99110
runs-on: ubuntu-latest
100111
needs: build
101-
if: github.event_name == 'push' && github.ref_name == 'master' && github.repository_owner == 'monim67'
112+
if: github.actor != 'nektos/act' && github.event_name == 'push' && github.ref_name == 'master' && github.repository_owner == 'monim67'
102113
permissions:
103114
contents: read
104115
pages: write
@@ -109,4 +120,4 @@ jobs:
109120
steps:
110121
- name: Deploy to GitHub Pages
111122
id: deployment
112-
uses: actions/deploy-pages@v3
123+
uses: actions/deploy-pages@v4

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ repos:
44
- id: poetry-lock
55
name: Check poetry.lock consistency
66
language: system
7-
entry: poetry lock --check
7+
entry: poetry check --lock
88
always_run: true
99
pass_filenames: false
1010
- id: lint

.vscode/extensions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"recommendations": [
33
"ms-python.python",
44
"ms-python.black-formatter",
5-
"ms-python.isort"
5+
"ms-python.isort",
6+
"sanjulaganepola.github-local-actions"
67
]
78
}

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"python.testing.unittestEnabled": false,
44
"[python]": {
55
"editor.formatOnSave": true,
6+
"editor.defaultFormatter": "ms-python.black-formatter",
67
"editor.codeActionsOnSave": {
78
"source.organizeImports": "explicit"
89
}
@@ -21,4 +22,7 @@
2122
"https://json.schemastore.org/github-workflow.json": ".github/workflows/*.yml"
2223
},
2324
"esbonio.sphinx.confDir": "docs",
25+
"python-envs.defaultEnvManager": "ms-python.python:poetry",
26+
"python-envs.defaultPackageManager": "ms-python.python:poetry",
27+
"python-envs.pythonProjects": [],
2428
}

docs/Getting_Started.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Getting Started
77
Prerequisites
88
********************
99

10-
- Python >= 3.8
10+
- Python >= 3.10
1111
- Django >= 2.0
1212
- Bootstrap >= 3
1313
- jquery >= 1.7.1

0 commit comments

Comments
 (0)