Update Python versions and boilerplate

Drop support for Python 3.8, add 3.12, switch from tox to nox,
openstack's release jobs to opendev's, and use updated pyproject
packaging standards.

Depends-On: https://review.opendev.org/946280
Change-Id: I462014b08ec3ecb74674365a2fd1f532f61dfa0c
This commit is contained in:
Jeremy Stanley 2025-04-03 16:55:40 +00:00
parent 78f48d0509
commit 5e3bc54373
12 changed files with 146 additions and 71 deletions

6
.flake8 Normal file
View File

@ -0,0 +1,6 @@
[flake8]
exclude=.venv,.git,.nox,.tox,dist,doc,*lib/python*,*egg,build
# E123, E125 and W503 are invalid per PEP-8; OpenStack's H rules don't apply
# TODO: drop W504 once the scripts are adjusted to suit it
ignore = E123,E125,H,W503,W504
show-source = True

1
.gitignore vendored
View File

@ -27,6 +27,7 @@ pip-log.txt
.tox
nosetests.xml
.testrepository
.stestr
# Translations
*.mo

3
.stestr.conf Normal file
View File

@ -0,0 +1,3 @@
[DEFAULT]
test_path=yaml2ical/tests
top_dir=./

View File

@ -1,3 +1,23 @@
- project:
templates:
- openstack-python3-jobs
check:
jobs:
- build-python-release
- nox-linters
- nox-py39:
nodeset: ubuntu-focal
- nox-py312:
nodeset: ubuntu-noble
gate:
jobs:
- build-python-release
- nox-linters
- nox-py39:
nodeset: ubuntu-focal
- nox-py312:
nodeset: ubuntu-noble
promote:
jobs:
- opendev-promote-python
release:
jobs:
- opendev-release-python

View File

@ -24,7 +24,7 @@ Running Locally from Command Line
To test this project locally, you must have the following requirements
installed:
* Python 3.3+
* Python
* `iCalendar` python library
* `PyYaml` python library

39
noxfile.py Normal file
View File

@ -0,0 +1,39 @@
import nox
nox.options.error_on_external_run = True
nox.options.reuse_existing_virtualenvs = True
nox.options.sessions = ["tests-3", "linters"]
# Convenience wrapper for running the project
@nox.session(python="3")
def mkical(session):
session.install(".")
session.run("yaml2ical", "-y", "meetings/", "-i", "icals/", "-f")
# Note setting python this way seems to give us a target name without
# python specific suffixes while still allowing us to force a specific
# version using --force-python.
@nox.session(python="3")
def linters(session):
# TODO: switch this line to 'session.install("--group", "test-linters")'
session.install(".[test-linters]")
session.run("flake8")
@nox.session(python="3")
def venv(session):
# TODO: switch to 'session.install("-e", ".", "--group", "test-unit")'
session.install("-e", ".[test-unit]")
session.run(*session.posargs)
# This will attempt to run python3 tests by default.
@nox.session(python=["3"])
def tests(session):
# TODO: switch to 'session.install("-e", ".", "--group", "test-unit")'
session.install("-e", ".[test-unit]")
session.run("stestr", "run", *session.posargs)
session.run("stestr", "slowest")

56
pyproject.toml Normal file
View File

@ -0,0 +1,56 @@
[build-system]
requires = ["pbr>=6.1.1"]
build-backend = "pbr.build"
[project]
authors = [
{name = "OpenDev Contributors", email = "service-discuss@lists.opendev.org"},
{name = "NDSU IBM Capstone", email = "service-discuss@lists.opendev.org"},
]
classifiers = [
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"Jinja2>=2.8", # BSD License (3 clause)
"PyYAML>=3.1.0", # MIT
"icalendar",
"pbr>=1.6", # Apache-2.0
"pytz",
]
description = "Convert YAML meeting descriptions into iCalendar files"
dynamic = ["version"]
license = "Apache-2.0"
name = "yaml2ical"
readme = {charset = "UTF-8", content-type = "text/x-rst", file = "README.rst"}
requires-python = ">=3.9"
# TODO: replace this with '[dependency-groups]' once pip 25.1 is released
[project.optional-dependencies]
test-linters = [
"hacking>=7,<8", # Apache-2.0
]
test-unit = [
"coverage>=3.6", # Apache-2.0
"fixtures>=3.0.0", # Apache-2.0/BSD
"python-subunit>=0.0.18", # Apache-2.0/BSD
"stestr>=1.0.0",
"testtools>=1.4.0", # MIT
]
[project.scripts]
yaml2ical = "yaml2ical.cli:main"
[project.urls]
"Browse Source" = "https://opendev.org/opendev/yaml2ical"
"Bug Reporting" = "https://storyboard.openstack.org/#!/project/opendev/yaml2ical"
"Documentation" = "https://opendev.org/opendev/yaml2ical/src/branch/master/README.rst"
"Git Clone URL" = "https://opendev.org/opendev/yaml2ical"
"License Texts" = "https://opendev.org/opendev/yaml2ical/src/branch/master/LICENSE"

View File

@ -1,5 +0,0 @@
pbr>=1.6 # Apache-2.0
icalendar
Jinja2>=2.8 # BSD License (3 clause)
PyYAML>=3.1.0 # MIT
pytz

View File

@ -1,30 +1,3 @@
# TODO: Delete this file once PBR can read project names from pyproject.toml
[metadata]
name = yaml2ical
summary = Convert YAML meeting descriptions into iCalendar files
description_file =
README.rst
author = NDSU IBM Capstone Group & OpenStack Infrastructure Team
author_email = openstack-infra@lists.openstack.org
home_page = http://docs.openstack.org/infra/system-config/
python_requires = >=3.8
classifier =
Intended Audience :: Information Technology
Intended Audience :: System Administrators
License :: OSI Approved :: Apache Software License
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
[global]
setup-hooks =
pbr.hooks.setup_hook
[files]
packages = yaml2ical
[entry_points]
console_scripts =
yaml2ical = yaml2ical.cli:main

View File

@ -1,7 +1,21 @@
#!/usr/bin/env python
# Copyright OpenDev Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# TODO: Delete this file once PBR gains the ability to act as a build hook
import setuptools
setuptools.setup(
setup_requires=['pbr'],
pbr=True)
setuptools.setup(pbr=True)

View File

@ -1,8 +0,0 @@
hacking>=3.2.0 # Apache-2.0
coverage>=3.6 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD
python-subunit>=0.0.18 # Apache-2.0/BSD
testrepository>=0.0.18 # Apache-2.0/BSD
testscenarios>=0.4 # Apache-2.0/BSD
testtools>=1.4.0 # MIT

24
tox.ini
View File

@ -1,24 +0,0 @@
[tox]
minversion = 1.6
envlist = py3,pep8
ignore_basepython_conflict = True
[testenv]
basepython = python3
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = python setup.py testr --slowest --testr-args='{posargs}'
usedevelop = true
[testenv:pep8]
commands = flake8
[testenv:venv]
commands = {posargs}
[testenv:mkical]
commands = yaml2ical -y meetings/ -i icals/ -f
[flake8]
show-source = True
exclude = .venv,.tox,dist,doc,*.egg