Skip to content

Commit a27454d

Browse files
authored
Update supported Python versions + add workflows (#5)
1 parent bd2f017 commit a27454d

File tree

7 files changed

+178
-19
lines changed

7 files changed

+178
-19
lines changed

.github/workflows/docs-preview.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: RtD Docs Preview
2+
on:
3+
pull_request_target:
4+
types:
5+
- opened
6+
7+
permissions:
8+
pull-requests: write
9+
10+
jobs:
11+
documentation-links:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: readthedocs/actions/preview@v1
15+
with:
16+
project-slug: "utctime"

.github/workflows/release.yaml

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Release to PyPI / TestPyPi
2+
on:
3+
workflow_dispatch:
4+
push:
5+
tags:
6+
- "0.*"
7+
- "1.*"
8+
9+
defaults:
10+
run:
11+
shell: bash
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
python-version:
19+
- "3.9"
20+
- "3.10"
21+
- "3.11"
22+
- "3.12"
23+
- "3.13"
24+
steps:
25+
- uses: actions/checkout@v3
26+
- name: Set up Python ${{ matrix.python-version }}
27+
uses: actions/setup-python@v3
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
- name: Install tox
31+
run: |
32+
pip install "tox>=4.5,<4.6"
33+
- name: Run tox
34+
run: |
35+
tox --colored no --quiet
36+
37+
dist:
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: actions/checkout@v2
41+
- name: Set up Python ${{ matrix.python-version }}
42+
uses: actions/setup-python@v2
43+
with:
44+
python-version: "3.9"
45+
- name: Install build tools
46+
run: python -m pip install build
47+
- name: Build source and wheel distribution
48+
run: python -m build --sdist --wheel --outdir dist/
49+
- name: Upload distribution artifact
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: dist
53+
path: dist
54+
55+
verify-dist:
56+
runs-on: ubuntu-latest
57+
needs: dist
58+
steps:
59+
- name: Download dist artifact
60+
uses: actions/download-artifact@v4
61+
with:
62+
name: dist
63+
path: dist
64+
- name: Verify dist files exist
65+
run: ls dist/*
66+
- name: Validate wheel distribution data
67+
run: python -m zipfile --list dist/*.whl | grep --extended-regexp --silent 'utctime/__init__.py'
68+
69+
upload-to-testpypi:
70+
runs-on: ubuntu-latest
71+
needs:
72+
- build
73+
- verify-dist
74+
environment:
75+
name: testpypi
76+
url: https://test.pypi.org/p/utctime
77+
steps:
78+
- name: Download dist artifact
79+
uses: actions/download-artifact@v4
80+
with:
81+
name: dist
82+
path: dist
83+
- name: Publish distribution to Test PyPI
84+
uses: pypa/gh-action-pypi-publish@release/v1
85+
with:
86+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
87+
repository_url: https://test.pypi.org/legacy/
88+
89+
upload-to-pypi:
90+
runs-on: ubuntu-latest
91+
needs:
92+
- build
93+
- verify-dist
94+
environment:
95+
name: pypi
96+
url: https://pypi.org/p/utctime
97+
steps:
98+
- name: Download dist artifact
99+
uses: actions/download-artifact@v4
100+
with:
101+
name: dist
102+
path: dist
103+
- name: Publish distribution to PyPI
104+
uses: pypa/gh-action-pypi-publish@release/v1
105+
with:
106+
password: ${{ secrets.PYPI_API_TOKEN }}
107+
repository_url: https://upload.pypi.org/legacy/

.github/workflows/utctime.yaml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build
2+
on:
3+
push:
4+
branches: ["main"]
5+
pull_request:
6+
branches: ["*"]
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
defaults:
13+
run:
14+
shell: bash
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
python-version:
22+
- "3.9"
23+
- "3.10"
24+
- "3.11"
25+
- "3.12"
26+
- "3.13"
27+
steps:
28+
- uses: actions/checkout@v3
29+
- name: Set up Python ${{ matrix.python-version }}
30+
uses: actions/setup-python@v3
31+
with:
32+
python-version: ${{ matrix.python-version }}
33+
- name: Install tox
34+
run: |
35+
pip install "tox>=4.5,<4.6"
36+
- name: Run tox
37+
run: |
38+
tox --colored no --quiet

.python-version

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
3.7
2-
3.8
31
3.9
42
3.10
53
3.11
4+
3.12
5+
3.13

pyproject.toml

+9-13
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.1.2-alpha"
44

55
description = "A simple and type-safe way of working with UTC datetimes and ISO 8601 strings."
66

7-
requires-python = ">= 3.7"
7+
requires-python = ">= 3.9"
88
readme = "README.rst"
99
license = { file = "LICENSE" }
1010
classifiers = [
@@ -15,11 +15,11 @@ classifiers = [
1515
"License :: OSI Approved :: MIT License",
1616
"Programming Language :: Python",
1717
"Programming Language :: Python :: 3",
18-
"Programming Language :: Python :: 3.7",
19-
"Programming Language :: Python :: 3.8",
2018
"Programming Language :: Python :: 3.9",
2119
"Programming Language :: Python :: 3.10",
2220
"Programming Language :: Python :: 3.11",
21+
"Programming Language :: Python :: 3.12",
22+
"Programming Language :: Python :: 3.13",
2323
"Programming Language :: Python :: 3 :: Only",
2424
"Programming Language :: Python :: Implementation :: CPython",
2525
"Topic :: Software Development :: Libraries",
@@ -29,6 +29,9 @@ classifiers = [
2929
keywords = ["utc", "datetime", "iso", "iso8601", "time", "utility", "util"]
3030
dependencies = []
3131

32+
[project.optional-dependencies]
33+
docs = ["sphinx-rtd-theme >= 1.2.0", "pytest >= 6.2.0"]
34+
3235
[project.urls]
3336
Documentation = "https://utctime.readthedocs.io"
3437
Source = "https://github.com/dmayo3/utctime"
@@ -46,13 +49,6 @@ tag = true
4649
push = false
4750

4851
[tool.bumpver.file_patterns]
49-
"pyproject.toml" = [
50-
'current_version = "{version}"',
51-
'version = "{version}"',
52-
]
53-
"utctime/__init__.py" = [
54-
"{version}",
55-
]
56-
"README.rst" = [
57-
"{version}",
58-
]
52+
"pyproject.toml" = ['current_version = "{version}"', 'version = "{version}"']
53+
"utctime/__init__.py" = ["{version}"]
54+
"README.rst" = ["{version}"]

tox.ini

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tox]
22
requires =
33
tox>=4
4-
env_list = format, lint, mypy, py{37,38,39,310,311}, docs
4+
env_list = format, lint, mypy, py{39,310,311,312,313}, docs
55

66
[testenv]
77
description = run unit tests
@@ -37,7 +37,7 @@ commands =
3737
[testenv:pylint]
3838
description = code linting
3939
deps =
40-
pylint>=2.17.0
40+
pylint>=3.3.2,<3.4.0
4141
commands = pylint {posargs:utctime tests}
4242

4343
[testenv:flake8]
@@ -69,8 +69,8 @@ per-file-ignores =
6969
description = build sphinx docs
7070
changedir = docs
7171
deps =
72-
sphinx>=6.0,<6.1
73-
sphinx-rtd-theme>=1.2.0
72+
sphinx>=6.2,<6.3
73+
sphinx-rtd-theme>=3.0.2,<3.1.0
7474
commands =
7575
sphinx-build -W -b doctest -d {envtmpdir}/doctrees . {envtmpdir}/html
7676
sphinx-build -v -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html

utctime/utctime.py

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class UtcTime:
3434
methods to create :class:`utctime.UtcTime` instances.
3535
"""
3636

37+
# pylint: disable=too-many-positional-arguments
3738
def __init__(
3839
self: UtcTime,
3940
year: int,
@@ -143,6 +144,7 @@ def todatetime(self: UtcTime) -> datetime:
143144
"""Converts back to a regular :py:class:`datetime.datetime` with a UTC timezone."""
144145
return self._dt
145146

147+
# pylint: disable=too-many-positional-arguments
146148
def replace(
147149
self: UtcTime,
148150
year: Optional[int] = None,

0 commit comments

Comments
 (0)