Skip to content

Commit

Permalink
Merge branch 'main' into fix-requires
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Aug 21, 2024
2 parents 6d7af23 + ac93a71 commit 3e0408c
Show file tree
Hide file tree
Showing 20 changed files with 245 additions and 182 deletions.
9 changes: 8 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
omit =
# leading `*/` for pytest-dev/pytest-cov#456
*/.tox/*
*/pep517-build-env-*
disable_warnings =
couldnt-parse

[report]
show_missing = True
exclude_also =
# Exclude common false positives per
# https://coverage.readthedocs.io/en/latest/excluding.html#advanced-exclusion
# Ref jaraco/skeleton#97 and jaraco/skeleton#135
class .*\bProtocol\):
if TYPE_CHECKING:
9 changes: 0 additions & 9 deletions .flake8

This file was deleted.

101 changes: 49 additions & 52 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,99 +1,95 @@
name: tests

on: [push, pull_request]
on:
merge_group:
push:
branches-ignore:
# temporary GH branches relating to merge queues (jaraco/skeleton#93)
- gh-readonly-queue/**
tags:
# required if branches-ignore is supplied (jaraco/skeleton#103)
- '**'
pull_request:

permissions:
contents: read

env:
# Environment variables to support color support (jaraco/skeleton#66):
# Request colored output from CLI tools supporting it. Different tools
# interpret the value differently. For some, just being set is sufficient.
# For others, it must be a non-zero integer. For yet others, being set
# to a non-empty value is sufficient. For tox, it must be one of
# <blank>, 0, 1, false, no, off, on, true, yes. The only enabling value
# in common is "1".
# Environment variable to support color support (jaraco/skeleton#66)
FORCE_COLOR: 1
# MyPy's color enforcement (must be a non-zero number)
MYPY_FORCE_COLOR: -42
# Recognized by the `py` package, dependency of `pytest` (must be "1")
PY_COLORS: 1
# Make tox-wrapped tools see color requests
TOX_TESTENV_PASSENV: >-
FORCE_COLOR
MYPY_FORCE_COLOR
NO_COLOR
PY_COLORS
PYTEST_THEME
PYTEST_THEME_MODE

# Suppress noisy pip warnings
PIP_DISABLE_PIP_VERSION_CHECK: 'true'
PIP_NO_PYTHON_VERSION_WARNING: 'true'
PIP_NO_WARN_SCRIPT_LOCATION: 'true'

# Disable the spinner, noise in GHA; TODO(webknjaz): Fix this upstream
# Must be "1".
TOX_PARALLEL_NO_SPINNER: 1
# Ensure tests can sense settings about the environment
TOX_OVERRIDE: >-
testenv.pass_env+=GITHUB_*,FORCE_COLOR
jobs:
test:
strategy:
# https://blog.jaraco.com/efficient-use-of-ci-resources/
matrix:
python:
- "3.7"
- "3.11"
- "3.8"
- "3.12"
# Workaround for actions/setup-python#508
dev:
- -dev
platform:
- ubuntu-latest
- macos-latest
- windows-latest
include:
- python: "3.8"
platform: ubuntu-latest
- python: "3.9"
platform: ubuntu-latest
- python: "3.10"
platform: ubuntu-latest
- python: pypy3.9
- python: "3.11"
platform: ubuntu-latest
- python: pypy3.10
platform: ubuntu-latest
runs-on: ${{ matrix.platform }}
continue-on-error: ${{ matrix.python == '3.12' }}
continue-on-error: ${{ matrix.python == '3.13' }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}${{ matrix.dev }}
python-version: ${{ matrix.python }}
allow-prereleases: true
- name: Install tox
run: |
python -m pip install tox
- name: Run tests
run: python -m pip install tox
- name: Run
run: tox

docs:
collateral:
strategy:
fail-fast: false
matrix:
job:
- diffcov
- docs
runs-on: ubuntu-latest
env:
TOXENV: docs
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}${{ matrix.dev }}
python-version: 3.x
- name: Install tox
run: |
python -m pip install tox
- name: Run tests
run: tox
run: python -m pip install tox
- name: Eval ${{ matrix.job }}
run: tox -e ${{ matrix.job }}

check: # This job does nothing and is only used for the branch protection
if: always()

needs:
- test
- docs
- collateral

runs-on: ubuntu-latest

Expand All @@ -104,21 +100,22 @@ jobs:
jobs: ${{ toJSON(needs) }}

release:
permissions:
contents: write
needs:
- check
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11-dev
python-version: 3.x
- name: Install tox
run: |
python -m pip install tox
- name: Release
run: python -m pip install tox
- name: Run
run: tox -e release
env:
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
Expand Down
7 changes: 4 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 22.6.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.6
hooks:
- id: black
- id: ruff
- id: ruff-format
13 changes: 8 additions & 5 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ python:
install:
- path: .
extra_requirements:
- docs
- doc

# workaround for readthedocs/readthedocs.org#9623
# required boilerplate readthedocs/readthedocs.org#10401
build:
# workaround for readthedocs/readthedocs.org#9635
os: ubuntu-22.04
os: ubuntu-lts-latest
tools:
python: "3"
python: latest
# post-checkout job to ensure the clone isn't shallow jaraco/skeleton#114
jobs:
post_checkout:
- git fetch --unshallow || true
2 changes: 0 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Copyright Jason R. Coombs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
Expand Down
File renamed without changes.
14 changes: 7 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@

.. image:: https://img.shields.io/pypi/pyversions/jaraco.stream.svg

.. image:: https://github.com/jaraco/jaraco.stream/workflows/tests/badge.svg
.. image:: https://github.com/jaraco/jaraco.stream/actions/workflows/main.yml/badge.svg
:target: https://github.com/jaraco/jaraco.stream/actions?query=workflow%3A%22tests%22
:alt: tests

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
:alt: Code style: Black
.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
:target: https://github.com/astral-sh/ruff
:alt: Ruff

.. .. image:: https://readthedocs.org/projects/skeleton/badge/?version=latest
.. :target: https://skeleton.readthedocs.io/en/latest/?badge=latest
.. .. image:: https://readthedocs.org/projects/PROJECT_RTD/badge/?version=latest
.. :target: https://PROJECT_RTD.readthedocs.io/en/latest/?badge=latest
.. image:: https://img.shields.io/badge/skeleton-2023-informational
.. image:: https://img.shields.io/badge/skeleton-2024-informational
:target: https://blog.jaraco.com/skeleton

Routines for handling streaming data, including a
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Link dates and other references in the changelog
extensions += ['rst.linker']
link_files = {
'../CHANGES.rst': dict(
'../NEWS.rst': dict(
using=dict(GH='https://github.com'),
replace=[
dict(
Expand Down
2 changes: 1 addition & 1 deletion docs/history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
History
*******

.. include:: ../CHANGES (links).rst
.. include:: ../NEWS (links).rst
4 changes: 4 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Welcome to |project| documentation!
===================================

.. sidebar-links::
:home:
:pypi:

.. toctree::
:maxdepth: 1

Expand Down
2 changes: 2 additions & 0 deletions jaraco/stream/buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class LineBuffer:
>>> for line, expected in zip(b, [b'iterate', b'this']):
... assert line == expected
"""

line_sep_exp = re.compile(b'\r?\n')

def __init__(self):
Expand Down Expand Up @@ -90,6 +91,7 @@ class DecodingLineBuffer(LineBuffer):
...
UnicodeDecodeError: ...
"""

encoding = 'utf-8'
errors = 'strict'

Expand Down
2 changes: 1 addition & 1 deletion jaraco/stream/gzip.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from . import buffer


def read_chunks(stream, block_size=2 ** 10):
def read_chunks(stream, block_size=2**10):
"""
Given a byte stream with reader, yield chunks of block_size
until the stream is consusmed.
Expand Down
15 changes: 12 additions & 3 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
[mypy]
ignore_missing_imports = True
# required to support namespace packages
# https://github.com/python/mypy/issues/14057
# Is the project well-typed?
strict = False

# Early opt-in even when strict = False
warn_unused_ignores = True
warn_redundant_casts = True
enable_error_code = ignore-without-code

# Support namespace packages per https://github.com/python/mypy/issues/14057
explicit_package_bases = True

# Disable overload-overlap due to many false-positives
disable_error_code = overload-overlap
Loading

0 comments on commit 3e0408c

Please sign in to comment.