Skip to content

Commit

Permalink
Merge pull request #164 from roskakori/163-update-dependencies
Browse files Browse the repository at this point in the history
#163 Update dependencies
  • Loading branch information
roskakori authored Dec 10, 2024
2 parents 6c28030 + 4b9c59a commit 8ff0ecd
Show file tree
Hide file tree
Showing 37 changed files with 640 additions and 534 deletions.
19 changes: 6 additions & 13 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
env:
MAIN_PYTHON_VERSION: "3.10"
MAIN_PYTHON_VERSION: "3.12"

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
Expand All @@ -38,29 +38,22 @@ jobs:
- name: Run the test suite
run: |
poetry run pytest --cov=cutplace --cov-branch
- name: Update coveralls
if: ${{ matrix.python-version }} == $MAIN_PYTHON_VERSION
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
poetry run coveralls
check-style:
runs-on: ubuntu-latest
# Disable pre-commit check on main and production to prevent
# pull request merges to fail with "don't commit to branch".
if: github.ref != 'refs/heads/main'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install pre-commit
run: |
sudo apt-get install python3
python -m pip install --upgrade pip
pip install pre-commit
- name: Load cached pre-commit
id: cached-pre-commit
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ repos:
- id: isort

- repo: https://github.com/ambv/black
rev: 23.7.0
rev: 24.10.0
hooks:
- id: black

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.2
rev: v3.1.0
hooks:
- id: prettier

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: fix-byte-order-marker
- id: trailing-whitespace
Expand All @@ -32,7 +32,7 @@ repos:
- id: mixed-line-ending

- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
rev: 7.1.1
hooks:
- id: flake8
additional_dependencies: ["pep8-naming==0.13.3"]
4 changes: 0 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
:target: https://travis-ci.org/roskakori/cutplace
:alt: Build Status

.. image:: https://coveralls.io/repos/roskakori/cutplace/badge.png?branch=master
:target: https://coveralls.io/r/roskakori/cutplace?branch=master
:alt: Test coverage

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
:alt: Black
Expand Down
1 change: 1 addition & 0 deletions cutplace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
In addition to the command line tool the functionality of cutplace is also
accessible through a Python API.
"""

import pkg_resources

from cutplace.errors import Location
Expand Down
1 change: 1 addition & 0 deletions cutplace/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
https://pypi.python.org/pypi/future and
https://docs.python.org/2/library/csv.html#examples.
"""

# Copyright (C) 2009-2021 Thomas Aglassinger
#
# This program is free software: you can redistribute it and/or modify it
Expand Down
3 changes: 2 additions & 1 deletion cutplace/_tools.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Various internal utility functions.
"""

# Copyright (C) 2009-2021 Thomas Aglassinger
#
# This program is free software: you can redistribute it and/or modify it
Expand Down Expand Up @@ -82,7 +83,7 @@ def generated_tokens(text):

def human_readable_list(items, final_separator="or"):
"""
All values in ``items`` in a human readable form. This is meant to be
All values in ``items`` in a human-readable form. This is meant to be
used in error messages, where dumping ``"%r"`` to the user does not cut
it.
"""
Expand Down
1 change: 1 addition & 0 deletions cutplace/checks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Standard checks that can cover a whole row or data set.
"""

# Copyright (C) 2009-2021 Thomas Aglassinger
#
# This program is free software: you can redistribute it and/or modify it
Expand Down
1 change: 1 addition & 0 deletions cutplace/data.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Data formats that describe the general structure of the data.
"""

# Copyright (C) 2009-2021 Thomas Aglassinger
#
# This program is free software: you can redistribute it and/or modify it
Expand Down
1 change: 1 addition & 0 deletions cutplace/errors.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Errors that can be raised by cutplace.
"""

# Copyright (C) 2009-2021 Thomas Aglassinger
#
# This program is free software: you can redistribute it and/or modify it
Expand Down
1 change: 1 addition & 0 deletions cutplace/fields.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Standard field formats supported by cutplace.
"""

# Copyright (C) 2009-2021 Thomas Aglassinger
#
# This program is free software: you can redistribute it and/or modify it
Expand Down
1 change: 1 addition & 0 deletions cutplace/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
... else:
... print('tkinter must be installed')
"""

# Copyright (C) 2009-2021 Thomas Aglassinger
#
# This program is free software: you can redistribute it and/or modify it
Expand Down
1 change: 1 addition & 0 deletions cutplace/interface.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Classes and functions to read and represent cutplace interface definitions.
"""

# Copyright (C) 2009-2021 Thomas Aglassinger
#
# This program is free software: you can redistribute it and/or modify it
Expand Down
18 changes: 12 additions & 6 deletions cutplace/ranges.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
particular to specify the length limits for field values and the characters allowed for a data
format.
"""

