Skip to content

Commit 131a011

Browse files
committed
Default to timezone aware datetimes
1 parent 9f95a42 commit 131a011

27 files changed

+443
-414
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
name: Test
2-
3-
on:
4-
push:
5-
branches: [main, develop]
6-
2+
on: [push, pull_request]
73
jobs:
84
build:
95
runs-on: ubuntu-latest
106
strategy:
117
matrix:
12-
python-version: ["3.10", "3.11", "3.12"]
8+
python-version: ["3.10", "3.11", "3.12", "3.13"]
139

1410
steps:
1511
- uses: actions/checkout@v4
1612
- name: Set up Python ${{ matrix.python-version }}
17-
uses: actions/setup-python@v4
13+
uses: actions/setup-python@v5
1814
with:
1915
python-version: ${{ matrix.python-version }}
2016
- name: Install dependencies

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ Dockerrun.aws.json
1717
.python-version
1818
/temp
1919
/docs/_build
20+
.ruff_cache

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2015-2019 David A. Krauth
1+
Copyright (c) 2015-2025 David A. Krauth
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Django Swingtime
77
.. image:: https://badge.fury.io/py/django-swingtime.svg
88
:target: http://badge.fury.io/py/django-swingtime
99

10-
:Version: 1.5.2
10+
:Version: 2.0.0
1111
:Demo: https://nerdfog.com/swingtime/
1212
:Download: https://pypi.org/project/django-swingtime/
1313
:Source: https://github.com/dakrauth/django-swingtime
@@ -101,5 +101,5 @@ Requirements
101101
------------
102102

103103
* Python 3.10+
104-
* `Django >=4.2,<5.2 <http://www.djangoproject.com/download/>`_
104+
* `Django >=4.2,<6.0 <http://www.djangoproject.com/download/>`_
105105
* `python-dateutil <http://labix.org/python-dateutil>`_.

