Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #137 from beeware/py312-compat
Browse files Browse the repository at this point in the history
Add Python 3.12 and 3.13 compatibility.
  • Loading branch information
freakboy3742 authored May 4, 2024
2 parents e9b3fe8 + 7e88beb commit c1e8dc3
Show file tree
Hide file tree
Showing 18 changed files with 324 additions and 217 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ jobs:
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11", "3.12-dev" ]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13-dev" ]
include:
- experimental: false
- python-version: "3.12-dev"
- python-version: "3.13-dev"
experimental: true
steps:
- name: Checkout
Expand Down
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,9 @@ repos:
rev: 7.0.0
hooks:
- id: flake8
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
# remove toml extra once Python 3.10 is no longer supported
additional_dependencies: ['.[toml]']
35 changes: 34 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ If you notice any differences, please report them.
Requirements
------------

- python 3.7+
- python 3.8+
- pygobject
- glib
- gtk+3 (optional)
Expand Down Expand Up @@ -129,6 +129,39 @@ actually prevent you from doing that (in accordance with PEP 3156), however
in mind that enclosed loops may be started at any time by third-party code
calling GLib's primitives.

Testing
-------

Testing GBulb requires a Linux environment that has GLib and GTK development
libraries available.

The tests folder contains a Dockerfile that defines a complete testing
environment. To use the Docker environment, run the following from the root of
the git checkout:

$ docker buildx build --tag beeware/gbulb:latest --file ./tests/Dockerfile .
$ docker run --rm --volume $(PWD):/home/brutus/gbulb:z -it beeware/gbulb:latest

This will drop you into an Ubuntu 24.04 shell that has Python 3.8-3.13
installed, mounting the current working directory as `/home/brutus/gbulb`. You
can use this to create virtual environments for each Python version.

Once you have an active virtual environment, run:

(venv) $ pip install -e .[dev]
(venv) $ pytest

to run the test suite. Alternatively, you can install tox, and then run:

# To test a single Python version
(venv) $ tox -e py

# To test Python 3.10 specifically
(venv) $ tox -e py310

# To test all versions
(venv) $ tox

Community
---------

Expand Down
1 change: 1 addition & 0 deletions changes/137.removal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support for Python 3.7 was removed.
1 change: 1 addition & 0 deletions changes/76.feature.1.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support for Python 3.12 was added.
1 change: 1 addition & 0 deletions changes/76.feature.2.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support for Python 3.13 was added.
92 changes: 90 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,70 @@
[build-system]
requires = [
"setuptools >= 46.4.0",
"wheel >= 0.32.0",
"setuptools==69.5.1",
"setuptools_scm==8.0.4",
]
build-backend = "setuptools.build_meta"

[project]
dynamic = ["version"]
name = "gbulb"
description = "GLib event loop for Python asyncio"
readme = "README.rst"
requires-python = ">= 3.8"
license.text = "Apache 2.0"
authors = [
{name="Russell Keith-Magee", email="russell@keith-magee.com"},
{name="Nathan Hoad", email="nathan@getoffmalawn.com"}
]
maintainers = [
{name="Russell Keith-Magee", email="russell@keith-magee.com"},
]
keywords = [
"gtk",
"glib",
"gnome",
"asyncio",
"tulip",
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: POSIX",
"Programming Language :: Python :: 3",
"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",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
# Dependencies required at runtime are set as ranges to ensure maximum
# compatibility with the end-user's development environment.
"pygobject >= 3.14.0",
]

[project.optional-dependencies]
# Extras used by developers *of* gbulb are pinned to specific versions to
# ensure environment consistency.
dev = [
"coverage[toml] == 7.5.0",
# Pre-commit 3.6.0 deprecated support for Python 3.8
"pre-commit == 3.5.0 ; python_version < '3.9'",
"pre-commit == 3.7.0 ; python_version >= '3.9'",
"pytest == 8.1.1",
"tox == 4.15.0",
]

[project.urls]
Homepage = "https://github.com/beeware/gbulb"
Funding = "https://beeware.org/contributing/membership/"
# Documentation = "http://gbulb.readthedocs.io/en/latest/"
Tracker = "https://github.com/beeware/gbulb/issues"
Source = "https://github.com/beeware/gbulb"

[tool.isort]
profile = "black"
skip_glob = [
Expand All @@ -13,9 +73,37 @@ skip_glob = [
]
multi_line_output = 3

[tool.pytest.ini_options]
testpaths = ["tests"]
filterwarnings = [
# "error", # promote warnings to errors
]

# need to ensure build directories aren't excluded from recursion
norecursedirs = []

[tool.setuptools_scm]
# To enable SCM versioning, we need an empty tool configuration for setuptools_scm

[tool.towncrier]
directory = "changes"
package = "gbulb"
package_dir = "src"
filename = "CHANGELOG.rst"
title_format = "{version} ({project_date})"
issue_format = "`#{issue} <https://github.com/beeware/briefcase/issues/{issue}>`__"
template = "changes/template.rst"
type = [
{ directory = "feature", name = "Features", showcontent = true },
{ directory = "bugfix", name = "Bugfixes", showcontent = true },
{ directory = "removal", name = "Backward Incompatible Changes", showcontent = true },
{ directory = "doc", name = "Documentation", showcontent = true },
{ directory = "misc", name = "Misc", showcontent = false },
]

[tool.codespell]
skip = '.git,*.pdf,*.svg'
# the way to make case sensitive skips of words etc
ignore-regex = '\bNd\b'
# case insensitive
# ignore-words-list = ''
75 changes: 0 additions & 75 deletions setup.cfg

This file was deleted.

21 changes: 20 additions & 1 deletion src/gbulb/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
from .glib_events import * # noqa: F401,F403
from .utils import * # noqa: F401,F403

__version__ = "0.6.4"
__all__ = [
"__version__",
]

try:
# Read version from SCM metadata
# This will only exist in a development environment
from setuptools_scm import get_version

# Excluded from coverage because a pure test environment (such as the one
# used by tox in CI) won't have setuptools_scm
__version__ = get_version("../..", relative_to=__file__) # pragma: no cover
except (ModuleNotFoundError, LookupError): # pragma: no cover
# If setuptools_scm isn't in the environment, the call to import will fail.
# If it *is* in the environment, but the code isn't a git checkout (e.g.,
# it's been pip installed non-editable) the call to get_version() will fail.
# If either of these occurs, read version from the installer metadata.
from importlib.metadata import version

__version__ = version("gbulb")
Loading

0 comments on commit c1e8dc3

Please sign in to comment.