import decimal

# Copyright (C) 2009-2021 Thomas Aglassinger
Expand Down Expand Up @@ -174,14 +175,19 @@ def _decimal_as_text(decimal_value, precision=DEFAULT_PRECISION):
return "%.*f" % (precision, decimal_value)


def _unified_ellipsis(range_rescription: str) -> str:
# HACK: Use space around `ELLIPSIS` to avoid characters after it being treated as part of a `token.NAME`.
return range_rescription.replace("...", ELLIPSIS).replace(ELLIPSIS, f" {ELLIPSIS} ")


class Range(object):
"""
A range that can be used to validate that a value is within it.
"""

def __init__(self, description, default=None):
"""
Setup a range as specified by ``description``.
Set up a range as specified by ``description``.
:param str description: a range description of the form \
``lower...upper`` or ``limit``. In case it is empty (``''``), any \
Expand All @@ -206,7 +212,7 @@ def __init__(self, description, default=None):
self._lower_limit = None
self._upper_limit = None
else:
self._description = description.replace("...", ELLIPSIS)
self._description = _unified_ellipsis(description)
self._items = []

name_for_code = "range"
Expand All @@ -222,7 +228,9 @@ def __init__(self, description, default=None):
while not _tools.is_eof_token(next_token) and not _tools.is_comma_token(next_token):
next_type = next_token[0]
next_value = next_token[1]
if next_type in (token.NAME, token.NUMBER, token.STRING):
if next_value in (ELLIPSIS, ":"):
ellipsis_found = True
elif next_type in (token.NAME, token.NUMBER, token.STRING):
if next_type == token.NAME:
# Symbolic names, e.g. ``tab``.
value_as_int = code_for_symbolic_token(name_for_code, next_value, location)
Expand Down Expand Up @@ -268,8 +276,6 @@ def __init__(self, description, default=None):
)
elif (next_type == token.OP) and (next_value == "-"):
after_hyphen = True
elif next_value in (ELLIPSIS, ":"):
ellipsis_found = True
else:
raise errors.InterfaceError(
"range must be specified using integer numbers, text, "
Expand Down Expand Up @@ -543,7 +549,7 @@ def __init__(self, description, default=None, location=None):
self._lower_limit = None
self._upper_limit = None
else:
self._description = description.replace("...", ELLIPSIS)
self._description = _unified_ellipsis(description)
self._items = []
tokens = _tools.tokenize_without_space(self._description)
end_reached = False
Expand Down
1 change: 1 addition & 0 deletions cutplace/rowio.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Input and output of data rows in various formats validating only the basic
format but not any :py:mod:`cutplace.fields` or :py:mod:`cutplace.checks`.
"""

# Copyright (C) 2009-2021 Thomas Aglassinger
#
# This program is free software: you can redistribute it and/or modify it
Expand Down
1 change: 1 addition & 0 deletions cutplace/sql.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Methods to create sql statements from existing fields.
"""

# Copyright (C) 2009-2013 Thomas Aglassinger
#
# This program is free software: you can redistribute it and/or modify it
Expand Down
1 change: 1 addition & 0 deletions cutplace/validio.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Validated input and output of tabular data in various formats.
"""

# Copyright (C) 2009-2021 Thomas Aglassinger
#
# This program is free software: you can redistribute it and/or modify it
Expand Down
7 changes: 4 additions & 3 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ Revision history

This chapter describes improvements compared to earlier versions of cutplace.

Version 0.9.2, 2023-xx-xx
Version 0.9.2, 2024-12-10
=========================

* Remove support for Python 3.7
(`#149 <https://github.com/roskakori/cutplace/issues/149>`_).
* Updated supported Python versions and dependencies (
`#149 <https://github.com/roskakori/cutplace/issues/149>`_,
`#163 <https://github.com/roskakori/cutplace/issues/163>`_).

Version 0.9.1, 2022-12-29
=========================
Expand Down
4 changes: 2 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Dependencies for "Read the Docs" build.
# See <https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html>.
sphinx==7.2.2
sphinx_rtd_theme==1.3.0
sphinx==8.1.3
sphinx_rtd_theme==3.0.2
readthedocs-sphinx-search==0.3.2
1 change: 1 addition & 0 deletions examples/plugins.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Example plugins for cutplace.
"""

from cutplace import checks, errors, fields, ranges


Expand Down
1 change: 1 addition & 0 deletions examples/readme_example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Example for validated reading as used in the README.
"""

import cutplace.errors

if __name__ == "__main__":
Expand Down
Loading

0 comments on commit 8ff0ecd

Please sign in to comment.