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

chore: bump Python version #980

Merged
merged 18 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from 16 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
6 changes: 1 addition & 5 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ jobs:
fail-fast: false
matrix:
platform: ["windows-latest", "macos-latest", "ubuntu-latest"]
python-version: ["3.7", "3.8", "3.9", "3.10"]
exclude:
- platform: "windows-latest"
python-version: "3.7"
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

runs-on: "${{ matrix.platform }}"
timeout-minutes: 30
Expand Down Expand Up @@ -73,7 +70,6 @@ jobs:
runs-on: "${{ matrix.platform }}"
timeout-minutes: 30


steps:
- uses: "actions/checkout@v4"

Expand Down
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,10 @@ repos:
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]


- repo: https://github.com/asottile/pyupgrade
rev: v3.13.0
hooks:
- id: pyupgrade
args: ["--py38-plus"]
13 changes: 6 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ name = "uproot"
description = "ROOT I/O in pure Python and NumPy."
readme = "README.md"
license = "BSD-3-Clause"
requires-python = ">=3.7"
requires-python = ">=3.8"
authors = [
{ name = "Jim Pivarski", email = "[email protected]" },
]
Expand All @@ -25,11 +25,11 @@ classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"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",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Information Analysis",
"Topic :: Scientific/Engineering :: Mathematics",
Expand All @@ -39,7 +39,6 @@ classifiers = [
]
dependencies = [
"awkward>=2.0.0",
"importlib-metadata;python_version<\"3.8\"",
"numpy",
"packaging",
]
Expand All @@ -50,16 +49,16 @@ dynamic = [
[project.optional-dependencies]
dev = [
"boost_histogram>=0.13",
"dask-awkward>=2023.9.0;python_version >= \"3.8\"",
"dask[array];python_version >= \"3.8\"",
"dask-awkward>=2023.9.0",
"dask[array]",
"hist>=1.2",
"pandas",
"awkward-pandas;python_version >= \"3.8\"",
"awkward-pandas",
]
test = [
"lz4",
"minio",
"aiohttp",
"aiohttp; python_version<\"3.12\"",
"fsspec",
"fsspec-xrootd",
"pytest>=6",
Expand Down
7 changes: 1 addition & 6 deletions src/uproot/extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,11 @@


import atexit
import importlib.metadata as importlib_metadata
import os
import sys

from uproot._util import parse_version

if sys.version_info < (3, 8):
import importlib_metadata
else:
import importlib.metadata as importlib_metadata


def awkward():
"""
Expand Down
12 changes: 7 additions & 5 deletions src/uproot/interpretation/identify.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@


import ast
import numbers
import re

import numpy
Expand Down Expand Up @@ -164,15 +165,15 @@ def _float16_double32_walk_ast(node, branch, source):
and isinstance(node.ctx, ast.Load)
and node.id.lower() == "pi"
):
out = ast.Num(3.141592653589793) # TMath::Pi()
out = ast.Constant(3.141592653589793) # TMath::Pi()
elif (
isinstance(node, ast.Name)
and isinstance(node.ctx, ast.Load)
and node.id.lower() == "twopi"
):
out = ast.Num(6.283185307179586) # TMath::TwoPi()
elif isinstance(node, ast.Num):
out = ast.Num(float(node.n))
out = ast.Constant(6.283185307179586) # TMath::TwoPi()
elif isinstance(node, ast.Constant) and isinstance(node.value, numbers.Number):
out = ast.Constant(float(node.value))
elif isinstance(node, ast.BinOp) and isinstance(
node.op, (ast.Add, ast.Sub, ast.Mult, ast.Div)
):
Expand Down Expand Up @@ -201,7 +202,8 @@ def _float16_double32_walk_ast(node, branch, source):
isinstance(node, ast.List)
and isinstance(node.ctx, ast.Load)
and len(node.elts) == 3
and isinstance(node.elts[2], ast.Num)
and isinstance(node.elts[2], ast.Constant)
and isinstance(node.elts[2].value, numbers.Number)
):
out = ast.List(
[
Expand Down
11 changes: 8 additions & 3 deletions src/uproot/language/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ def _walk_ast_yield_symbols(node, keys, aliases, functions, getter):
and isinstance(node.func, ast.Name)
and node.func.id == getter
):
if len(node.args) == 1 and isinstance(node.args[0], ast.Str):
yield node.args[0].s
if (
len(node.args) == 1
and isinstance(node.args[0], ast.Constant)
and isinstance(node.args[0].value, str)
):
yield node.args[0].value
else:
raise TypeError(
f"expected a constant string as the only argument of {getter!r}; "
Expand Down Expand Up @@ -104,7 +108,8 @@ def _ast_as_branch_expression(node, keys, aliases, functions, getter):
and isinstance(node.func, ast.Name)
and node.func.id == getter
and len(node.args) == 1
and isinstance(node.args[0], ast.Str)
and isinstance(node.args[0], ast.Constant)
and isinstance(node.args[0].value, str)
):
return node

Expand Down
4 changes: 1 addition & 3 deletions src/uproot/source/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ def make_connection(parsed_url, timeout):
from http.client import HTTPConnection, HTTPSConnection

if parsed_url.scheme == "https":
return HTTPSConnection(
parsed_url.hostname, parsed_url.port, None, None, timeout
)
return HTTPSConnection(parsed_url.hostname, parsed_url.port, timeout=timeout)

elif parsed_url.scheme == "http":
return HTTPConnection(parsed_url.hostname, parsed_url.port, timeout)
Expand Down
2 changes: 1 addition & 1 deletion src/uproot/writing/_cascadetree.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ def extend(self, file, sink, data):
"how did this pass the type check?\n\n" + repr(content)
)

big_endian = numpy.asarray(content, dtype=datum["dtype"])
big_endian = numpy.asarray(content.data, dtype=datum["dtype"])
shape = tuple(shape) + big_endian.shape[1:]

if shape[1:] != datum["shape"]:
Expand Down
2 changes: 2 additions & 0 deletions tests/test_0692_fsspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

@pytest.mark.network
def test_open_fsspec_http():
pytest.importorskip("aiohttp")

with uproot.open(
"https://github.com/scikit-hep/scikit-hep-testdata/raw/v0.4.33/src/skhep_testdata/data/uproot-issue121.root",
http_handler=uproot.source.fsspec.FSSpecSource,
Expand Down
Loading