Skip to content

Commit

Permalink
Merge branch 'release/1.8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
RazerM committed Oct 26, 2024
2 parents f6ecc76 + e32ab0f commit 872ea5e
Show file tree
Hide file tree
Showing 40 changed files with 81 additions and 37 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: "actions/checkout@v4"
- uses: "actions/setup-python@v4"
- uses: "actions/setup-python@v5"
with:
python-version: "${{ matrix.python-version }}"
cache: pip
Expand All @@ -54,15 +54,15 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
arch: ["x86", "x64"]

env:
ENABLE_LOGBOOK_NTEVENTLOG_TESTS: "1"

steps:
- uses: "actions/checkout@v4"
- uses: "actions/setup-python@v4"
- uses: "actions/setup-python@v5"
with:
python-version: "${{ matrix.python-version }}"
architecture: "${{ matrix.arch }}"
Expand All @@ -84,11 +84,11 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: "actions/checkout@v4"
- uses: "actions/setup-python@v4"
- uses: "actions/setup-python@v5"
with:
python-version: "${{ matrix.python-version }}"
architecture: "${{ matrix.arch }}"
Expand All @@ -109,5 +109,5 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: pre-commit/[email protected].0
- uses: actions/setup-python@v5
- uses: pre-commit/[email protected].1
8 changes: 4 additions & 4 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
id-token: write
steps:
- name: Download artifacts
uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e # v2.28.0
uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # v6
with:
path: artifacts/
run_id: ${{ github.event.inputs.run_id || github.event.workflow_run.id }}
Expand All @@ -39,16 +39,16 @@ jobs:
ls -lR artifacts/
mkdir dist
mv artifacts/sdist/*.tar.gz dist/
mv artifacts/wheels/*.whl dist/
mv artifacts/wheels-*/*.whl dist/
- name: Publish to pypi.org
uses: pypa/gh-action-pypi-publish@b7f401de30cb6434a1e19f805ff006643653240e # v1.8.10
uses: pypa/gh-action-pypi-publish@f7600683efdcb7656dec5b29656edb7bc586e597 # v1.10.3
if: github.event_name == 'workflow_run' || (github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'pypi')
with:
packages-dir: dist/

