Skip to content

Commit a6b71cb

Browse files
committed
* Adding support for YAML width
* Adding support for Python 3.14 * Removing support for Python 3.9 as it is EOL
1 parent 0b4caf8 commit a6b71cb

File tree

17 files changed

+48
-25
lines changed

17 files changed

+48
-25
lines changed

.github/workflows/pythonpublish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Set up Python
1919
uses: actions/setup-python@v5
2020
with:
21-
python-version: '3.13'
21+
python-version: '3.14'
2222

2323
- name: Install Dependencies
2424
run: |
@@ -39,7 +39,7 @@ jobs:
3939
strategy:
4040
matrix:
4141
os: [macos-latest, windows-latest]
42-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
42+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
4343
runs-on: ${{ matrix.os }}
4444

4545
steps:

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
package-checks:
1414
strategy:
1515
matrix:
16-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.10"]
16+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "pypy-3.10"]
1717
os: [ubuntu-latest, macos-latest, windows-latest]
1818
runs-on: ${{ matrix.os }}
1919
steps:
@@ -98,7 +98,7 @@ jobs:
9898
test:
9999
strategy:
100100
matrix:
101-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
101+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
102102
os: [ubuntu-latest, macos-latest, windows-latest]
103103
runs-on: ${{ matrix.os }}
104104
steps:

CHANGES.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Changelog
22
=========
33

4+
Version 7.4.0
5+
-------------
6+
7+
* Adding support for YAML width
8+
* Adding support for Python 3.14
9+
* Removing support for Python 3.9 as it is EOL
10+
411
Version 7.3.2
512
-------------
613

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2017-2023 Chris Griffith
3+
Copyright (c) 2017-2026 Chris Griffith
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ Also special shout-out to PythonBytes_, who featured Box on their podcast.
139139
License
140140
=======
141141

142-
MIT License, Copyright (c) 2017-2023 Chris Griffith. See LICENSE_ file.
142+
MIT License, Copyright (c) 2017-2026 Chris Griffith. See LICENSE_ file.
143143

144144

145145
.. |BoxImage| image:: https://raw.githubusercontent.com/cdgriffith/Box/master/box_logo.png

box/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33

44
__author__ = "Chris Griffith"
5-
__version__ = "7.3.2"
5+
__version__ = "7.3.3"
66

77
from box.box import Box
88
from box.box_list import BoxList

box/box.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33
#
4-
# Copyright (c) 2017-2023 - Chris Griffith - MIT License
4+
# Copyright (c) 2017-2026 - Chris Griffith - MIT License
55
"""
66
Improved dictionary access through dot notation with additional tools.
77
"""
@@ -1002,6 +1002,7 @@ def to_yaml(
10021002
default_flow_style: bool = False,
10031003
encoding: str = "utf-8",
10041004
errors: str = "strict",
1005+
width: int = 120,
10051006
**yaml_kwargs,
10061007
):
10071008
"""
@@ -1011,6 +1012,7 @@ def to_yaml(
10111012
:param default_flow_style: False will recursively dump dicts
10121013
:param encoding: File encoding
10131014
:param errors: How to handle encoding errors
1015+
:param width: Line width for YAML output
10141016
:param yaml_kwargs: additional arguments to pass to yaml.dump
10151017
:return: string of YAML (if no filename provided)
10161018
"""
@@ -1020,6 +1022,7 @@ def to_yaml(
10201022
default_flow_style=default_flow_style,
10211023
encoding=encoding,
10221024
errors=errors,
1025+
width=width,
10231026
**yaml_kwargs,
10241027
)
10251028

@@ -1062,6 +1065,7 @@ def to_yaml(
10621065
default_flow_style: bool = False,
10631066
encoding: str = "utf-8",
10641067
errors: str = "strict",
1068+
width: int = 120,
10651069
**yaml_kwargs,
10661070
):
10671071
raise BoxError('yaml is unavailable on this system, please install the "ruamel.yaml" or "PyYAML" package')

box/box.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ class Box(dict):
9393
default_flow_style: bool = ...,
9494
encoding: str = ...,
9595
errors: str = ...,
96+
width: int = ...,
9697
**yaml_kwargs,
9798
): ...
9899
@classmethod

box/box_list.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33
#
4-
# Copyright (c) 2017-2023 - Chris Griffith - MIT License
4+
# Copyright (c) 2017-2026 - Chris Griffith - MIT License
55
import copy
66
import re
77
from os import PathLike
@@ -98,7 +98,7 @@ def __setitem__(self, key, value):
9898
self.extend([None] * (pos - len(self) + 1))
9999
if len(list_pos.group()) == len(key):
100100
return super().__setitem__(pos, value)
101-
children = key[len(list_pos.group()):].lstrip(".")
101+
children = key[len(list_pos.group()) :].lstrip(".")
102102
if self.box_options.get("default_box"):
103103
if children[0] == "[":
104104
super().__setitem__(pos, box.BoxList(**self.box_options))
@@ -258,6 +258,7 @@ def to_yaml(
258258
default_flow_style: bool = False,
259259
encoding: str = "utf-8",
260260
errors: str = "strict",
261+
width: int = 120,
261262
**yaml_kwargs,
262263
):
263264
"""
@@ -267,6 +268,7 @@ def to_yaml(
267268
:param default_flow_style: False will recursively dump dicts
268269
:param encoding: File encoding
269270
:param errors: How to handle encoding errors
271+
:param width: Line width for YAML output
270272
:param yaml_kwargs: additional arguments to pass to yaml.dump
271273
:return: string of YAML or return of `yaml.dump`
272274
"""
@@ -276,6 +278,7 @@ def to_yaml(
276278
default_flow_style=default_flow_style,
277279
encoding=encoding,
278280
errors=errors,
281+
width=width,
279282
**yaml_kwargs,
280283
)
281284

@@ -318,6 +321,7 @@ def to_yaml(
318321
default_flow_style: bool = False,
319322
encoding: str = "utf-8",
320323
errors: str = "strict",
324+
width: int = 120,
321325
**yaml_kwargs,
322326
):
323327
raise BoxError('yaml is unavailable on this system, please install the "ruamel.yaml" or "PyYAML" package')

box/box_list.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class BoxList(list):
4949
default_flow_style: bool = ...,
5050
encoding: str = ...,
5151
errors: str = ...,
52+
width: int = ...,
5253
**yaml_kwargs: Any,
5354
) -> Any: ...
5455
@classmethod

0 commit comments

Comments
 (0)