diff --git a/.github/workflows/docs-preview.yaml b/.github/workflows/docs-preview.yaml new file mode 100644 index 0000000..28fe8ff --- /dev/null +++ b/.github/workflows/docs-preview.yaml @@ -0,0 +1,16 @@ +name: RtD Docs Preview +on: + pull_request_target: + types: + - opened + +permissions: + pull-requests: write + +jobs: + documentation-links: + runs-on: ubuntu-latest + steps: + - uses: readthedocs/actions/preview@v1 + with: + project-slug: "utctime" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..48c7d9f --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,107 @@ +name: Release to PyPI / TestPyPi +on: + workflow_dispatch: + push: + tags: + - "0.*" + - "1.*" + +defaults: + run: + shell: bash + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: + - "3.9" + - "3.10" + - "3.11" + - "3.12" + - "3.13" + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install tox + run: | + pip install "tox>=4.5,<4.6" + - name: Run tox + run: | + tox --colored no --quiet + + dist: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: "3.9" + - name: Install build tools + run: python -m pip install build + - name: Build source and wheel distribution + run: python -m build --sdist --wheel --outdir dist/ + - name: Upload distribution artifact + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist + + verify-dist: + runs-on: ubuntu-latest + needs: dist + steps: + - name: Download dist artifact + uses: actions/download-artifact@v4 + with: + name: dist + path: dist + - name: Verify dist files exist + run: ls dist/* + - name: Validate wheel distribution data + run: python -m zipfile --list dist/*.whl | grep --extended-regexp --silent 'utctime/__init__.py' + + upload-to-testpypi: + runs-on: ubuntu-latest + needs: + - build + - verify-dist + environment: + name: testpypi + url: https://test.pypi.org/p/utctime + steps: + - name: Download dist artifact + uses: actions/download-artifact@v4 + with: + name: dist + path: dist + - name: Publish distribution to Test PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + + upload-to-pypi: + runs-on: ubuntu-latest + needs: + - build + - verify-dist + environment: + name: pypi + url: https://pypi.org/p/utctime + steps: + - name: Download dist artifact + uses: actions/download-artifact@v4 + with: + name: dist + path: dist + - name: Publish distribution to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} + repository_url: https://upload.pypi.org/legacy/ diff --git a/.github/workflows/utctime.yaml b/.github/workflows/utctime.yaml new file mode 100644 index 0000000..0560cd2 --- /dev/null +++ b/.github/workflows/utctime.yaml @@ -0,0 +1,38 @@ +name: Build +on: + push: + branches: ["main"] + pull_request: + branches: ["*"] + workflow_dispatch: + +permissions: + contents: read + +defaults: + run: + shell: bash + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: + - "3.9" + - "3.10" + - "3.11" + - "3.12" + - "3.13" + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install tox + run: | + pip install "tox>=4.5,<4.6" + - name: Run tox + run: | + tox --colored no --quiet diff --git a/.python-version b/.python-version index 5d6ed7f..dffc7a6 100644 --- a/.python-version +++ b/.python-version @@ -1,5 +1,5 @@ -3.7 -3.8 3.9 3.10 3.11 +3.12 +3.13 diff --git a/pyproject.toml b/pyproject.toml index 63626c9..6525555 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ version = "0.1.2-alpha" description = "A simple and type-safe way of working with UTC datetimes and ISO 8601 strings." -requires-python = ">= 3.7" +requires-python = ">= 3.9" readme = "README.rst" license = { file = "LICENSE" } classifiers = [ @@ -15,11 +15,11 @@ classifiers = [ "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Software Development :: Libraries", @@ -29,6 +29,9 @@ classifiers = [ keywords = ["utc", "datetime", "iso", "iso8601", "time", "utility", "util"] dependencies = [] +[project.optional-dependencies] +docs = ["sphinx-rtd-theme >= 1.2.0", "pytest >= 6.2.0"] + [project.urls] Documentation = "https://utctime.readthedocs.io" Source = "https://github.com/dmayo3/utctime" @@ -46,13 +49,6 @@ tag = true push = false [tool.bumpver.file_patterns] -"pyproject.toml" = [ - 'current_version = "{version}"', - 'version = "{version}"', -] -"utctime/__init__.py" = [ - "{version}", -] -"README.rst" = [ - "{version}", -] +"pyproject.toml" = ['current_version = "{version}"', 'version = "{version}"'] +"utctime/__init__.py" = ["{version}"] +"README.rst" = ["{version}"] diff --git a/tox.ini b/tox.ini index 4a5d8d7..b6fbe19 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] requires = tox>=4 -env_list = format, lint, mypy, py{37,38,39,310,311}, docs +env_list = format, lint, mypy, py{39,310,311,312,313}, docs [testenv] description = run unit tests @@ -37,7 +37,7 @@ commands = [testenv:pylint] description = code linting deps = - pylint>=2.17.0 + pylint>=3.3.2,<3.4.0 commands = pylint {posargs:utctime tests} [testenv:flake8] @@ -69,8 +69,8 @@ per-file-ignores = description = build sphinx docs changedir = docs deps = - sphinx>=6.0,<6.1 - sphinx-rtd-theme>=1.2.0 + sphinx>=6.2,<6.3 + sphinx-rtd-theme>=3.0.2,<3.1.0 commands = sphinx-build -W -b doctest -d {envtmpdir}/doctrees . {envtmpdir}/html sphinx-build -v -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html diff --git a/utctime/utctime.py b/utctime/utctime.py index d8f3e47..a2ca67c 100644 --- a/utctime/utctime.py +++ b/utctime/utctime.py @@ -34,6 +34,7 @@ class UtcTime: methods to create :class:`utctime.UtcTime` instances. """ + # pylint: disable=too-many-positional-arguments def __init__( self: UtcTime, year: int, @@ -143,6 +144,7 @@ def todatetime(self: UtcTime) -> datetime: """Converts back to a regular :py:class:`datetime.datetime` with a UTC timezone.""" return self._dt + # pylint: disable=too-many-positional-arguments def replace( self: UtcTime, year: Optional[int] = None,