- name: Publish to test.pypi.org
uses: pypa/gh-action-pypi-publish@b7f401de30cb6434a1e19f805ff006643653240e # v1.8.10
uses: pypa/gh-action-pypi-publish@f7600683efdcb7656dec5b29656edb7bc586e597 # v1.10.3
if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'testpypi'
with:
repository-url: https://test.pypi.org/legacy/
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/wheel-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: .venv/bin/pip install -U pip build
- name: Make sdist
run: .venv/bin/python -m build --sdist
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: sdist
path: dist/*.tar.gz
Expand All @@ -47,7 +47,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-2019, macos-11]
os: [ubuntu-20.04, windows-2019, macos-12]

steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
Expand All @@ -57,9 +57,9 @@ jobs:
persist-credentials: false

- name: Build wheels
uses: pypa/cibuildwheel@fff9ec32ed25a9c576750c91e06b410ed0c15db7 # v2.16.2
uses: pypa/cibuildwheel@7940a4c0e76eb2030e473a5f864f291f63ee879b # v2.21.3

- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: wheels
name: wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: check-toml
- id: check-yaml
Expand All @@ -9,21 +9,21 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.3.3
hooks:
- id: prettier
exclude: docs/sheet/.*\.html$
- repo: https://github.com/asottile/pyupgrade
rev: v3.7.0
rev: v3.18.0
hooks:
- id: pyupgrade
args: [--py38-plus]
args: [--py39-plus]
- repo: https://github.com/timothycrosley/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 23.3.0
rev: 24.10.0
hooks:
- id: black
7 changes: 7 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Logbook Changelog
=================

Version 1.8.0
-------------

- Python 3.13 support
- Fixed deprecation warnings on Python 3.12
- Dropped support for Python 3.8

Version 1.7.0.post0
-------------------

Expand Down
1 change: 1 addition & 0 deletions benchmark/bench_disabled_introspection.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests with frame introspection disabled"""

from logbook import Flags, Logger, NullHandler

log = Logger("Test logger")
Expand Down
1 change: 1 addition & 0 deletions benchmark/bench_disabled_logger.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests with the whole logger disabled"""

from logbook import Logger

log = Logger("Test logger")
Expand Down
1 change: 1 addition & 0 deletions benchmark/bench_enabled_introspection.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests with stack frame introspection enabled"""

from logbook import Flags, Logger, NullHandler

log = Logger("Test logger")
Expand Down
1 change: 1 addition & 0 deletions benchmark/bench_file_handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Benchmarks the file handler"""

from tempfile import NamedTemporaryFile

from logbook import FileHandler, Logger
Expand Down
1 change: 1 addition & 0 deletions benchmark/bench_file_handler_unicode.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Benchmarks the file handler with unicode"""

from tempfile import NamedTemporaryFile

from logbook import FileHandler, Logger
Expand Down
1 change: 1 addition & 0 deletions benchmark/bench_logger_creation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test with no handler active"""

from logbook import Logger


Expand Down
1 change: 1 addition & 0 deletions benchmark/bench_logger_level_low.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Benchmarks too low logger levels"""

from io import StringIO

from logbook import ERROR, Logger, StreamHandler
Expand Down
1 change: 1 addition & 0 deletions benchmark/bench_logging_file_handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests logging file handler in comparison"""

from logging import FileHandler, getLogger
from tempfile import NamedTemporaryFile

Expand Down
1 change: 1 addition & 0 deletions benchmark/bench_logging_file_handler_unicode.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests logging file handler in comparison"""

from logging import FileHandler, getLogger
from tempfile import NamedTemporaryFile

Expand Down
1 change: 1 addition & 0 deletions benchmark/bench_logging_logger_creation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test with no handler active"""

from logging import getLogger

root_logger = getLogger()
Expand Down
1 change: 1 addition & 0 deletions benchmark/bench_logging_logger_level_low.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests with a logging handler becoming a noop for comparison"""

from io import StringIO
from logging import ERROR, StreamHandler, getLogger

Expand Down
1 change: 1 addition & 0 deletions benchmark/bench_logging_noop.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests with a logging handler becoming a noop for comparison"""

from io import StringIO
from logging import ERROR, StreamHandler, getLogger

Expand Down
1 change: 1 addition & 0 deletions benchmark/bench_logging_noop_filter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests with a filter disabling a handler for comparsion in logging"""

from io import StringIO
from logging import Filter, StreamHandler, getLogger

Expand Down
1 change: 1 addition & 0 deletions benchmark/bench_logging_stream_handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests the stream handler in logging"""

from io import StringIO
from logging import Logger, StreamHandler

Expand Down
1 change: 1 addition & 0 deletions benchmark/bench_noop.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test with no handler active"""

from io import StringIO

from logbook import ERROR, Logger, NullHandler, StreamHandler
Expand Down
1 change: 1 addition & 0 deletions benchmark/bench_noop_filter_on_handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Like the filter test, but with the should_handle implemented"""

from io import StringIO

from logbook import Logger, NullHandler, StreamHandler
Expand Down
1 change: 1 addition & 0 deletions benchmark/bench_redirect_from_logging.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests redirects from logging to logbook"""

from io import StringIO
from logging import getLogger

Expand Down
1 change: 1 addition & 0 deletions benchmark/bench_redirect_to_logging.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests redirects from logging to logbook"""

from io import StringIO
from logging import StreamHandler, getLogger

Expand Down
1 change: 1 addition & 0 deletions benchmark/bench_stack_manipulation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests basic stack manipulation performance"""

from io import StringIO
from tempfile import NamedTemporaryFile

Expand Down
1 change: 1 addition & 0 deletions benchmark/bench_stream_handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests the stream handler"""

from io import StringIO

from logbook import Logger, StreamHandler
Expand Down
1 change: 1 addition & 0 deletions benchmark/bench_test_handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests the test handler"""

from logbook import Logger, TestHandler

log = Logger("Test logger")
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ maintainers = [
]
classifiers = [
"Programming Language :: Python :: 3 :: Only",
"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",
]
requires-python = ">=3.8"
requires-python = ">=3.9"
dynamic = ["version"]

[project.urls]
Expand Down
2 changes: 1 addition & 1 deletion src/logbook/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.7.0.post0"
__version__ = "1.8.0"
1 change: 1 addition & 0 deletions src/logbook/_fallback.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
:copyright: (c) 2010 by Armin Ronacher, Georg Brandl.
:license: BSD, see LICENSE for more details.
"""

from itertools import count

from logbook.concurrency import (
Expand Down
1 change: 1 addition & 0 deletions src/logbook/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
:copyright: (c) 2010 by Armin Ronacher, Georg Brandl.
:license: BSD, see LICENSE for more details.
"""

import os
import sys
import traceback
Expand Down
7 changes: 5 additions & 2 deletions src/logbook/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@
:copyright: (c) 2010 by Armin Ronacher, Georg Brandl.
:license: BSD, see LICENSE for more details.
"""

import logging
import sys
import warnings
from collections.abc import Mapping
from datetime import date, datetime, timezone
from datetime import timezone

import logbook

from .helpers import datetime_utcfromtimestamp


def redirect_logging(set_root_logger_level=True):
"""Permanently redirects logging to the stdlib. This also
Expand Down Expand Up @@ -140,7 +143,7 @@ def convert_time(self, timestamp):
"""Converts the UNIX timestamp of the old record into a
datetime object as used by logbook.
"""
return datetime.utcfromtimestamp(timestamp)
return datetime_utcfromtimestamp(timestamp)

def convert_record(self, old_record):
"""Converts an old logging record into a logbook log record."""
Expand Down
1 change: 1 addition & 0 deletions src/logbook/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
:copyright: (c) 2010 by Armin Ronacher, Georg Brandl.
:license: BSD, see LICENSE for more details.
"""

import errno
import gzip
import math
Expand Down
11 changes: 9 additions & 2 deletions src/logbook/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
:copyright: (c) 2010 by Armin Ronacher, Georg Brandl.
:license: BSD, see LICENSE for more details.
"""

import errno
import os
import random
Expand Down Expand Up @@ -136,8 +137,6 @@ def _convert(obj):
for key, value in obj.items():
if not isinstance(key, str):
key = str(key)
if not isinstance(key, str):
key = key
rv[key] = _convert(value)
return rv

Expand All @@ -153,8 +152,16 @@ def datetime_utcnow():
"""
return datetime.now(timezone.utc).replace(tzinfo=None)

def datetime_utcfromtimestamp(timestamp):
"""datetime.utcfromtimesetamp() but doesn't emit a deprecation warning.
Will be fixed by https://github.com/getlogbook/logbook/issues/353
"""
return datetime.fromtimestamp(timestamp, timezone.utc).replace(tzinfo=None)

else:
datetime_utcnow = datetime.utcnow
datetime_utcfromtimestamp = datetime.utcfromtimestamp


def format_iso8601(d=None):
Expand Down
Loading

0 comments on commit 872ea5e

Please sign in to comment.