Skip to content

Commit 1a1dc3b

Browse files
committed
use dry principle possible and added example project
1 parent 2bb6458 commit 1a1dc3b

46 files changed

Lines changed: 3493 additions & 744 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/pre-commit.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: pre-commit
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
pre-commit:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
with:
11+
fetch-depth: 0
12+
13+
- name: Install uv
14+
uses: astral-sh/setup-uv@v4
15+
with:
16+
enable-cache: true
17+
cache-dependency-glob: "uv.lock"
18+
19+
- name: Set up Python
20+
run: uv python install 3.10
21+
22+
- name: Install dependencies
23+
run: uv sync --all-extras --dev
24+
25+
- name: Run pre-commit
26+
run: uv run pre-commit run --all-files --show-diff-on-failure

.github/workflows/publish.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish to PyPI
2+
on:
3+
release:
4+
types: [published]
5+
permissions:
6+
contents: read
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
environment: release
11+
permissions:
12+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
13+
steps:
14+
- uses: actions/checkout@v6
15+
- name: Set up Python
16+
uses: actions/setup-python@v6
17+
with:
18+
python-version: '3.10'
19+
cache: 'pip'
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install build twine
24+
- name: Build package
25+
run: python -m build
26+
- name: Publish package to PyPI
27+
run: python -m twine upload dist/* --verbose

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ cython_debug/
182182
.abstra/
183183

184184
# Visual Studio Code
185-
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
185+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186186
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187-
# and can be added to the global gitignore or merged into this file. However, if you prefer,
187+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
188188
# you could uncomment the following to ignore the entire vscode folder
189189
# .vscode/
190190

.pre-commit-config.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: check-yaml
6+
- id: check-toml
7+
- id: end-of-file-fixer
8+
- id: trailing-whitespace
9+
- id: check-added-large-files
10+
11+
- repo: https://github.com/astral-sh/ruff-pre-commit
12+
rev: v0.14.14
13+
hooks:
14+
- id: ruff
15+
args: [--fix]
16+
- id: ruff-format
17+

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include LICENSE
2+
include README.md
3+
recursive-include django_nepkit/static *

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## Installation
2+
3+
```bash
4+
pip install django-nepkit
5+
```
6+
7+
### Optional: Django REST Framework support
8+
9+
If you want serializer fields from `django_nepkit.serializers`, install the extra:
10+
11+
```bash
12+
pip install "django-nepkit[drf]"
13+
```

Untitled

Lines changed: 0 additions & 155 deletions
This file was deleted.

django_nepkit/__init__.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from .models import (
2+
NepaliDateField,
3+
NepaliTimeField,
4+
NepaliDateTimeField,
5+
NepaliPhoneNumberField,
6+
ProvinceField,
7+
DistrictField,
8+
MunicipalityField,
9+
)
10+
from .admin import (
11+
NepaliDateFilter,
12+
format_nepali_date,
13+
format_nepali_datetime,
14+
NepaliModelAdmin,
15+
NepaliAdminMixin,
16+
)
17+
18+
__all__ = [
19+
"NepaliDateField",
20+
"NepaliTimeField",
21+
"NepaliDateTimeField",
22+
"NepaliPhoneNumberField",
23+
"ProvinceField",
24+
"DistrictField",
25+
"MunicipalityField",
26+
"NepaliDateFilter",
27+
"format_nepali_date",
28+
"format_nepali_datetime",
29+
"NepaliModelAdmin",
30+
"NepaliAdminMixin",
31+
]

0 commit comments

Comments
 (0)