Skip to content

Commit

Permalink
Merge pull request #2615 from Kodiologist/version-bumps
Browse files Browse the repository at this point in the history
Adjust tested and supported Pythons
  • Loading branch information
Kodiologist authored Oct 13, 2024
2 parents 5ae5917 + 41c4ebe commit 5828ce0
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 25 deletions.
File renamed without changes.
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ jobs:
matrix:
name-prefix: ['']
os: [ubuntu-latest]
python: [3.8, 3.9, '3.10', 3.11, 3.12, 3.13-dev, pypy-3.10, pyodide]
python: [3.9, '3.10', 3.11, 3.12, 3.13, pypy-3.10, pyodide]
include:
# To keep the overall number of runs low, we test Windows and MacOS
# only on the latest CPython.
- name-prefix: 'win-'
os: windows-latest
python: 3.12
python: 3.13
- name-prefix: 'mac-'
os: macos-latest
python: 3.12
python: 3.13

name: ${{ matrix.name-prefix }}${{ matrix.python }}
runs-on: ${{ matrix.os }}
Expand Down
5 changes: 5 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
.. default-role:: code

Unreleased
======================================================================

Supports Python 3.9 – Python 3.x

1.0.0 ("Afternoon Review", released 2024-09-22)
======================================================================

Expand Down
12 changes: 5 additions & 7 deletions hy/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from pathlib import Path

import hy
from hy.compat import PY3_9
from hy.compiler import hy_compile, hy_eval
from hy.errors import HyLanguageError, filtered_hy_exceptions, hy_exc_handler
from hy.importer import runhy
Expand Down Expand Up @@ -270,11 +269,10 @@ def proc_opt(opt, arg=None, item=None, i=None):
set_path(filename)
# Ensure __file__ is set correctly in the code we're about
# to run.
if PY3_9:
if not filename.is_absolute():
filename = Path.cwd() / filename
if platform.system() == "Windows":
filename = os.path.normpath(filename)
if not filename.is_absolute():
filename = Path.cwd() / filename
if platform.system() == "Windows":
filename = os.path.normpath(filename)
if repl:
source = Path(filename).read_text()
repl.compile.compiler.skip_next_shebang = True
Expand Down Expand Up @@ -404,7 +402,7 @@ def _printing_gen(hst):
print()

if options.with_ast:
print(ast.dump(_ast, **(dict(indent=2) if PY3_9 else {})), file=output_file)
print(ast.dump(_ast, indent = 2), file=output_file)
print()
print()

Expand Down
10 changes: 0 additions & 10 deletions hy/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import platform
import sys

PY3_9 = sys.version_info >= (3, 9)
PY3_10 = sys.version_info >= (3, 10)
PY3_11 = sys.version_info >= (3, 11)
PY3_12 = sys.version_info >= (3, 12)
Expand All @@ -12,13 +11,6 @@
PYODIDE = platform.system() == "Emscripten"


if not PY3_9:
# Shim `ast.unparse`.
import astor.code_gen

ast.unparse = astor.code_gen.to_source


if "def" in ast.unparse(ast.parse("𝕕𝕖𝕗 = 1")):
# Overwrite `ast.unparse` to backport https://github.com/python/cpython/pull/31012
import copy
Expand Down Expand Up @@ -50,8 +42,6 @@ def rewriting_unparse(ast_obj):
if True:
import pydoc, inspect, re
true_getdoc = pydoc.getdoc
if not PY3_9:
pydoc._getdoc = inspect.getdoc
def getdoc(object):
"""A monkey-patched `pydoc.getdoc` that tries to avoid calling
`inspect.getcomments` for an object defined in Hy code, which would try
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# out without executing the file.
requires = [
"funcparserlib ~= 1.0",
'astor>=0.8 ; python_version < "3.9"',
]

import os
Expand Down Expand Up @@ -44,7 +43,7 @@ def run(self):
version='0.0.0',
setup_requires=["wheel"] + requires,
install_requires=requires,
python_requires=">= 3.8, < 3.14",
python_requires=">= 3.9, < 3.14",
entry_points={
"console_scripts": [
"hy = hy.cmdline:hy_main",
Expand Down
5 changes: 2 additions & 3 deletions tests/test_bin.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import pytest

from hy.compat import PY3_9, PYODIDE
from hy.compat import PYODIDE

if PYODIDE:
pytest.skip(
Expand Down Expand Up @@ -507,8 +507,7 @@ def test_uufileuu(tmp_path, monkeypatch):
(tmp_path / "realdir" / "hyex.hy").write_text('(print __file__)')
(tmp_path / "realdir" / "pyex.py").write_text('print(__file__)')

def file_is(arg, expected_py3_9):
expected = expected_py3_9 if PY3_9 else Path(arg)
def file_is(arg, expected):
output, _ = run_cmd(["python3", arg + "pyex.py"])
assert output.rstrip() == str(expected / "pyex.py")
output, _ = run_cmd(["hy", arg + "hyex.hy"])
Expand Down

0 comments on commit 5828ce0

Please sign in to comment.