Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-pyp for openSUSE:Factory checked in at 2024-12-29 11:56:47 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pyp (Old) and /work/SRC/openSUSE:Factory/.python-pyp.new.1881 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pyp" Sun Dec 29 11:56:47 2024 rev:5 rq:1233502 version:1.3.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pyp/python-pyp.changes 2024-12-09 21:13:58.014978889 +0100 +++ /work/SRC/openSUSE:Factory/.python-pyp.new.1881/python-pyp.changes 2024-12-29 11:57:02.821181211 +0100 @@ -1,0 +2,9 @@ +Fri Dec 27 09:01:06 UTC 2024 - Matej Cepl <mc...@cepl.eu> + +- Update to 1.3.0: + - Add support for Python 3.13 + - Turn missing config file into a warning instead of an error + - Add support for __pyp_before__ configuration for permanent + before code + +------------------------------------------------------------------- Old: ---- pyp-1.2.0.tar.gz New: ---- pyp-1.3.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pyp.spec ++++++ --- /var/tmp/diff_new_pack.84vrVP/_old 2024-12-29 11:57:03.285200239 +0100 +++ /var/tmp/diff_new_pack.84vrVP/_new 2024-12-29 11:57:03.285200239 +0100 @@ -19,7 +19,7 @@ %define skip_python2 1 Name: python-pyp -Version: 1.2.0 +Version: 1.3.0 Release: 0 Summary: Python at the shell License: MIT @@ -62,8 +62,6 @@ %python_expand %fdupes %{buildroot}%{$python_sitelib} %check -# gh#hauntsaninja/pyp#40 -skip_tests_python313="test_user_error or test_tracebacks" export PATH=$(pwd):$PATH %{python_expand ln -sf %{buildroot}%{_bindir}/pyp-%{$python_bin_suffix} pyp PYTHONPATH=%{buildroot}%{$python_sitelib} py.test-%{$python_bin_suffix} -vv "$( [ -n "${skip_tests_$python}" ] && printf "%s" '-k not ('"${skip_tests_$python}"')')" ++++++ pyp-1.2.0.tar.gz -> pyp-1.3.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyp-1.2.0/.github/workflows/tests.yml new/pyp-1.3.0/.github/workflows/tests.yml --- old/pyp-1.2.0/.github/workflows/tests.yml 2024-03-03 06:56:46.000000000 +0100 +++ new/pyp-1.3.0/.github/workflows/tests.yml 2024-12-27 03:11:26.000000000 +0100 @@ -31,6 +31,7 @@ - {python: '3.10', tox: py310} - {python: '3.11', tox: py311} - {python: '3.12', tox: py312} + - {python: '3.13', tox: py313} steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyp-1.2.0/CHANGELOG.md new/pyp-1.3.0/CHANGELOG.md --- old/pyp-1.2.0/CHANGELOG.md 2024-03-03 06:56:46.000000000 +0100 +++ new/pyp-1.3.0/CHANGELOG.md 2024-12-27 03:11:26.000000000 +0100 @@ -1,5 +1,10 @@ # Changelog +## [v1.3.0] +- Add support for Python 3.13 +- Turn missing config file into a warning instead of an error +- Add support for `__pyp_before__` configuration for permanent `before` code + ## [v1.2.0] - Fix submodule import name detection - Add `pypyp` as alternate command line entrypoint diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyp-1.2.0/pyp.py new/pyp-1.3.0/pyp.py --- old/pyp-1.2.0/pyp.py 2024-03-03 06:56:46.000000000 +0100 +++ new/pyp-1.3.0/pyp.py 2024-12-27 03:11:26.000000000 +0100 @@ -12,7 +12,7 @@ from typing import Any, Dict, Iterator, List, Optional, Set, Tuple, cast __all__ = ["pypprint"] -__version__ = "1.2.0" +__version__ = "1.3.0" def pypprint(*args, **kwargs): # type: ignore @@ -220,8 +220,9 @@ try: with open(config_file, "r") as f: return f.read() - except FileNotFoundError as e: - raise PypError(f"Config file not found at PYP_CONFIG_PATH={config_file}") from e + except FileNotFoundError: + print(f"warning: Config file not found at PYP_CONFIG_PATH={config_file}", file=sys.stderr) + return "" class PypConfig: @@ -312,8 +313,17 @@ raise PypError("".join(message).strip()) from e self.before_tree = parse_input(before) + if "__pyp_before__" in config.name_to_def: + config_before = config.parts[config.name_to_def["__pyp_before__"]] + if not isinstance(config_before, ast.FunctionDef): + raise PypError("Config __pyp_before__ must be a function") + self.before_tree.body = config_before.body + self.before_tree.body + self.tree = parse_input(code) + self.after_tree = parse_input(after) + if "__pyp_after__" in config.name_to_def: + raise PypError("Config __pyp_after__ not supported") f = NameFinder(self.before_tree, self.tree, self.after_tree) self.defined: Set[str] = f.top_level_defined @@ -582,8 +592,8 @@ for node in dfs_walk(ret): if isinstance(node, ast.stmt): i += 1 - node.lineno = i - node.end_lineno = i + node.lineno = i # type: ignore[attr-defined] + node.end_lineno = i # type: ignore[attr-defined] return ast.fix_missing_locations(ret) @@ -652,8 +662,13 @@ if fs.filename == "<pyp>": if fs.lineno is None: raise AssertionError("When would this happen?") - fs._line = code_for_line(fs.lineno) # type: ignore[attr-defined] - fs.lineno = "PYP_REDACTED" # type: ignore[assignment] + if sys.version_info >= (3, 13): + fs._lines = code_for_line(fs.lineno) # type: ignore[attr-defined] + fs.colno = None + fs.lineno = "PYP_REDACTED" # type: ignore[assignment] + else: + fs._line = code_for_line(fs.lineno) # type: ignore[attr-defined] + fs.lineno = "PYP_REDACTED" # type: ignore[assignment] tb_format = tb_except.format() assert "Traceback (most recent call last)" in next(tb_format) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyp-1.2.0/pyproject.toml new/pyp-1.3.0/pyproject.toml --- old/pyp-1.2.0/pyproject.toml 2024-03-03 06:56:46.000000000 +0100 +++ new/pyp-1.3.0/pyproject.toml 2024-12-27 03:11:26.000000000 +0100 @@ -1,6 +1,6 @@ [project] name = "pypyp" -version = "1.2.0" +version = "1.3.0" authors = [{name = "Shantanu Jain"}, {email = "hauntsani...@gmail.com"}] description = "Easily run Python at the shell! Magical, but never mysterious." readme = "README.md" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyp-1.2.0/tests/test_pyp.py new/pyp-1.3.0/tests/test_pyp.py --- old/pyp-1.2.0/tests/test_pyp.py 2024-03-03 06:56:46.000000000 +0100 +++ new/pyp-1.3.0/tests/test_pyp.py 2024-12-27 03:11:26.000000000 +0100 @@ -697,14 +697,39 @@ compare_scripts(run_pyp(["--explain", "unparse(ast.parse('x')); pass"]), script3) -def test_config_end_to_end(monkeypatch): +@patch("pyp.get_config_contents") +def test_config_pyp_before(config_mock): + config_mock.return_value = """ +import signal +import sys +def __pyp_before__(): + signal.signal(signal.SIGPIPE, signal.SIG_DFL) +""" + script = r"""#!/usr/bin/env python3 +import signal +import sys +signal.signal(signal.SIGPIPE, signal.SIG_DFL) +for x in sys.stdin: + x = x.rstrip('\n') + if x is not None: + print(x) +""" + compare_scripts(run_pyp(["--explain", "x"]), script) + + +def test_config_end_to_end(monkeypatch, capsys): with tempfile.NamedTemporaryFile("w") as f: - monkeypatch.setenv("PYP_CONFIG_PATH", f.name) config = "def foo(): return 1" f.write(config) f.flush() - assert run_pyp("foo()") == "1\n" + + monkeypatch.setenv("PYP_CONFIG_PATH", f.name) + with capsys.disabled(): + assert run_pyp("foo()") == "1\n" monkeypatch.setenv("PYP_CONFIG_PATH", f.name + "_does_not_exist") - with pytest.raises(pyp.PypError, match=f"Config file not found.*{f.name}"): + with pytest.raises(pyp.PypError, match="No module named 'foo'"): run_pyp("foo()") + + stderr = capsys.readouterr().err + assert f"warning: Config file not found at PYP_CONFIG_PATH={f.name}" in stderr diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyp-1.2.0/tox.ini new/pyp-1.3.0/tox.ini --- old/pyp-1.2.0/tox.ini 2024-03-03 06:56:46.000000000 +0100 +++ new/pyp-1.3.0/tox.ini 2024-12-27 03:11:26.000000000 +0100 @@ -1,6 +1,6 @@ [tox] skipsdist = True -envlist = py39, py311, lint, mypy +envlist = py39, py311, py313, lint, mypy [testenv] deps = pytest @@ -20,10 +20,10 @@ isort --diff --check --quiet . [testenv:mypy] -deps = mypy>=1.8 +deps = mypy>=1.13 commands = mypy --strict -m pyp --python-version 3.8 - mypy --strict -m pyp --python-version 3.12 + mypy --strict -m pyp --python-version 3.13 [coverage:report] exclude_lines =