demo/karate/management/commands/loaddemo.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
| and the database will be pre-populated with some data relative to today's date. |
55
#---------------------------------------------------------------------------------+
66
"""
7+
78
import os
89
from django.core.management import call_command
910
from django.core.management.base import BaseCommand
@@ -102,9 +103,7 @@ def create_sample_data():
102103
count=6,
103104
byweekday=(rrule.SU),
104105
)
105-
print(
106-
'Created event "%s" with %d occurrences\n' % (evt, evt.occurrence_set.count())
107-
)
106+
print('Created event "%s" with %d occurrences\n' % (evt, evt.occurrence_set.count()))
108107

109108

110109
class Command(BaseCommand):

demo/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
TIME_ZONE = "America/New_York"
3131
SITE_ID = 1
3232
USE_I18N = True
33-
USE_TZ = False
33+
USE_TZ = True
3434
SECRET_KEY = "swingtime-demo"
3535
TEST_RUNNER = "django.test.runner.DiscoverRunner"
3636
TEMPLATES = [

demo/urls.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ def docs(request):
1818
re_path(r"^karate/", include("karate.urls")),
1919
re_path(r"^admin/", admin.site.urls),
2020
re_path(r"^docs/$", docs, name="swingtime-docs"),
21-
re_path(
22-
r"^docs/(?P<path>.*)$", serve, dict(document_root=doc_root, show_indexes=False)
23-
),
21+
re_path(r"^docs/(?P<path>.*)$", serve, dict(document_root=doc_root, show_indexes=False)),
2422
]
2523

2624
urlpatterns = [

pyproject.toml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "django-swingtime"
7+
dynamic = ["version"]
8+
description = "A Django calendaring application"
9+
license = { file = "LICENSE" }
10+
keywords = ["django", "calendar", "events"]
11+
readme = { file = "README.rst", content-type = "text/x-rst" }
12+
authors = [
13+
{ name = "David A Krauth", email = "[email protected]" },
14+
]
15+
requires-python = ">=3.10"
16+
classifiers = [
17+
"Development Status :: 5 - Production/Stable",
18+
"Environment :: Web Environment",
19+
"Framework :: Django",
20+
"Framework :: Django :: 4.2",
21+
"Framework :: Django :: 5.0",
22+
"Framework :: Django :: 5.1",
23+
"Framework :: Django :: 5.2",
24+
"License :: OSI Approved :: MIT License",
25+
"Programming Language :: Python",
26+
"Programming Language :: Python :: 3.10",
27+
"Programming Language :: Python :: 3.11",
28+
"Programming Language :: Python :: 3.12",
29+
"Programming Language :: Python :: 3.13",
30+
"Topic :: Office/Business :: Scheduling",
31+
]
32+
33+
dependencies = [
34+
"Django>=4.2,<6.0",
35+
"python-dateutil>=2.8.2"
36+
]
37+
38+
[project.urls]
39+
Homepage = "https://github.com/dakrauth/django-swingtime"
40+
41+
[project.optional-dependencies]
42+
test = [
43+
"tox",
44+
"coverage",
45+
"pytest-django",
46+
"pytest",
47+
"pytest-cov",
48+
"flake8"
49+
]
50+
docs = [ "sphinx", "sphinx-rtd-theme" ]
51+
dev = [ "ruff", "build", "twine" ]
52+
53+
[tool.setuptools.dynamic]
54+
version = { attr = "swingtime.__init__.__version__"}
55+
56+
[tool.setuptools]
57+
packages = ["swingtime"]
58+
59+
[tool.ruff]
60+
cache-dir = "temp/ruff"
61+
line-length = 100
62+
indent-width = 4
63+
64+
[tool.pytest.ini_options]
65+
minversion = "6.0"
66+
testpaths = [ "tests", ]
67+
68+
DJANGO_SETTINGS_MODULE = "demo.settings"
69+
django_find_project = false
70+
addopts = "-rf"
71+
72+
[tool.coverage.run]
73+
branch = true
74+
source = [ "swingtime" ]
75+
omit = [ "**/migrations/**" ]
76+
77+
[tool.coverage.html]
78+
directory = "build/coverage"
79+
title = "Swingtime Coverage report"
80+
81+
[tool.coverage.report]
82+
ignore_errors = true
83+
84+
# Regexes for lines to exclude from consideration
85+
exclude_lines = [
86+
# Have to re-enable the standard pragma
87+
"pragma: no cover",
88+
89+
# Don't complain about missing debug-only code:
90+
"def __repr__",
91+
"if self\\.debug",
92+
93+
# Don't complain if tests don't hit defensive assertion code:
94+
"raise AssertionError",
95+
"raise NotImplementedError",
96+
97+
# Don't complain if non-runnable code isn't run:
98+
"if __name__ == .__main__.:"
99+
]

run

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env bash
2+
3+
set -o errexit
4+
set -o pipefail
5+
TIMEFORMAT="Task completed in %3lR"
6+
BIN="./venv/bin"
7+
8+
function help {
9+
echo "Options:"
10+
echo " init: Setup dev environment"
11+
echo " lint: Linter"
12+
echo " check: Formatting checks"
13+
echo " format: Run formatter"
14+
echo " test: Execute tests"
15+
echo " coverage: Run tests with code coverage"
16+
}
17+
18+
function init {
19+
python3 -m venv --prompt sw venv
20+
"${BIN}/python" -m pip install -e ".[dev,test,docs]"
21+
}
22+
23+
function lint {
24+
"${BIN}/ruff" check swingtime demo tests
25+
}
26+
27+
function check {
28+
"${BIN}/ruff" format --check swingtime demo tests
29+
}
30+
31+
function format {
32+
"${BIN}/ruff" format swingtime demo tests
33+
}
34+
35+
function test {
36+
PYTHONPATH=. "${BIN}/pytest" -s -Werror tests "$@"
37+
}
38+
39+
function coverage {
40+
PYTHONPATH=. "${BIN}/pytest" \
41+
--cov-config .coveragerc \
42+
--cov-report html \
43+
--cov-report term \
44+
--cov=swingtime
45+
}
46+
47+
if [ -z "$1" ]; then
48+
help
49+
else
50+
what=$1
51+
shift
52+
time ${what:-help} "$@"
53+
fi

setup.cfg

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

0 commit comments

Comments
 (0)