Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Python 3.12 and drop EOL 3.7 #283

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ jobs:
fail-fast: false
matrix:
include:
- {name: Linux, python: '3.11', os: ubuntu-latest, tox: py311}
- {name: Windows, python: '3.11', os: windows-latest, tox: py311}
- {name: Mac, python: '3.11', os: macos-latest, tox: py311}
- {name: Linux, python: '3.12', os: ubuntu-latest, tox: py312}
- {name: Windows, python: '3.12', os: windows-latest, tox: py312}
- {name: Mac, python: '3.12', os: macos-latest, tox: py312}
- {name: '3.11', python: '3.11', os: ubuntu-latest, tox: py311}
- {name: '3.10', python: '3.10', os: ubuntu-latest, tox: py310}
- {name: '3.9', python: '3.9', os: ubuntu-latest, tox: py39}
- {name: '3.8', python: '3.8', os: ubuntu-latest, tox: py38}
- {name: '3.7', python: '3.7', os: ubuntu-latest, tox: py37}
- {name: 'PyPy3', python: 'pypy-3.9', os: ubuntu-latest, tox: pypy3}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: update pip
Expand All @@ -40,7 +40,7 @@ jobs:
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"
- name: cache pip
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: pip|${{ runner.os }}|${{ matrix.python }}|${{ hashFiles('setup.py') }}|${{ hashFiles('requirements/*.txt') }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ glom is a new and powerful way to handle real-world data, featuring:
* Built-in data exploration and debugging features

All of that and more, available as a [fully-documented][rtd],
pure-Python package, tested on Python 3.7+, as well as
pure-Python package, tested on Python 3.8+, as well as
PyPy3. Installation is as easy as:

```
Expand Down
21 changes: 10 additions & 11 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
Expand Down Expand Up @@ -31,14 +30,14 @@

# -- Project information -----------------------------------------------------

project = u'glom'
copyright = u'2023, Mahmoud Hashemi'
author = u'Mahmoud Hashemi'
project = 'glom'
copyright = '2023, Mahmoud Hashemi'
author = 'Mahmoud Hashemi'

# The short X.Y version
version = u'23.5'
version = '23.5'
# The full version, including alpha/beta/rc tags
release = u'23.5.0'
release = '23.5.0'


todo_add_to_theme_to_keep_menus_expanded = """
Expand Down Expand Up @@ -95,7 +94,7 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path .
exclude_patterns = [u'_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'default'
Expand Down Expand Up @@ -167,8 +166,8 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'glom.tex', u'glom Documentation',
u'Mahmoud Hashemi', 'manual'),
(master_doc, 'glom.tex', 'glom Documentation',
'Mahmoud Hashemi', 'manual'),
]


Expand All @@ -177,7 +176,7 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'glom', u'glom Documentation',
(master_doc, 'glom', 'glom Documentation',
[author], 1)
]

Expand All @@ -188,7 +187,7 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'glom', u'glom Documentation',
(master_doc, 'glom', 'glom Documentation',
author, 'glom', 'One line description of project.',
'Miscellaneous'),
]
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ or `try glom in your browser now`__!
Installation
------------

glom is pure Python, and tested on Python 3.7+, as well as
glom is pure Python, and tested on Python 3.8+, as well as
PyPy3. Installation is easy::

pip install glom
Expand Down
1 change: 0 additions & 1 deletion glom/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

from glom.core import (glom,
Fill,
Auto,
Expand Down
1 change: 0 additions & 1 deletion glom/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

from glom.cli import console_main

if __name__ == '__main__':
Expand Down
17 changes: 8 additions & 9 deletions glom/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"""


from __future__ import print_function

import os
import ast
Expand Down Expand Up @@ -65,7 +64,7 @@ def glom_cli(target, spec, indent, debug, inspect):
try:
result = glom.glom(target, spec)
except GlomError as ge:
print('%s: %s' % (ge.__class__.__name__, ge))
print(f'{ge.__class__.__name__}: {ge}')
return 1

if not indent:
Expand Down Expand Up @@ -170,10 +169,10 @@ def mw_get_target(next_, posargs_, target_file, target_format, spec_file, spec_f
raise UsageError('expected spec file or spec argument, not both')
elif spec_file:
try:
with open(spec_file, 'r') as f:
with open(spec_file) as f:
spec_text = f.read()
except IOError as ose:
raise UsageError('could not read spec file %r, got: %s' % (spec_file, ose))
except OSError as ose:
raise UsageError(f'could not read spec file {spec_file!r}, got: {ose}')

if not spec_text:
spec = Path()
Expand All @@ -195,9 +194,9 @@ def mw_get_target(next_, posargs_, target_file, target_format, spec_file, spec_f
target_text = sys.stdin.read()
elif target_file:
try:
target_text = open(target_file, 'r').read()
except IOError as ose:
raise UsageError('could not read target file %r, got: %s' % (target_file, ose))
target_text = open(target_file).read()
except OSError as ose:
raise UsageError(f'could not read target file {target_file!r}, got: {ose}')
elif not target_text and not isatty(sys.stdin):
target_text = sys.stdin.read()

Expand All @@ -218,7 +217,7 @@ def _from_glom_import_star():

def _eval_python_full_spec(py_text):
name = '__cli_glom_spec__'
code_str = '%s = %s' % (name, py_text)
code_str = f'{name} = {py_text}'
env = _from_glom_import_star()
spec = _compile_code(code_str, name=name, env=env)
return spec
Expand Down
Loading
Loading