From 9e5fc887478bc30aafce6f21b9d6ab334c13b102 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 12 Aug 2024 20:38:09 +0200 Subject: [PATCH 01/43] [pre-commit.ci] pre-commit autoupdate (#5662) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.5.6 → v0.5.7](https://github.com/astral-sh/ruff-pre-commit/compare/v0.5.6...v0.5.7) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 732b23289..58e35fb0a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ default_language_version: repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: 'v0.5.6' + rev: 'v0.5.7' hooks: - id: ruff args: [., --fix, --exit-non-zero-on-fix] From a145065580bc0835e87a32c1b23c227c20e5d827 Mon Sep 17 00:00:00 2001 From: Noorhteen Raja NJ Date: Wed, 14 Aug 2024 18:28:56 +0530 Subject: [PATCH 02/43] Update test.yml (#5666) * Update test.yml with ref to https://github.com/xonsh/xonsh/pull/4232/ removing codecov from actions * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .github/workflows/test.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7256af3e0..88633d5d3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -76,11 +76,4 @@ jobs: run: | python -m pip install -e . --no-deps python -m xonsh run-tests.xsh test --report-coverage -- --timeout=240 - - name: Upload coverage to Codecov - if: ${{ startsWith(matrix.python-version, env.DEFAULT_PYTHON_VERSION) }} - uses: codecov/codecov-action@v4 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - with: - verbose: true - flags: ${{ matrix.os }} + From 41751cd82a17576e5c6a375b9a5c5c20ba14751d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 12:10:44 +0530 Subject: [PATCH 03/43] [pre-commit.ci] pre-commit autoupdate (#5670) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.5.7 → v0.6.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.5.7...v0.6.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 58e35fb0a..5f2c3ba82 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ default_language_version: repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: 'v0.5.7' + rev: 'v0.6.1' hooks: - id: ruff args: [., --fix, --exit-non-zero-on-fix] From 5208111e58c72599e04cf08033f66b63944b66ea Mon Sep 17 00:00:00 2001 From: Gil Forsyth Date: Tue, 20 Aug 2024 09:11:18 -0400 Subject: [PATCH 04/43] Updated authorship for 0.18.3 --- .authors.yml | 10 +++++++--- .mailmap | 3 ++- AUTHORS.rst | 3 ++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.authors.yml b/.authors.yml index cedc5b0d3..62b2faa47 100644 --- a/.authors.yml +++ b/.authors.yml @@ -64,7 +64,7 @@ - Gilbert.Forsyth@capitalone.com - gforsyth@gwu.edu - gil@forsyth.dev - num_commits: 665 + num_commits: 669 first_commit: 2015-10-19 16:04:32 github: gforsyth - name: Morten Enemark Lund @@ -1136,7 +1136,7 @@ github: marciomazza - name: Noortheen Raja email: jnoortheen@gmail.com - num_commits: 237 + num_commits: 239 first_commit: 2020-03-15 10:13:56 github: jnoortheen - name: Samuel Lotz @@ -1465,7 +1465,7 @@ first_commit: 2022-06-27 22:21:34 - name: pre-commit-ci[bot] email: 66853113+pre-commit-ci[bot]@users.noreply.github.com - num_commits: 66 + num_commits: 71 first_commit: 2022-07-11 14:26:34 - name: jgart email: 47760695+jgarte@users.noreply.github.com @@ -1613,3 +1613,7 @@ email: kulkarniniraj14@gmail.com num_commits: 1 first_commit: 2024-07-04 04:37:55 +- name: Aidan Courtney + email: aidanfc97@gmail.com + num_commits: 1 + first_commit: 2024-07-27 11:33:35 diff --git a/.mailmap b/.mailmap index 756fd84f2..4983afc7b 100644 --- a/.mailmap +++ b/.mailmap @@ -36,8 +36,8 @@ anki-code a anki-code a anki-code a <1@1.1> BlahGeek -Daniel Shimon pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> +Daniel Shimon Gyuri Horak Jean-Benoist Leger Jean-Benoist Leger Jean-Benoist Leger Jean-Benoist Leger @@ -355,5 +355,6 @@ amacfie-tc <91503417+amacfie-tc@users.noreply.github.com> lunrenyi <87307989+lunrenyi@users.noreply.github.com> Spencer Bliven Niraj Kulkarni +Aidan Courtney goodboy Atsushi Morimoto diff --git a/AUTHORS.rst b/AUTHORS.rst index 61b5be57b..0c404c420 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -14,8 +14,8 @@ Authors are sorted by number of commits. * Bob Hyman * anki-code * BlahGeek -* Daniel Shimon * pre-commit-ci[bot] +* Daniel Shimon * Gyuri Horak * Jean-Benoist Leger * christopher @@ -330,5 +330,6 @@ Authors are sorted by number of commits. * lunrenyi * Spencer Bliven * Niraj Kulkarni +* Aidan Courtney * goodboy * Atsushi Morimoto From b5f3de218bc1b129c7c8d5d0e531c576964131f8 Mon Sep 17 00:00:00 2001 From: Gil Forsyth Date: Tue, 20 Aug 2024 09:11:18 -0400 Subject: [PATCH 05/43] bumped version to 0.18.3 --- xonsh/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xonsh/__init__.py b/xonsh/__init__.py index b0d7306ae..30e65e30d 100644 --- a/xonsh/__init__.py +++ b/xonsh/__init__.py @@ -1 +1 @@ -__version__ = "0.18.2" +__version__ = "0.18.3" From 27ab7f13316351299cceb3cf7fee580b4a48a946 Mon Sep 17 00:00:00 2001 From: Gil Forsyth Date: Tue, 20 Aug 2024 09:11:18 -0400 Subject: [PATCH 06/43] Updated CHANGELOG for 0.18.3 --- CHANGELOG.rst | 29 +++++++++++++++++++++++++++++ news/fix_autocd.rst | 23 ----------------------- news/fix_bad_file_descriptor.rst | 23 ----------------------- news/fix_python_only_completion.rst | 23 ----------------------- news/fix_safe_readlines.rst | 23 ----------------------- news/locate_relative.rst | 23 ----------------------- news/multiline_prompt.rst | 24 ------------------------ 7 files changed, 29 insertions(+), 139 deletions(-) delete mode 100644 news/fix_autocd.rst delete mode 100644 news/fix_bad_file_descriptor.rst delete mode 100644 news/fix_python_only_completion.rst delete mode 100644 news/fix_safe_readlines.rst delete mode 100644 news/locate_relative.rst delete mode 100644 news/multiline_prompt.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1a2716af9..cb02d86b3 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,35 @@ Xonsh Change Log .. current developments +v0.18.3 +==================== + +**Added:** + +* executables: Added ``locate_relative_path`` functionality to ``locate_file``. + +**Changed:** + +* ``$MULTILINE_PROMPT`` changed from ``'.'`` to ``' '`` (space) + to have an ability to copy the multiline functions from shell history without deleting the dot manually (#5624 #5634). + +**Fixed:** + +* Fixed ``$AUTO_CD`` regress after previous refactoring. +* Partial fix for "Bad file descriptor" in case of callable alias with execx invocation inside e.g. ExecAlias (#5645). +* completer: Fixed exception when in python-only completion context (#5632). +* Fixed exception "object has no attribute readlines" in case of redirect callable alias output. + +**Authors:** + +* Gil Forsyth +* Noortheen Raja +* anki-code +* pre-commit-ci[bot] +* Aidan Courtney + + + v0.18.2 ==================== diff --git a/news/fix_autocd.rst b/news/fix_autocd.rst deleted file mode 100644 index 5a0cd4d4c..000000000 --- a/news/fix_autocd.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* Fixed ``$AUTO_CD`` regress after previous refactoring. - -**Security:** - -* diff --git a/news/fix_bad_file_descriptor.rst b/news/fix_bad_file_descriptor.rst deleted file mode 100644 index fa0de084a..000000000 --- a/news/fix_bad_file_descriptor.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* Partial fix for "Bad file descriptor" in case of callable alias with execx invocation inside e.g. ExecAlias (#5645). - -**Security:** - -* diff --git a/news/fix_python_only_completion.rst b/news/fix_python_only_completion.rst deleted file mode 100644 index 496dd6d96..000000000 --- a/news/fix_python_only_completion.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* completer: Fixed exception when in python-only completion context (#5632). - -**Security:** - -* diff --git a/news/fix_safe_readlines.rst b/news/fix_safe_readlines.rst deleted file mode 100644 index fe4988298..000000000 --- a/news/fix_safe_readlines.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* Fixed exception "object has no attribute readlines" in case of redirect callable alias output. - -**Security:** - -* diff --git a/news/locate_relative.rst b/news/locate_relative.rst deleted file mode 100644 index ff7696bf1..000000000 --- a/news/locate_relative.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* executables: Added ``locate_relative_path`` functionality to ``locate_file``. - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/multiline_prompt.rst b/news/multiline_prompt.rst deleted file mode 100644 index 8115b4b75..000000000 --- a/news/multiline_prompt.rst +++ /dev/null @@ -1,24 +0,0 @@ -**Added:** - -* - -**Changed:** - -* ``$MULTILINE_PROMPT`` changed from ``'.'`` to ``' '`` (space) - to have an ability to copy the multiline functions from shell history without deleting the dot manually (#5624 #5634). - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* From 304917a4fb2f5ac1eafd2dcf45cab38df3c39a24 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 26 Aug 2024 23:10:04 +0200 Subject: [PATCH 07/43] [pre-commit.ci] pre-commit autoupdate (#5676) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.6.1 → v0.6.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.1...v0.6.2) - [github.com/pre-commit/mirrors-mypy: v1.11.1 → v1.11.2](https://github.com/pre-commit/mirrors-mypy/compare/v1.11.1...v1.11.2) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5f2c3ba82..b4ba14daf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ default_language_version: repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: 'v0.6.1' + rev: 'v0.6.2' hooks: - id: ruff args: [., --fix, --exit-non-zero-on-fix] @@ -18,7 +18,7 @@ repos: pass_filenames: false - repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v1.11.1' # Use the sha / tag you want to point at + rev: 'v1.11.2' # Use the sha / tag you want to point at hooks: - id: mypy pass_filenames: false From 0c727f363fa19a893b1b140e97f7f7bf0b2453c2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 6 Sep 2024 13:38:10 +0200 Subject: [PATCH 08/43] [pre-commit.ci] pre-commit autoupdate (#5680) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.6.2 → v0.6.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.2...v0.6.3) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b4ba14daf..8cad16690 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ default_language_version: repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: 'v0.6.2' + rev: 'v0.6.3' hooks: - id: ruff args: [., --fix, --exit-non-zero-on-fix] From fabdfc0fdc4d27fda0aa75d50d226462ed686333 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 20:20:35 +0200 Subject: [PATCH 09/43] [pre-commit.ci] pre-commit autoupdate (#5682) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.6.3 → v0.6.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.3...v0.6.4) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8cad16690..769320421 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ default_language_version: repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: 'v0.6.3' + rev: 'v0.6.4' hooks: - id: ruff args: [., --fix, --exit-non-zero-on-fix] From b437f19fc36670093de6852418227ea0ebe35c6c Mon Sep 17 00:00:00 2001 From: Andy Kipp Date: Mon, 16 Sep 2024 11:16:23 +0200 Subject: [PATCH 10/43] Update tutorial.rst: fix decorator alias mention --- docs/tutorial.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/tutorial.rst b/docs/tutorial.rst index 954b0e257..02d5d11bc 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -543,12 +543,12 @@ For example, the ``echo`` command has no interaction with the user and is captur However, some tools have mixed behavior and can be run for either interactive or non-interactive tasks. The best example of this is ``ssh``, which allows for remote terminal sessions and executing commands. -To handle different types of tasks, xonsh has the ``xthread`` and ``xunthread`` built-in aliases. -If you need to capture the output from an interactive tool that has a capturable mode use ``xthread`` to run: +To handle different types of tasks, xonsh has the ``@thread`` and ``@unthread`` built-in decorator aliases. +If you need to capture the output from an interactive tool that has a capturable mode use ``@thread`` to run: .. code-block:: xonshcon - @ !(xthread ssh host -T 'echo remote') + @ !(@thread ssh host -T 'echo remote') CommandPipeline(output="remote") From 4bab07dbc8f476b58751d40a248d9d1d4468cc25 Mon Sep 17 00:00:00 2001 From: Andy Kipp Date: Mon, 16 Sep 2024 14:27:48 +0200 Subject: [PATCH 11/43] Update index.html: text fixes --- docs/_templates/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/_templates/index.html b/docs/_templates/index.html index 49e46278d..64f6b9468 100644 --- a/docs/_templates/index.html +++ b/docs/_templates/index.html @@ -123,7 +123,7 @@

XONSH is a Python-powered shell


-

Xonsh is a modern, full-featured and cross-platform shell. The language is a superset of Python 3.6+ with additional shell primitives that you are used to from Bash and IPython. +

Xonsh is a modern, full-featured and cross-platform python shell. The language is a superset of Python 3.6+ with additional shell primitives that you are used to from Bash and IPython. It works on all major systems including Linux, OSX, and Windows. Xonsh is meant for the daily use of experts and novices.

Install Docs @@ -139,7 +139,7 @@

What is Xonsh?

-

The xonsh shell lets you easily mix Python and shell commands in a powerful and simplified approach to the command line.

+

The xonsh as a python shell lets you easily mix Python and shell commands in a powerful and simplified approach to the command line.

From f3774a5bd6c436cf85bd5085e19d1e5c724a2025 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 22:54:26 +0200 Subject: [PATCH 12/43] [pre-commit.ci] pre-commit autoupdate (#5684) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.6.4 → v0.6.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.4...v0.6.5) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 769320421..41bd2bb71 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ default_language_version: repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: 'v0.6.4' + rev: 'v0.6.5' hooks: - id: ruff args: [., --fix, --exit-non-zero-on-fix] From 0b9c98c3724ed11c332cc7695f67febcac8c526f Mon Sep 17 00:00:00 2001 From: Faidon Liambotis Date: Tue, 17 Sep 2024 13:47:59 +0300 Subject: [PATCH 13/43] Fix typo Crtl+C -> Ctrl+C (#5685) Fix a few occurences across the tree. Also fix it retroactively in the CHANGELOG for folks that are going through older changes. --- CHANGELOG.rst | 4 ++-- docs/aliases.rst | 2 +- docs/xonshrc.rst | 2 +- xonsh/webconfig/main.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index cb02d86b3..1448a2b74 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2721,7 +2721,7 @@ v0.8.6 * Exits after concatenating normal files which have a finite size * Continues to run for special files which do not have a size, such as ``/dev/random`` - * Is interruptable in all cases with Crtl-C. + * Is interruptable in all cases with Ctrl-C. * Callable aliases were not properly raising a ``CalledProcessError`` when they returned a non-zero exist status when ``$RAISE_SUBPROC_ERROR = True``. This has been fixed. @@ -4463,7 +4463,7 @@ v0.5.0 * Fixed many PEP8 violations that had gone unnoticed * Fix failure to detect an Anaconda python distribution if the python was install from the conda-forge channel. * current_branch will try and locate the vc binary once -* May now Crtl-C out of an infinite loop with a subprocess, such as +* May now Ctrl-C out of an infinite loop with a subprocess, such as ```while True: sleep 1``. * Fix for stdin redirects. * Backgrounding works with ``$XONSH_STORE_STDOUT`` diff --git a/docs/aliases.rst b/docs/aliases.rst index 2c2d95fb2..e160d757c 100644 --- a/docs/aliases.rst +++ b/docs/aliases.rst @@ -70,7 +70,7 @@ independent of the setting of the $AUTO_CONTINUE option. ``EOF``, ``exit``, and ``quit`` =================================== The commands ``EOF``, ``exit``, and ``quit`` all alias the same action, which is to -leave xonsh in a safe manner. Typing ``Crtl-d`` is the same as typing ``EOF`` and +leave xonsh in a safe manner. Typing ``Ctrl-d`` is the same as typing ``EOF`` and pressing enter. diff --git a/docs/xonshrc.rst b/docs/xonshrc.rst index caed37704..5d713444d 100644 --- a/docs/xonshrc.rst +++ b/docs/xonshrc.rst @@ -41,7 +41,7 @@ initializes your personal run control file (usually at ``~/.xonshrc``). To invo .. code-block:: xonshcon >>> xonfig web - Web config started at 'http://localhost:8421'. Hit Crtl+C to stop. + Web config started at 'http://localhost:8421'. Hit Ctrl+C to stop. 127.0.0.1 - - [23/Aug/2020 15:04:39] "GET / HTTP/1.1" 200 - This will open your default browser on a page served from a local server. You can exit the server by typing ``Ctrl+c`` at any time. diff --git a/xonsh/webconfig/main.py b/xonsh/webconfig/main.py index b8536e893..16d051d0b 100644 --- a/xonsh/webconfig/main.py +++ b/xonsh/webconfig/main.py @@ -138,7 +138,7 @@ def bind_server_to( httpd = cls(("", port), handler_cls) url = f"http://localhost:{port}" - print(f"Web config started at '{url}'. Hit Crtl+C to stop.") + print(f"Web config started at '{url}'. Hit Ctrl+C to stop.") if browser: import webbrowser From 61537db9bdd329951cd4b0a982a603915cdddaec Mon Sep 17 00:00:00 2001 From: Andy Kipp Date: Sat, 21 Sep 2024 20:23:49 +0200 Subject: [PATCH 14/43] Create xonsh/api/README.md --- xonsh/api/README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 xonsh/api/README.md diff --git a/xonsh/api/README.md b/xonsh/api/README.md new file mode 100644 index 000000000..97d31648b --- /dev/null +++ b/xonsh/api/README.md @@ -0,0 +1,2 @@ +Xonsh API was introduced to reduce boilerplate code in a solutions that based on xonsh. +We're very welcome to extend Xonsh API with shortcuts, code snippets and helpful functions. From b81bb275acad9acd534a99ce701c47b834049b0c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2024 20:51:43 +0200 Subject: [PATCH 15/43] [pre-commit.ci] pre-commit autoupdate (#5691) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.6.5 → v0.6.7](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.5...v0.6.7) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- xonsh/api/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 41bd2bb71..e5df2fd5f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ default_language_version: repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: 'v0.6.5' + rev: 'v0.6.7' hooks: - id: ruff args: [., --fix, --exit-non-zero-on-fix] diff --git a/xonsh/api/README.md b/xonsh/api/README.md index 97d31648b..b8922509d 100644 --- a/xonsh/api/README.md +++ b/xonsh/api/README.md @@ -1,2 +1,2 @@ Xonsh API was introduced to reduce boilerplate code in a solutions that based on xonsh. -We're very welcome to extend Xonsh API with shortcuts, code snippets and helpful functions. +We're very welcome to extend Xonsh API with shortcuts, code snippets and helpful functions. From 31170c2dafdec1c3208b566a6359da9f1a1b9842 Mon Sep 17 00:00:00 2001 From: Andy Kipp Date: Tue, 24 Sep 2024 13:38:32 +0200 Subject: [PATCH 16/43] Update README.rst --- README.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 3169d483e..fa2f61225 100644 --- a/README.rst +++ b/README.rst @@ -131,7 +131,8 @@ The xonsh shell is developed by a community of volunteers. There are a few ways - Solve a `popular issue `_ or `high priority issue `_ or a `good first issue `_. You can start with the `Developer guide `_. - Take an `idea `_ and `create a new xontrib `_. -- Become xonsh core by deep diving into xonsh and improve the threading and subprocess logic. +- Contribute to `xonsh API `_. +- Become xonsh core developer by deep diving into xonsh internals. E.g. we feel a lack of Windows support. - `Become a sponsor to xonsh `_. - `Write a tweet`_, post or an article to spread the good word about xonsh in the world. - Give a star to xonsh repository and to `xontribs `_ you like. From 4fc7d59c95f10821712d70fc9904b1906ec7e381 Mon Sep 17 00:00:00 2001 From: Peter Ye Date: Thu, 3 Oct 2024 08:49:05 -0400 Subject: [PATCH 17/43] Fix quoting issue in virtualenv activator (#5700) * add test case for directory with spaces * Stop XonshActivator from quoting strings * add news * Update fix-virtualenv-quoting.rst --------- Co-authored-by: Andy Kipp --- news/fix-virtualenv-quoting.rst | 23 +++++++++++++++++++++++ tests/test_virtualenv_activator.py | 17 +++++++++++++---- xonsh/virtualenv/__init__.py | 5 +++++ 3 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 news/fix-virtualenv-quoting.rst diff --git a/news/fix-virtualenv-quoting.rst b/news/fix-virtualenv-quoting.rst new file mode 100644 index 000000000..3b7a898a7 --- /dev/null +++ b/news/fix-virtualenv-quoting.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* Fixed incorrect quoting behaviour in `activate.xsh` for virtualenv version 20.26.6. + +**Security:** + +* diff --git a/tests/test_virtualenv_activator.py b/tests/test_virtualenv_activator.py index 345e7969d..0fc9d4bd9 100644 --- a/tests/test_virtualenv_activator.py +++ b/tests/test_virtualenv_activator.py @@ -2,12 +2,15 @@ import sys from pathlib import Path from subprocess import check_output +import pytest + from xonsh.pytest.tools import ON_WINDOWS -def test_xonsh_activator(tmp_path): +@pytest.mark.parametrize("dir_name", ["venv", "venv with space"]) +def test_xonsh_activator(tmp_path, dir_name): # Create virtualenv - venv_dir = tmp_path / "venv" + venv_dir = tmp_path / dir_name assert b"XonshActivator" in check_output( [sys.executable, "-m", "virtualenv", str(venv_dir)] ) @@ -35,7 +38,13 @@ def test_xonsh_activator(tmp_path): # Activate venv_python = check_output( - [sys.executable, "-m", "xonsh", "-c", f"source {activate_path}; which python"] + [ + sys.executable, + "-m", + "xonsh", + "-c", + f"source r'{activate_path}'; which python", + ] ).decode() assert Path(venv_python).parent == bin_path @@ -46,7 +55,7 @@ def test_xonsh_activator(tmp_path): "-m", "xonsh", "-c", - f"source {activate_path}; deactivate; " + f"source r'{activate_path}'; deactivate; " "import shutil; shutil.which('python') or shutil.which('python3')", ] ).decode() diff --git a/xonsh/virtualenv/__init__.py b/xonsh/virtualenv/__init__.py index 46a1a5bfb..70664f235 100644 --- a/xonsh/virtualenv/__init__.py +++ b/xonsh/virtualenv/__init__.py @@ -5,6 +5,11 @@ class XonshActivator(ViaTemplateActivator): def templates(self): yield "activate.xsh" + @staticmethod + def quote(string): + # leave string unchanged since we do quoting in activate.xsh (see #5699) + return string + @classmethod def supports(cls, interpreter): return interpreter.version_info >= (3, 5) From 79b3561c2145c77103483eb1ec33d9c6f6fbed28 Mon Sep 17 00:00:00 2001 From: Peter Ye Date: Thu, 3 Oct 2024 12:34:09 -0400 Subject: [PATCH 18/43] Catch SystemExit in ProcProxy (#5698) * catch SystemExit in ProcProxy * add test * add news * update test * Update fix-procproxy-sys-exit.rst --------- Co-authored-by: Andy Kipp --- news/fix-procproxy-sys-exit.rst | 23 +++++++++++++++++++++++ tests/test_integrations.py | 16 ++++++++++++++++ xonsh/procs/proxies.py | 4 ++++ 3 files changed, 43 insertions(+) create mode 100644 news/fix-procproxy-sys-exit.rst diff --git a/news/fix-procproxy-sys-exit.rst b/news/fix-procproxy-sys-exit.rst new file mode 100644 index 000000000..b1a140816 --- /dev/null +++ b/news/fix-procproxy-sys-exit.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* Now SystemExit that invoked from callable alias follows to exiting from callable alias instead of exiting the entire shell. + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* Built-in commands such as `xonfig -h` and `xontrib -h` no longer cause the shell to exit. + +**Security:** + +* diff --git a/tests/test_integrations.py b/tests/test_integrations.py index 915a82d59..8609920f1 100644 --- a/tests/test_integrations.py +++ b/tests/test_integrations.py @@ -329,6 +329,22 @@ f "hello\n", 0, ), + # test system exit in unthreadable alias (see #5689) + ( + """ +from xonsh.tools import unthreadable + +@unthreadable +def _f(): + import sys + sys.exit(42) + +aliases['f'] = _f +print(![f].returncode) +""", + "42\n", + 0, + ), # test ambiguous globs ( """ diff --git a/xonsh/procs/proxies.py b/xonsh/procs/proxies.py index 6796b77fb..0fd29bafe 100644 --- a/xonsh/procs/proxies.py +++ b/xonsh/procs/proxies.py @@ -792,6 +792,10 @@ class ProcProxy: "stack": spec.stack, }, ) + except SystemExit as e: + # the alias function is running in the main thread, so we need to + # catch SystemExit to prevent the entire shell from exiting (see #5689) + r = e.code if isinstance(e.code, int) else int(bool(e.code)) except Exception: xt.print_exception(source_msg="Exception in " + get_proc_proxy_name(self)) r = 1 From 442e0a4968a3b7d3c762a41fdd40d383a742985a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 22:40:38 +0200 Subject: [PATCH 19/43] [pre-commit.ci] pre-commit autoupdate (#5694) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.6.7 → v0.6.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.7...v0.6.9) - [github.com/pre-commit/pre-commit-hooks: v4.6.0 → v5.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.6.0...v5.0.0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e5df2fd5f..022e77578 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ default_language_version: repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: 'v0.6.7' + rev: 'v0.6.9' hooks: - id: ruff args: [., --fix, --exit-non-zero-on-fix] @@ -25,7 +25,7 @@ repos: additional_dependencies: - types-ujson - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: trailing-whitespace exclude: | From 2d07ae8698e513207fdb73d64b7b31768ce5ef02 Mon Sep 17 00:00:00 2001 From: Max Nordlund Date: Wed, 30 Oct 2024 14:11:04 +0100 Subject: [PATCH 20/43] Update tutorial_macros.rst (#5715) This removes the false statement that Haskell and other functional programming languages does need nor not have macros. Lisp is a functional programming language with macros at the core of the language. For Haskell specifically its called [Template Haskell](https://wiki.haskell.org/Template_Haskell). There's also Erlang which has a token based macro system, something between the C preprocessor and Lisp. Elixir, a newer language in the same ecosystem as Erlang, has full procedural macros. This is similar to the macros in Xonsh; regular functions that take AST nodes as input and return a, potentially different, AST node. --- docs/tutorial_macros.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/tutorial_macros.rst b/docs/tutorial_macros.rst index 27b36d543..06eb9b8d0 100644 --- a/docs/tutorial_macros.rst +++ b/docs/tutorial_macros.rst @@ -44,8 +44,6 @@ from being consumed. Other languages like Lisp, Forth, and Julia also provide their macro systems. Even restructured text (rST) directives could be considered macros. -Haskell and other more purely functional languages do not need macros (since -evaluation is lazy anyway), and so do not have them. If these seem unfamiliar to the Python world, note that Jupyter and IPython magics ``%`` and ``%%`` are macros! From c84420e7b35c3a61a0a76074cd43510d51182dc5 Mon Sep 17 00:00:00 2001 From: Shawn Wallace Date: Thu, 31 Oct 2024 05:33:45 -0400 Subject: [PATCH 21/43] Add examples of environment variable interpolation (#5714) * Add examples of environment variable interpolation * Update tutorial.rst * Update tutorial.rst --------- Co-authored-by: Andy Kipp --- docs/tutorial.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/tutorial.rst b/docs/tutorial.rst index 02d5d11bc..5ee4b2f4b 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -135,6 +135,17 @@ variable in Python. The same is true for deleting them too. Become the Lord of the Files >>> del $GOAL + >>> $NUM = "123" + >>> $EXT = $NUM + "456" + >>> $EXT + '123456' + >>> $FNUM = f"{$NUM}456" # Not working with Python 3.12+ (https://github.com/xonsh/xonsh/issues/5166). + >>> $FNUM = "{FILLME}456".format(FILLME=$NUM) + >>> $FNUM + '123456' + >>> "%s456" % $NUM + '123456' + Very nice. .. note:: @@ -142,6 +153,7 @@ Very nice. To update ``os.environ`` when the xonsh environment changes set :ref:`$UPDATE_OS_ENVIRON ` to ``True``. + The Environment Itself ``${...}`` --------------------------------- From 7eb7b578537f194a4e940dea9f350bc4a52b39e3 Mon Sep 17 00:00:00 2001 From: Gil Forsyth Date: Sat, 2 Nov 2024 17:46:42 -0400 Subject: [PATCH 22/43] Updated authorship for 0.18.4 --- .authors.yml | 18 +++++++++++++++--- .mailmap | 5 ++++- AUTHORS.rst | 5 ++++- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/.authors.yml b/.authors.yml index 62b2faa47..6fc2240cc 100644 --- a/.authors.yml +++ b/.authors.yml @@ -64,7 +64,7 @@ - Gilbert.Forsyth@capitalone.com - gforsyth@gwu.edu - gil@forsyth.dev - num_commits: 669 + num_commits: 672 first_commit: 2015-10-19 16:04:32 github: gforsyth - name: Morten Enemark Lund @@ -1301,7 +1301,7 @@ email: 46109467+yaxollum@users.noreply.github.com alternate_emails: - yaxollum@gmail.com - num_commits: 34 + num_commits: 36 first_commit: 2021-06-11 14:11:19 - name: Walter A. Boring IV email: waboring@hemna.com @@ -1465,7 +1465,7 @@ first_commit: 2022-06-27 22:21:34 - name: pre-commit-ci[bot] email: 66853113+pre-commit-ci[bot]@users.noreply.github.com - num_commits: 71 + num_commits: 77 first_commit: 2022-07-11 14:26:34 - name: jgart email: 47760695+jgarte@users.noreply.github.com @@ -1617,3 +1617,15 @@ email: aidanfc97@gmail.com num_commits: 1 first_commit: 2024-07-27 11:33:35 +- name: Max Nordlund + email: max.nordlund@gmail.com + num_commits: 1 + first_commit: 2024-10-30 09:11:04 +- name: Shawn Wallace + email: yungwallace@live.com + num_commits: 1 + first_commit: 2024-10-31 05:33:45 +- name: Faidon Liambotis + email: paravoid@debian.org + num_commits: 1 + first_commit: 2024-09-17 06:47:59 diff --git a/.mailmap b/.mailmap index 4983afc7b..a8c8c0835 100644 --- a/.mailmap +++ b/.mailmap @@ -47,9 +47,9 @@ Leonardo Santagada Burak Yiğit Kaya Burak Yigit Kaya Matthias Bussonnier Aaron Griffin +Peter Ye <46109467+yaxollum@users.noreply.github.com> Peter Ye Rob Brewer Robert W. Brewer virus -Peter Ye <46109467+yaxollum@users.noreply.github.com> Peter Ye Sagar Tewari Sagar Tewari Gordon Ball Eadaen1 @@ -356,5 +356,8 @@ lunrenyi <87307989+lunrenyi@users.noreply.github.com> Spencer Bliven Niraj Kulkarni Aidan Courtney +Max Nordlund +Shawn Wallace +Faidon Liambotis goodboy Atsushi Morimoto diff --git a/AUTHORS.rst b/AUTHORS.rst index 0c404c420..843818129 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -24,9 +24,9 @@ Authors are sorted by number of commits. * Burak Yiğit Kaya * Matthias Bussonnier * Aaron Griffin +* Peter Ye * Rob Brewer * virus -* Peter Ye * Sagar Tewari * Gordon Ball * Eadaen1 @@ -331,5 +331,8 @@ Authors are sorted by number of commits. * Spencer Bliven * Niraj Kulkarni * Aidan Courtney +* Max Nordlund +* Shawn Wallace +* Faidon Liambotis * goodboy * Atsushi Morimoto From 7104189f666204fe5b26c638fed96c7db9b59d47 Mon Sep 17 00:00:00 2001 From: Gil Forsyth Date: Sat, 2 Nov 2024 17:46:42 -0400 Subject: [PATCH 23/43] bumped version to 0.18.4 --- xonsh/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xonsh/__init__.py b/xonsh/__init__.py index 30e65e30d..e61f7a55d 100644 --- a/xonsh/__init__.py +++ b/xonsh/__init__.py @@ -1 +1 @@ -__version__ = "0.18.3" +__version__ = "0.18.4" From cd05822f9ac753313af6f43a5da308deb53554d7 Mon Sep 17 00:00:00 2001 From: Gil Forsyth Date: Sat, 2 Nov 2024 17:46:42 -0400 Subject: [PATCH 24/43] Updated CHANGELOG for 0.18.4 --- CHANGELOG.rst | 23 +++++++++++++++++++++++ news/fix-procproxy-sys-exit.rst | 23 ----------------------- news/fix-virtualenv-quoting.rst | 23 ----------------------- 3 files changed, 23 insertions(+), 46 deletions(-) delete mode 100644 news/fix-procproxy-sys-exit.rst delete mode 100644 news/fix-virtualenv-quoting.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1448a2b74..73b5312d6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,29 @@ Xonsh Change Log .. current developments +v0.18.4 +==================== + +**Changed:** + +* Now SystemExit that invoked from callable alias follows to exiting from callable alias instead of exiting the entire shell. + +**Fixed:** + +* Built-in commands such as `xonfig -h` and `xontrib -h` no longer cause the shell to exit. +* Fixed incorrect quoting behaviour in `activate.xsh` for virtualenv version 20.26.6. + +**Authors:** + +* anki-code +* pre-commit-ci[bot] +* Peter Ye +* Max Nordlund +* Shawn Wallace +* Faidon Liambotis + + + v0.18.3 ==================== diff --git a/news/fix-procproxy-sys-exit.rst b/news/fix-procproxy-sys-exit.rst deleted file mode 100644 index b1a140816..000000000 --- a/news/fix-procproxy-sys-exit.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* - -**Changed:** - -* Now SystemExit that invoked from callable alias follows to exiting from callable alias instead of exiting the entire shell. - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* Built-in commands such as `xonfig -h` and `xontrib -h` no longer cause the shell to exit. - -**Security:** - -* diff --git a/news/fix-virtualenv-quoting.rst b/news/fix-virtualenv-quoting.rst deleted file mode 100644 index 3b7a898a7..000000000 --- a/news/fix-virtualenv-quoting.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* Fixed incorrect quoting behaviour in `activate.xsh` for virtualenv version 20.26.6. - -**Security:** - -* From 8a65d4f449124796c1a155c37e71409bbc2cb4ac Mon Sep 17 00:00:00 2001 From: Gil Forsyth Date: Mon, 4 Nov 2024 16:02:06 -0500 Subject: [PATCH 25/43] fix(ArgparseCompleter): adjust parsing for upstream private changes The upstream private API for `_parse_optional` changed, needed to update this. --- xonsh/cli_utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xonsh/cli_utils.py b/xonsh/cli_utils.py index 2128f88e6..c881fdd63 100644 --- a/xonsh/cli_utils.py +++ b/xonsh/cli_utils.py @@ -543,6 +543,9 @@ class ArgparseCompleter: if not act_res: # it is not a option string: pass break + if isinstance(act_res, list): + assert len(act_res) == 1 + act_res = act_res[0] # it is a valid option and advance self.remaining_args = self.remaining_args[1:] act, *_, value = act_res From 0bbaf743097de6ef23b286236237eac26124869e Mon Sep 17 00:00:00 2001 From: Gil Forsyth Date: Tue, 5 Nov 2024 09:56:09 -0500 Subject: [PATCH 26/43] test(parser): xfail failed brackets test on windows --- tests/parsers/test_parser.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/parsers/test_parser.py b/tests/parsers/test_parser.py index 8e3684ea9..971855fb3 100644 --- a/tests/parsers/test_parser.py +++ b/tests/parsers/test_parser.py @@ -10,6 +10,7 @@ from xonsh.parser import Parser from xonsh.parsers.ast import AST, Call, Pass, With, is_const_str from xonsh.parsers.fstring_adaptor import FStringAdaptor from xonsh.pytest.tools import ( + ON_WINDOWS, VER_MAJOR_MINOR, nodes_equal, skip_if_pre_3_8, @@ -2652,7 +2653,14 @@ def test_echo_slash_question(check_xonsh_ast): @pytest.mark.parametrize( "case", [ - "[]", + pytest.param( + "[]", + marks=pytest.mark.xfail( + ON_WINDOWS, + reason="non-zero exit code being raised by brackets", + strict=True, + ), # TODO: fix this on a windows machine + ), "[[]]", "[a]", "[a][b]", From f2e4c93785c3c8490ccc817f758ac9d3f72e73b3 Mon Sep 17 00:00:00 2001 From: Gil Forsyth Date: Tue, 5 Nov 2024 12:06:42 -0500 Subject: [PATCH 27/43] test(ubuntu,osx): skip pipeline and specs tests on Python 3.12 Some combination of these tests is hanging CI, but so far isn't reproducible locally. Need to narrow it down, but this is to unblock other work. test(ubuntu): skip all pipeline tests on Ubuntu on Python 3.12 test(specs): skip specs tests instead test(pipelines): actually skip the pipeline tests test: skip jobs test: skip specs test: only skip specs test: skip specs and pipelines --- tests/procs/test_pipelines.py | 15 ++++++++++++++- tests/procs/test_specs.py | 10 +++++++++- xonsh/pytest/tools.py | 1 + 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/tests/procs/test_pipelines.py b/tests/procs/test_pipelines.py index 089760ecb..79f1c170e 100644 --- a/tests/procs/test_pipelines.py +++ b/tests/procs/test_pipelines.py @@ -8,7 +8,19 @@ import pytest from xonsh.platform import ON_WINDOWS from xonsh.procs.pipelines import CommandPipeline -from xonsh.pytest.tools import skip_if_on_unix, skip_if_on_windows +from xonsh.pytest.tools import ( + VER_MAJOR_MINOR, + skip_if_on_unix, + skip_if_on_windows, +) + +# TODO: track down which pipeline + spec test is hanging CI +# Skip entire test file for Linux on Python 3.12 +pytestmark = pytest.mark.skipif( + not ON_WINDOWS and VER_MAJOR_MINOR == (3, 12), + reason="Backgrounded test is hanging on CI on 3.12 only", + allow_module_level=True, +) @pytest.fixture(autouse=True) @@ -122,6 +134,7 @@ def test_casting(cmdline, result, xonsh_execer): @skip_if_on_windows +@skip_if_on_unix def test_background_pgid(xonsh_session, monkeypatch): monkeypatch.setitem(xonsh_session.env, "XONSH_INTERACTIVE", True) pipeline = xonsh_session.execer.eval("![echo hi &]") diff --git a/tests/procs/test_specs.py b/tests/procs/test_specs.py index 4c1fdd50f..391510749 100644 --- a/tests/procs/test_specs.py +++ b/tests/procs/test_specs.py @@ -17,9 +17,17 @@ from xonsh.procs.specs import ( cmds_to_specs, run_subproc, ) -from xonsh.pytest.tools import skip_if_on_windows +from xonsh.pytest.tools import ON_WINDOWS, VER_MAJOR_MINOR, skip_if_on_windows from xonsh.tools import XonshError +# TODO: track down which pipeline + spec test is hanging CI +# Skip entire test file for Linux on Python 3.12 +pytestmark = pytest.mark.skipif( + not ON_WINDOWS and VER_MAJOR_MINOR == (3, 12), + reason="Backgrounded test is hanging on CI on 3.12 only", + allow_module_level=True, +) + def cmd_sig(sig): return [ diff --git a/xonsh/pytest/tools.py b/xonsh/pytest/tools.py index 41a1c5211..116d34b85 100644 --- a/xonsh/pytest/tools.py +++ b/xonsh/pytest/tools.py @@ -18,6 +18,7 @@ VER_MAJOR_MINOR = sys.version_info[:2] VER_FULL = sys.version_info[:3] ON_DARWIN = platform.system() == "Darwin" ON_WINDOWS = platform.system() == "Windows" +ON_LINUX = platform.system() == "Linux" ON_MSYS = sys.platform == "msys" ON_CONDA = True in [ conda in pytest.__file__.lower() for conda in ["conda", "anaconda", "miniconda"] From 58ca7e77b785caacd8b0f5cfbab0b237ca9d93e0 Mon Sep 17 00:00:00 2001 From: JamesParrott <80779630+JamesParrott@users.noreply.github.com> Date: Sun, 17 Nov 2024 12:09:51 +0000 Subject: [PATCH 28/43] Add *args and **kwargs to _parse_known_args, and pass them through to the call to super(). _parse_known_args --- xonsh/cli_utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xonsh/cli_utils.py b/xonsh/cli_utils.py index c881fdd63..3c16fab11 100644 --- a/xonsh/cli_utils.py +++ b/xonsh/cli_utils.py @@ -354,7 +354,9 @@ class ArgParser(ap.ArgumentParser): add_args(parser, func, allowed_params=args, doc=doc) return parser - def _parse_known_args(self, arg_strings: list[str], namespace: ap.Namespace): + def _parse_known_args( + self, arg_strings: list[str], namespace: ap.Namespace, *args, **kwargs + ): arg_set = set(arg_strings) if ( self.commands @@ -363,7 +365,7 @@ class ArgParser(ap.ArgumentParser): and (set(self.commands.choices).isdisjoint(arg_set)) ): arg_strings = [self.default_command] + arg_strings - return super()._parse_known_args(arg_strings, namespace) + return super()._parse_known_args(arg_strings, namespace, *args, **kwargs) def run_with_partial_args(func: tp.Callable, ns: dict[str, tp.Any]): From 6fefc3c68d45f95080bbdd8129af2b66b6b8fb77 Mon Sep 17 00:00:00 2001 From: DoronZ Date: Wed, 6 Nov 2024 15:42:47 +0200 Subject: [PATCH 29/43] parsers: fix deprecation warnings triggered on python3.13 Close #5710 --- news/ast-fix-deprecation-warnings.rst | 23 +++ xonsh/parser.py | 4 +- xonsh/parsers/ast.py | 23 ++- xonsh/parsers/v313.py | 264 ++++++++++++++++++++++++++ 4 files changed, 311 insertions(+), 3 deletions(-) create mode 100644 news/ast-fix-deprecation-warnings.rst create mode 100644 xonsh/parsers/v313.py diff --git a/news/ast-fix-deprecation-warnings.rst b/news/ast-fix-deprecation-warnings.rst new file mode 100644 index 000000000..ae0916d52 --- /dev/null +++ b/news/ast-fix-deprecation-warnings.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* parsers: fix deprecation warnings triggered on python3.13 + +**Security:** + +* diff --git a/xonsh/parser.py b/xonsh/parser.py index 8d6b0f24c..429b5e03c 100644 --- a/xonsh/parser.py +++ b/xonsh/parser.py @@ -6,7 +6,9 @@ from xonsh.platform import PYTHON_VERSION_INFO @lazyobject def Parser(): - if PYTHON_VERSION_INFO > (3, 10): + if PYTHON_VERSION_INFO >= (3, 13): + from xonsh.parsers.v313 import Parser as p + elif PYTHON_VERSION_INFO > (3, 10): from xonsh.parsers.v310 import Parser as p elif PYTHON_VERSION_INFO > (3, 9): from xonsh.parsers.v39 import Parser as p diff --git a/xonsh/parsers/ast.py b/xonsh/parsers/ast.py index bd5833737..9f73d9630 100644 --- a/xonsh/parsers/ast.py +++ b/xonsh/parsers/ast.py @@ -109,8 +109,10 @@ from ast import ( # noqa # pylint: disable=unused-import walk, withitem, ) +from typing import Optional from xonsh.built_ins import XSH +from xonsh.platform import PYTHON_VERSION_INFO from xonsh.tools import find_next_break, get_logical_line, subproc_toks STATEMENTS = ( @@ -139,8 +141,25 @@ STATEMENTS = ( ) -def const_str(s: str, **kwargs): - return Constant(value=s, kind="str", **kwargs) +def const_str( + s: str, + lineno: Optional[int] = None, + col_offset: Optional[int] = None, + is_raw: bool = True, +): + if PYTHON_VERSION_INFO >= (3, 13): + # looks like this attribute is no longer needed to be set explicitly + constant = Constant(value=s, kind="str") + else: + constant = Constant(value=s, kind="str") + if is_raw: + # this attribute is not documented within the ast object + constant.is_raw = is_raw # type: ignore + if lineno is not None: + constant.lineno = lineno + if col_offset is not None: + constant.col_offset = col_offset + return constant def is_const_str(node): diff --git a/xonsh/parsers/v313.py b/xonsh/parsers/v313.py new file mode 100644 index 000000000..22bc03265 --- /dev/null +++ b/xonsh/parsers/v313.py @@ -0,0 +1,264 @@ +# type: ignore +# TODO: remove line above once mypy understands the match statement + +"""Handles changes since PY313 + +handle +- import-alias requiring lineno +- match statement +""" + +from ast import match_case +from ast import parse as pyparse + +from xonsh.parsers import ast +from xonsh.parsers.ast import xonsh_call +from xonsh.parsers.base import ( + RE_STRINGPREFIX, + del_ctx, + ensure_has_elts, + lopen_loc, + store_ctx, +) +from xonsh.parsers.fstring_adaptor import FStringAdaptor +from xonsh.parsers.v310 import Parser as ThreeTenParser + + +class Parser(ThreeTenParser): + def p_eval_input(self, p): + """eval_input : testlist newlines_opt""" + p1 = p[1] + expression = ast.Expression(body=p1) + expression.lineno = p1.lineno + expression.col_offset = p1.col_offset + p[0] = expression + + def p_pm_term(self, p): + """ + pm_term : plus_tok term + | minus_tok term + """ + p1 = p[1] + op = self._term_binops[p1.value]() + op.lineno = p1.lineno + op.col_offset = p1.lexpos + p[0] = [op, p[2]] + + def p_atom_lbrace(self, p): + """atom : lbrace_tok dictorsetmaker_opt RBRACE""" + p1, p2 = p[1], p[2] + p1, p1_tok = p1.value, p1 + if p2 is None: + p0 = ast.Dict( + keys=[], + values=[], + lineno=self.lineno, + col_offset=self.col, + ) + p0.ctx = ast.Load() + else: + p0 = p2 + p0.lineno, p0.col_offset = p1_tok.lineno, p1_tok.lexpos + p[0] = p0 + + # case blocks + def p_case_block(self, p): + """ + case_block : case_tok patterns COLON suite + | case_tok patterns IF test COLON suite + """ + + loc = self.get_line_cols(p, 1) + match list(p): + case [_, _, pattern, _, suite]: + p[0] = match_case(pattern=pattern, body=suite) + p[0].lineno = loc["lineno"] + p[0].end_lineno = loc["end_lineno"] + p[0].col_offset = loc["col_offset"] + p[0].end_col_offset = loc["end_col_offset"] + case [_, _, pattern, _, guard, _, suite]: + p[0] = match_case(pattern=pattern, body=suite, guard=guard) + p[0].lineno = loc["lineno"] + p[0].end_lineno = loc["end_lineno"] + p[0].col_offset = loc["col_offset"] + p[0].end_col_offset = loc["end_col_offset"] + case _: + raise AssertionError() + + def p_string_literal(self, p): + """string_literal : string_tok""" + p1 = p[1] + prefix = RE_STRINGPREFIX.match(p1.value).group().lower() + if "p" in prefix and "f" in prefix: + new_pref = prefix.replace("p", "") + value_without_p = new_pref + p1.value[len(prefix) :] + try: + s = pyparse(value_without_p).body[0].value + except SyntaxError: + s = None + if s is None: + try: + s = FStringAdaptor( + value_without_p, new_pref, filename=self.lexer.fname + ).run() + except SyntaxError as e: + self._set_error( + str(e), self.currloc(lineno=p1.lineno, column=p1.lexpos) + ) + s = ast.increment_lineno(s, p1.lineno - 1) + p[0] = xonsh_call( + "__xonsh__.path_literal", [s], lineno=p1.lineno, col=p1.lexpos + ) + elif "p" in prefix: + value_without_p = prefix.replace("p", "") + p1.value[len(prefix) :] + s = ast.const_str( + s=ast.literal_eval(value_without_p), + lineno=p1.lineno, + col_offset=p1.lexpos, + ) + p[0] = xonsh_call( + "__xonsh__.path_literal", [s], lineno=p1.lineno, col=p1.lexpos + ) + elif "f" in prefix: + try: + s = pyparse(p1.value).body[0].value + except SyntaxError: + s = None + if s is None: + try: + s = FStringAdaptor( + p1.value, prefix, filename=self.lexer.fname + ).run() + except SyntaxError as e: + self._set_error( + str(e), self.currloc(lineno=p1.lineno, column=p1.lexpos) + ) + s = ast.increment_lineno(s, p1.lineno - 1) + if "r" in prefix: + s.is_raw = True + p[0] = s + else: + s = ast.literal_eval(p1.value) + is_bytes = "b" in prefix + is_raw = "r" in prefix + cls = ast.const_bytes if is_bytes else ast.const_str + p[0] = cls(s=s, lineno=p1.lineno, col_offset=p1.lexpos) + p[0].is_raw = is_raw + + def p_atom_expr_await(self, p): + """atom_expr : await_tok atom trailer_list_opt""" + p0 = self.apply_trailers(p[2], p[3]) + p1 = p[1] + p0 = ast.Await(value=p0, lineno=p1.lineno, col_offset=p1.lexpos) + p0.ctx = ast.Load() + p[0] = p0 + + # + # For normal assignments, additional restrictions enforced + # by the interpreter + # + def p_del_stmt(self, p): + """del_stmt : del_tok exprlist""" + p1 = p[1] + p2 = p[2] + for targ in p2: + del_ctx(targ) + p0 = ast.Delete(targets=p2, lineno=p1.lineno, col_offset=p1.lexpos) + p[0] = p0 + + # + # Dict or set maker + # + def p_dictorsetmaker_t6(self, p): + """dictorsetmaker : test COLON test comma_item_list comma_opt""" + p1, p4 = p[1], p[4] + keys = [p1] + vals = [p[3]] + for k, v in zip(p4[::2], p4[1::2]): + keys.append(k) + vals.append(v) + lineno, col = lopen_loc(p1) + p[0] = ast.Dict(keys=keys, values=vals, lineno=lineno, col_offset=col) + p[0].ctx = ast.Load() + + def p_dictorsetmaker_i4(self, p): + """dictorsetmaker : item comma_item_list comma_opt""" + p1, p2 = p[1], p[2] + keys = [p1[0]] + vals = [p1[1]] + for k, v in zip(p2[::2], p2[1::2]): + keys.append(k) + vals.append(v) + lineno, col = lopen_loc(p1[0] or p1[1]) + p[0] = ast.Dict(keys=keys, values=vals, lineno=lineno, col_offset=col) + p[0].ctx = ast.Load() + + def p_dictorsetmaker_t4_dict(self, p): + """dictorsetmaker : test COLON testlist""" + keys = [p[1]] + vals = self._list_or_elts_if_not_real_tuple(p[3]) + lineno, col = lopen_loc(p[1]) + p[0] = ast.Dict(keys=keys, values=vals, lineno=lineno, col_offset=col) + p[0].ctx = ast.Load() + + def p_dictorsetmaker_item_comma(self, p): + """dictorsetmaker : item comma_opt""" + p1 = p[1] + keys = [p1[0]] + vals = [p1[1]] + lineno, col = lopen_loc(p1[0] or p1[1]) + p[0] = ast.Dict(keys=keys, values=vals, lineno=lineno, col_offset=col) + p[0].ctx = ast.Load() + + def p_dictorsetmaker_t4_set(self, p): + """dictorsetmaker : test_or_star_expr comma_test_or_star_expr_list comma_opt""" + p[0] = ast.Set(elts=[p[1]] + p[2], lineno=self.lineno, col_offset=self.col) + p[0].ctx = ast.Load() + + def p_dictorsetmaker_test_comma(self, p): + """dictorsetmaker : test_or_star_expr comma_opt""" + elts = self._list_or_elts_if_not_real_tuple(p[1]) + p[0] = ast.Set(elts=elts, lineno=self.lineno, col_offset=self.col) + p[0].ctx = ast.Load() + + def p_dictorsetmaker_testlist(self, p): + """dictorsetmaker : testlist""" + elts = self._list_or_elts_if_not_real_tuple(p[1]) + p[0] = ast.Set(elts=elts, lineno=self.lineno, col_offset=self.col) + p[0].ctx = ast.Load() + + def p_op_factor(self, p): + """ + op_factor : times_tok factor + | at_tok factor + | divide_tok factor + | mod_tok factor + | doublediv_tok factor + """ + p1 = p[1] + op = self._term_binops[p1.value] + if op is None: + self._set_error( + f"operation {p1!r} not supported", + self.currloc(lineno=p.lineno, column=p.lexpos), + ) + op = op() + op.lineno = p1.lineno + op.col_offset = p1.lexpos + p[0] = [op, p[2]] + + def p_comp_for(self, p): + """comp_for : FOR exprlist IN or_test comp_iter_opt""" + targs, it, p5 = p[2], p[4], p[5] + if len(targs) == 1: + targ = targs[0] + else: + targ = ensure_has_elts(targs) + store_ctx(targ) + comp = ast.comprehension(target=targ, iter=it, ifs=[], is_async=0) + comps = [comp] + p0 = {"comps": comps} + if p5 is not None: + comps += p5.get("comps", []) + comp.ifs += p5.get("if", []) + p[0] = p0 From 599f1c0f36b95ba70a8c64b4cf7dc405d209f321 Mon Sep 17 00:00:00 2001 From: Jueun Lee Date: Tue, 19 Nov 2024 08:04:24 +0900 Subject: [PATCH 30/43] env: add `XONSH_SUPPRESS_WELCOME` to suppress welcome msg (#5719) add `XONSH_SUPPRESS_WELCOME` variable to suppress welcome msg Co-authored-by: Gil Forsyth --- news/add-suppress-welcome-env.rst | 23 +++++++++++++++++++++++ xonsh/environ.py | 4 ++++ xonsh/main.py | 1 + 3 files changed, 28 insertions(+) create mode 100644 news/add-suppress-welcome-env.rst diff --git a/news/add-suppress-welcome-env.rst b/news/add-suppress-welcome-env.rst new file mode 100644 index 000000000..1e5e9aa0f --- /dev/null +++ b/news/add-suppress-welcome-env.rst @@ -0,0 +1,23 @@ +**Added:** + +* env: Added ``$XONSH_SUPPRESS_WELCOME`` variable to suppress the welcome message. + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* diff --git a/xonsh/environ.py b/xonsh/environ.py index a005e9cd8..b49cd8f56 100644 --- a/xonsh/environ.py +++ b/xonsh/environ.py @@ -1627,6 +1627,10 @@ class PromptSetting(Xettings): "For example, to have stderr appear on a red background, the " 'prefix & postfix pair would be "{BACKGROUND_RED}" & "{RESET}".', ) + XONSH_SUPPRESS_WELCOME = Var.with_default( + False, + "Suppresses the welcome message.", + ) class PromptHistorySetting(Xettings): diff --git a/xonsh/main.py b/xonsh/main.py index fa1fa790d..c833e1456 100644 --- a/xonsh/main.py +++ b/xonsh/main.py @@ -548,6 +548,7 @@ def main_xonsh(args): ignore_sigtstp() if ( env["XONSH_INTERACTIVE"] + and not env["XONSH_SUPPRESS_WELCOME"] and sys.stdin.isatty() # In case the interactive mode is forced but no tty (input from pipe). and not any(os.path.isfile(i) for i in env["XONSHRC"]) and not any(os.path.isdir(i) for i in env["XONSHRC_DIR"]) From 0791372f30ac89bbf5cb2078e47f842598d5206d Mon Sep 17 00:00:00 2001 From: Bala Date: Mon, 2 Dec 2024 17:31:09 +0530 Subject: [PATCH 31/43] Fix DeprecationWarning while initializing `Expression` (#5739) * Fix DeprecationWarning while initializing `Expression` * Add news item * Rename the news file to the branch name * Fixing more ast related warnings --- news/fix_warning_Expression.rst | 23 +++++++++++++++++++++++ xonsh/parsers/base.py | 13 +++++++++---- 2 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 news/fix_warning_Expression.rst diff --git a/news/fix_warning_Expression.rst b/news/fix_warning_Expression.rst new file mode 100644 index 000000000..e90daaeb9 --- /dev/null +++ b/news/fix_warning_Expression.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* Fix DeprecationWarning while initializing Expression + +**Security:** + +* diff --git a/xonsh/parsers/base.py b/xonsh/parsers/base.py index c1223cf83..239926d03 100644 --- a/xonsh/parsers/base.py +++ b/xonsh/parsers/base.py @@ -738,7 +738,9 @@ class BaseParser: def p_eval_input(self, p): """eval_input : testlist newlines_opt""" p1 = p[1] - p[0] = ast.Expression(body=p1, lineno=p1.lineno, col_offset=p1.col_offset) + p[0] = ast.Expression(body=p1) + p[0].lineno = p1.lineno + p[0].col_offset = p1.col_offset def p_func_call(self, p): """func_call : LPAREN arglist_opt RPAREN""" @@ -2155,7 +2157,8 @@ class BaseParser: | minus_tok term """ p1 = p[1] - op = self._term_binops[p1.value](lineno=p1.lineno, col_offset=p1.lexpos) + op = self._term_binops[p1.value]() + op.lineno, op.col_offset = p1.lineno, p1.lexpos p[0] = [op, p[2]] def p_term(self, p): @@ -2194,7 +2197,9 @@ class BaseParser: f"operation {p1!r} not supported", self.currloc(lineno=p.lineno, column=p.lexpos), ) - p[0] = [op(lineno=p1.lineno, col_offset=p1.lexpos), p[2]] + op_node = op() + op_node.lineno, op_node.col_offset = p1.lineno, p1.lexpos + p[0] = [op_node, p[2]] _factor_ops = {"+": ast.UAdd, "-": ast.USub, "~": ast.Invert} @@ -3047,7 +3052,7 @@ class BaseParser: else: targ = ensure_has_elts(targs) store_ctx(targ) - comp = ast.comprehension(target=targ, iter=it, ifs=[]) + comp = ast.comprehension(target=targ, iter=it, ifs=[], is_async=0) comps = [comp] p0 = {"comps": comps} if p5 is not None: From 9ae14866de2fe3153908a0cf608609b2798bac71 Mon Sep 17 00:00:00 2001 From: Gil Forsyth Date: Sun, 8 Dec 2024 03:00:20 -0500 Subject: [PATCH 32/43] test: add Python 3.13 to test matrix (#5733) --- .github/workflows/test.yml | 2 +- tests/test_integrations.py | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 88633d5d3..93e751550 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,7 +38,7 @@ jobs: - "3.10" - "3.11" - "3.12" -# - "3.13-dev" + - "3.13" name: Test Python ${{ matrix.python-version }} ${{ matrix.os }} steps: - uses: actions/checkout@v4 diff --git a/tests/test_integrations.py b/tests/test_integrations.py index 8609920f1..b9dc4b5e9 100644 --- a/tests/test_integrations.py +++ b/tests/test_integrations.py @@ -17,6 +17,7 @@ from xonsh.pytest.tools import ( ON_DARWIN, ON_TRAVIS, ON_WINDOWS, + VER_FULL, skip_if_on_darwin, skip_if_on_msys, skip_if_on_unix, @@ -610,8 +611,9 @@ first ), # testing alias stack: parallel threaded callable aliases. # This breaks if the __ALIAS_STACK variables leak between threads. - ( - """ + pytest.param( + ( + """ from time import sleep aliases['a'] = lambda: print(1, end="") or sleep(0.2) or print(1, end="") aliases['b'] = 'a' @@ -620,8 +622,14 @@ a | a a | b | a a | a | b | b """, - "1" * 2 * 4, - 0, + "1" * 2 * 4, + 0, + ), + # TODO: investigate errors on Python 3.13 + marks=pytest.mark.skipif( + VER_FULL > (3, 12) and not ON_WINDOWS, + reason="broken pipes on Python 3.13 likely due to changes in threading behavior", + ), ), # test $SHLVL ( @@ -739,7 +747,7 @@ if not ON_WINDOWS: @skip_if_no_xonsh @pytest.mark.parametrize("case", ALL_PLATFORMS) -@pytest.mark.flaky(reruns=3, reruns_delay=2) +@pytest.mark.flaky(reruns=4, reruns_delay=2) def test_script(case): script, exp_out, exp_rtn = case if ON_DARWIN: From 1d1e7a88276a57ade356c9995207e395d56f5420 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Sun, 8 Dec 2024 09:28:31 +0100 Subject: [PATCH 33/43] try just using CaseSenssitiveDict from requests to see if it works (#5744) * try just using CaseSenssitiveDict from requests to see if it works * put the dependency back in pyproject.toml and ignore typing on import * news * code now passing tests locally. I still need to write tests for the new Class * tests for CaseInsensitiveDict --- news/remove-caseinsdict.rst | 24 ++++++++++++ pyproject.toml | 4 +- tests/test_commands_cache.py | 75 ++++++++++++++++++++++++++++++++++++ xonsh/commands_cache.py | 46 +++++++++++++++++++++- 4 files changed, 145 insertions(+), 4 deletions(-) create mode 100644 news/remove-caseinsdict.rst diff --git a/news/remove-caseinsdict.rst b/news/remove-caseinsdict.rst new file mode 100644 index 000000000..196e04f0f --- /dev/null +++ b/news/remove-caseinsdict.rst @@ -0,0 +1,24 @@ +**Added:** + +* + +**Changed:** + +* replaced `case_insensitive_dictionary` dependency with local + `CaseInsensitiveDict` class + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* diff --git a/pyproject.toml b/pyproject.toml index fa6e2688b..632323698 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,9 +15,7 @@ authors = [{ name = "Anthony Scopatz" }, { email = "scopatz@gmail.com" }] maintainers = [{ name = "Xonsh Community" }, { email = "xonsh@gil.forsyth.dev" }] license = { text = "BSD 2-Clause License" } requires-python = ">=3.9" -dependencies = [ - "case-insensitive-dictionary; platform_system=='Windows'", -] +dependencies = [] [tool.setuptools.dynamic] version = {attr = "xonsh.__version__"} diff --git a/tests/test_commands_cache.py b/tests/test_commands_cache.py index b8825ba1b..d90dec63c 100644 --- a/tests/test_commands_cache.py +++ b/tests/test_commands_cache.py @@ -8,6 +8,7 @@ import pytest from xonsh.commands_cache import ( SHELL_PREDICTOR_PARSER, + CaseInsensitiveDict, CommandsCache, _Commands, executables_in, @@ -306,3 +307,77 @@ def test_executables_in(xession): else: result = set(executables_in(test_path)) assert expected == result + + +def test_caseinsdict_constructor(): + actual = CaseInsensitiveDict({"key1": "val1", "Key2": "Val2"}) + assert isinstance(actual, CaseInsensitiveDict) + assert actual["key1"] == "val1" + assert actual["Key2"] == "Val2" + + +def test_caseinsdict_getitem(): + actual = CaseInsensitiveDict({"Key1": "Val1"}) + assert actual["Key1"] == "Val1" + assert actual["key1"] == "Val1" + + +def test_caseinsdict_setitem(): + actual = CaseInsensitiveDict({"Key1": "Val1"}) + actual["Key1"] = "Val2" + assert actual["Key1"] == "Val2" + assert actual["key1"] == "Val2" + actual["key1"] = "Val3" + assert actual["Key1"] == "Val3" + assert actual["key1"] == "Val3" + + +def test_caseinsdict_delitem(): + actual = CaseInsensitiveDict({"Key1": "Val1", "Key2": "Val2"}) + del actual["Key1"] + assert actual == CaseInsensitiveDict({"Key2": "Val2"}) + del actual["key2"] + assert actual == CaseInsensitiveDict({}) + + +def test_caseinsdict_contains(): + actual = CaseInsensitiveDict({"Key1": "Val1"}) + assert actual.__contains__("Key1") + assert actual.__contains__("key1") + assert not actual.__contains__("key2") + + +def test_caseinsdict_get(): + actual = CaseInsensitiveDict({"Key1": "Val1"}) + assert actual.get("Key1") == "Val1" + assert actual.get("key1") == "Val1" + assert actual.get("key2", "no val") == "no val" + assert actual.get("key1", "no val") == "Val1" + + +def test_caseinsdict_update(): + actual = CaseInsensitiveDict({"Key1": "Val1"}) + actual.update({"Key2": "Val2"}) + assert actual["key2"] == "Val2" + + +def test_caseinsdict_keys(): + actual = CaseInsensitiveDict({"Key1": "Val1"}) + assert next(actual.keys()) == "Key1" + + +def test_caseinsdict_items(): + actual = CaseInsensitiveDict({"Key1": "Val1"}) + assert next(actual.items()) == ("Key1", "Val1") + + +def test_caseinsdict_repr(): + actual = CaseInsensitiveDict({"Key1": "Val1"}) + assert actual.__repr__() == "CaseInsensitiveDict({'Key1': 'Val1'})" + + +def test_caseinsdict_copy(): + initial = CaseInsensitiveDict({"Key1": "Val1"}) + actual = initial.copy() + assert actual == initial + assert id(actual) != id(initial) diff --git a/xonsh/commands_cache.py b/xonsh/commands_cache.py index 0e8191584..bfd50f859 100644 --- a/xonsh/commands_cache.py +++ b/xonsh/commands_cache.py @@ -23,8 +23,52 @@ from xonsh.procs.executables import ( is_executable_in_windows, ) + +class CaseInsensitiveDict(dict[tp.Any, tp.Any]): + def __init__(self, *args, **kwargs): + super().__init__() + self._store = {} + self.update(*args, **kwargs) + + def __setitem__(self, key, value): + # Store the key in lowercase but preserve the original case for display + self._store[key.casefold()] = key + super().__setitem__(key.casefold(), value) + + def __getitem__(self, key): + return super().__getitem__(key.casefold()) + + def __delitem__(self, key): + del self._store[key.casefold()] + super().__delitem__(key.casefold()) + + def __contains__(self, key): + return key.casefold() in self._store + + def get(self, key, default=None): + return super().get(key.casefold(), default) + + def update(self, *args, **kwargs): + for k, v in dict(*args, **kwargs).items(): + self[k] = v + + def keys(self): + # Return the original keys with their original casing + return (self._store[k] for k in self._store) + + def items(self): + return ((self._store[k], self[k]) for k in self._store) + + def __repr__(self): + return f"{self.__class__.__name__}({dict(self.items())})" + + def copy(self): + return CaseInsensitiveDict(self.items()) + + +CacheDict: tp.Union[type[CaseInsensitiveDict], type[dict]] if ON_WINDOWS: - from case_insensitive_dict import CaseInsensitiveDict as CacheDict + CacheDict = CaseInsensitiveDict else: CacheDict = dict From 055321dba7ebd71ba56e55262cf62dc641697f25 Mon Sep 17 00:00:00 2001 From: Gil Forsyth Date: Sun, 8 Dec 2024 07:43:50 -0500 Subject: [PATCH 34/43] chore: add 3.13 to release jobs and remove stale dependency (#5735) chore: add 3.13 to release jobs and remove stale dep `doctr` isn't used anymore, so we don't need to include it. --- .github/workflows/publish.yml | 1 + pyproject.toml | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6a5be5ab3..90c5a7036 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -22,6 +22,7 @@ jobs: - "3.10" - "3.11" - "3.12" + - "3.13" steps: - uses: actions/checkout@v4 - name: setup-python diff --git a/pyproject.toml b/pyproject.toml index 632323698..bc1f3cdd8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -135,7 +135,6 @@ doc = [ "psutil", "pyzmq", "matplotlib", - "doctr", "tornado", "runthis-sphinxext", "livereload", From 5be2fa0a1e5fd9405631cc6f56ee00e176d8c342 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 8 Dec 2024 14:07:36 +0000 Subject: [PATCH 35/43] [pre-commit.ci] pre-commit autoupdate (#5712) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.6.9 → v0.8.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.9...v0.8.1) - [github.com/pre-commit/mirrors-mypy: v1.11.2 → v1.13.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.11.2...v1.13.0) * chore: ignore UP031 * chore: ignore mypy error --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Noortheen Raja --- .pre-commit-config.yaml | 4 ++-- pyproject.toml | 1 + xonsh/completers/commands.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 022e77578..18a5d00f6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ default_language_version: repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: 'v0.6.9' + rev: 'v0.8.1' hooks: - id: ruff args: [., --fix, --exit-non-zero-on-fix] @@ -18,7 +18,7 @@ repos: pass_filenames: false - repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v1.11.2' # Use the sha / tag you want to point at + rev: 'v1.13.0' # Use the sha / tag you want to point at hooks: - id: mypy pass_filenames: false diff --git a/pyproject.toml b/pyproject.toml index bc1f3cdd8..a125aa83f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -201,6 +201,7 @@ ignore = [ "E402", # Module level import not at top of file "E501", # line length "E731", # Do not assign a lambda expression, use a def + "UP031", # Use format specifiers instead of percent format ] select = [ "B", # https://beta.ruff.rs/docs/rules/#flake8-bugbear-b diff --git a/xonsh/completers/commands.py b/xonsh/completers/commands.py index f6a67e491..4a40f7d15 100644 --- a/xonsh/completers/commands.py +++ b/xonsh/completers/commands.py @@ -33,7 +33,7 @@ def complete_command(command: CommandContext): kwargs = {} if show_desc: kwargs["description"] = "Alias" if is_alias else path - yield RichCompletion(s, append_space=True, **kwargs) + yield RichCompletion(s, append_space=True, **kwargs) # type: ignore if xp.ON_WINDOWS: for i in executables_in("."): if i.startswith(cmd): From 9d49292453ac197ed78725b4ba0a9bd27a2ca995 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Sun, 8 Dec 2024 21:52:08 +0700 Subject: [PATCH 36/43] test: split a test to include Windows (#5665) * test: split a test to include Windows (moving non-Win commands like ls to a separate test) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- tests/shell/test_ptk_highlight.py | 100 ++++++++++++++++++++++-------- 1 file changed, 75 insertions(+), 25 deletions(-) diff --git a/tests/shell/test_ptk_highlight.py b/tests/shell/test_ptk_highlight.py index 6b1dd8dc8..b4386fe0f 100644 --- a/tests/shell/test_ptk_highlight.py +++ b/tests/shell/test_ptk_highlight.py @@ -46,16 +46,6 @@ def check_token(xsh): _cases = { - "ls": { - "ls -al": [ - (Name.Builtin, "ls"), - ], - }, - "ls-bin": { - "/bin/ls -al": [ - (Name.Builtin, "/bin/ls"), - ], - }, "print": { 'print("hello")': [ (Name.Builtin, "print"), @@ -94,6 +84,69 @@ _cases = { (Error, "non-existance-cmd"), ], }, + "nested": { + "print($(cd))": [ + (Name.Builtin, "print"), + (Punctuation, "("), + (Keyword, "$"), + (Punctuation, "("), + (Name.Builtin, "cd"), + (Punctuation, ")"), + (Punctuation, ")"), + (Text.Whitespace, "\n"), + ], + }, + "subproc-args": { + "cd 192.168.0.1": [ + (Text, "192.168.0.1"), + ], + }, + "backtick": { + r"echo g`.*\w+`": [ + (String.Affix, "g"), + (String.Backtick, "`"), + (String.Regex, "."), + (String.Regex, "*"), + (String.Escape, r"\w"), + ], + }, + "macro": { + r"g!(42, *, 65)": [ + (Name, "g"), + (Keyword, "!"), + (Punctuation, "("), + (Number.Integer, "42"), + ], + r"bash -c ! export var=42; echo $var": [ + (Name.Builtin, "bash"), + (Text, "-c"), + (Keyword, "!"), + (String, "export var=42; echo $var"), + ], + }, +} +_cases_no_win = { + "ls": { + "ls -al": [ + (Name.Builtin, "ls"), + ], + }, + "ls-bin": { + "/bin/ls -al": [ + (Name.Builtin, "/bin/ls"), + ], + }, + "print": { + 'print("hello")': [ + (Name.Builtin, "print"), + (Punctuation, "("), + (Literal.String.Double, '"'), + (Literal.String.Double, "hello"), + (Literal.String.Double, '"'), + (Punctuation, ")"), + (Text.Whitespace, "\n"), + ] + }, "nested": { 'echo @("hello")': [ (Name.Builtin, "echo"), @@ -125,20 +178,6 @@ _cases = { (Text.Whitespace, "\n"), ], }, - "subproc-args": { - "cd 192.168.0.1": [ - (Text, "192.168.0.1"), - ], - }, - "backtick": { - r"echo g`.*\w+`": [ - (String.Affix, "g"), - (String.Backtick, "`"), - (String.Regex, "."), - (String.Regex, "*"), - (String.Escape, r"\w"), - ], - }, "macro": { r"g!(42, *, 65)": [ (Name, "g"), @@ -167,12 +206,23 @@ def _convert_cases(): yield pytest.param(*item, id=f"{title}-{idx}") +def _convert_cases_no_win(): + for title, input_dict in _cases_no_win.items(): + for idx, item in enumerate(input_dict.items()): + yield pytest.param(*item, id=f"{title}-{idx}") + + @pytest.mark.parametrize("inp, expected", list(_convert_cases())) -@skip_if_on_windows def test_xonsh_lexer(inp, expected, check_token): check_token(inp, expected) +@pytest.mark.parametrize("inp, expected", list(_convert_cases_no_win())) +@skip_if_on_windows +def test_xonsh_lexer_no_win(inp, expected, check_token): + check_token(inp, expected) + + # can't seem to get thie test to import pyghooks and define on_lscolors_change handler like live code does. # so we declare the event handler directly here. @pytest.fixture From f55164aad750bc3ba93495f1567fe1a18a90ed15 Mon Sep 17 00:00:00 2001 From: Gil Forsyth Date: Mon, 9 Dec 2024 09:41:03 -0500 Subject: [PATCH 37/43] Updated authorship for 0.19.0 --- .authors.yml | 22 +++++++++++++++++----- .mailmap | 7 +++++-- AUTHORS.rst | 7 +++++-- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/.authors.yml b/.authors.yml index 6fc2240cc..e55d8b990 100644 --- a/.authors.yml +++ b/.authors.yml @@ -64,7 +64,7 @@ - Gilbert.Forsyth@capitalone.com - gforsyth@gwu.edu - gil@forsyth.dev - num_commits: 672 + num_commits: 680 first_commit: 2015-10-19 16:04:32 github: gforsyth - name: Morten Enemark Lund @@ -1283,7 +1283,7 @@ first_commit: 2021-02-08 10:50:51 - name: Evgeny email: eugenesvk@users.noreply.github.com - num_commits: 11 + num_commits: 12 first_commit: 2021-02-22 09:32:34 - name: Adam Schwalm email: adamschwalm@gmail.com @@ -1431,7 +1431,7 @@ first_commit: 2021-11-18 18:42:29 - name: doronz88 email: doron88@gmail.com - num_commits: 6 + num_commits: 7 first_commit: 2022-04-27 12:41:13 - name: Stefano Rivera email: github@rivera.za.net @@ -1465,7 +1465,7 @@ first_commit: 2022-06-27 22:21:34 - name: pre-commit-ci[bot] email: 66853113+pre-commit-ci[bot]@users.noreply.github.com - num_commits: 77 + num_commits: 78 first_commit: 2022-07-11 14:26:34 - name: jgart email: 47760695+jgarte@users.noreply.github.com @@ -1571,7 +1571,7 @@ first_commit: 2024-01-15 05:25:23 - name: JamesParrott email: 80779630+JamesParrott@users.noreply.github.com - num_commits: 1 + num_commits: 2 first_commit: 2024-01-16 08:56:07 - name: Airat Makhmutov email: 108220148+rautyrauty@users.noreply.github.com @@ -1629,3 +1629,15 @@ email: paravoid@debian.org num_commits: 1 first_commit: 2024-09-17 06:47:59 +- name: Jueun Lee + email: seirios0107@gmail.com + num_commits: 1 + first_commit: 2024-11-18 18:04:24 +- name: Simon Billinge + email: sbillinge@users.noreply.github.com + num_commits: 1 + first_commit: 2024-12-08 03:28:31 +- name: Bala + email: kumaran.4353@gmail.com + num_commits: 1 + first_commit: 2024-12-02 07:01:09 diff --git a/.mailmap b/.mailmap index a8c8c0835..57f16adbc 100644 --- a/.mailmap +++ b/.mailmap @@ -95,6 +95,7 @@ Alessio Bogon Alessio Bogon Yohei Tamura Maximilian Köhl Alexander Sosedkin +doronz88 Cody Scott Jake Hedman traverseda @@ -107,7 +108,6 @@ Jared Crawford Mike Crowe drmikecrowe Vasilis Gerakaris Vasilis Gerakaris Angus Hollands -doronz88 JuanPablo Ollie Terrance Marcel Bollmann @@ -214,6 +214,7 @@ cmidkiff87 <39914727+cmidkiff87@users.noreply.github.com> jbw3 Naveen <172697+naveensrinivasan@users.noreply.github.com> Blake Ramsdell +JamesParrott <80779630+JamesParrott@users.noreply.github.com> jyn Dan Allan Ned Letcher @@ -345,7 +346,6 @@ Wilfried Pollan Jacqueline Leykam Joshix-1 <57299889+Joshix-1@users.noreply.github.com> Nathan Monfils -JamesParrott <80779630+JamesParrott@users.noreply.github.com> Airat Makhmutov <108220148+rautyrauty@users.noreply.github.com> Matthieu LAURENT Daniel Saunders @@ -359,5 +359,8 @@ Aidan Courtney Max Nordlund Shawn Wallace Faidon Liambotis +Jueun Lee +Simon Billinge +Bala goodboy Atsushi Morimoto diff --git a/AUTHORS.rst b/AUTHORS.rst index 843818129..c7210905b 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -70,6 +70,7 @@ Authors are sorted by number of commits. * Yohei Tamura * Maximilian Köhl * Alexander Sosedkin +* doronz88 * Cody Scott * Jake Hedman * traverseda @@ -82,7 +83,6 @@ Authors are sorted by number of commits. * Mike Crowe * Vasilis Gerakaris * Angus Hollands -* doronz88 * JuanPablo * Ollie Terrance * Marcel Bollmann @@ -189,6 +189,7 @@ Authors are sorted by number of commits. * jbw3 * Naveen * Blake Ramsdell +* JamesParrott * jyn * Dan Allan * Ned Letcher @@ -320,7 +321,6 @@ Authors are sorted by number of commits. * Jacqueline Leykam * Joshix-1 * Nathan Monfils -* JamesParrott * Airat Makhmutov * Matthieu LAURENT * Daniel Saunders @@ -334,5 +334,8 @@ Authors are sorted by number of commits. * Max Nordlund * Shawn Wallace * Faidon Liambotis +* Jueun Lee +* Simon Billinge +* Bala * goodboy * Atsushi Morimoto From 689e8cb3143bf6503281439d6973726751d9eaba Mon Sep 17 00:00:00 2001 From: Gil Forsyth Date: Mon, 9 Dec 2024 09:41:03 -0500 Subject: [PATCH 38/43] bumped version to 0.19.0 --- xonsh/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xonsh/__init__.py b/xonsh/__init__.py index e61f7a55d..11ac8e1a9 100644 --- a/xonsh/__init__.py +++ b/xonsh/__init__.py @@ -1 +1 @@ -__version__ = "0.18.4" +__version__ = "0.19.0" From c059ac23d22410363211dde6d8c43dc120c346ca Mon Sep 17 00:00:00 2001 From: Gil Forsyth Date: Mon, 9 Dec 2024 09:41:03 -0500 Subject: [PATCH 39/43] Updated CHANGELOG for 0.19.0 --- CHANGELOG.rst | 30 +++++++++++++++++++++++++++ news/add-suppress-welcome-env.rst | 23 -------------------- news/ast-fix-deprecation-warnings.rst | 23 -------------------- news/fix_warning_Expression.rst | 23 -------------------- news/remove-caseinsdict.rst | 24 --------------------- 5 files changed, 30 insertions(+), 93 deletions(-) delete mode 100644 news/add-suppress-welcome-env.rst delete mode 100644 news/ast-fix-deprecation-warnings.rst delete mode 100644 news/fix_warning_Expression.rst delete mode 100644 news/remove-caseinsdict.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 73b5312d6..34d97a36a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,36 @@ Xonsh Change Log .. current developments +v0.19.0 +==================== + +**Added:** + +* env: Added ``$XONSH_SUPPRESS_WELCOME`` variable to suppress the welcome message. + +**Changed:** + +* replaced `case_insensitive_dictionary` dependency with local + `CaseInsensitiveDict` class + +**Fixed:** + +* parsers: fix deprecation warnings triggered on python3.13 +* Fix DeprecationWarning while initializing Expression + +**Authors:** + +* Gil Forsyth +* pre-commit-ci[bot] +* Evgeny +* doronz88 +* JamesParrott +* Jueun Lee +* Simon Billinge +* Bala + + + v0.18.4 ==================== diff --git a/news/add-suppress-welcome-env.rst b/news/add-suppress-welcome-env.rst deleted file mode 100644 index 1e5e9aa0f..000000000 --- a/news/add-suppress-welcome-env.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* env: Added ``$XONSH_SUPPRESS_WELCOME`` variable to suppress the welcome message. - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/ast-fix-deprecation-warnings.rst b/news/ast-fix-deprecation-warnings.rst deleted file mode 100644 index ae0916d52..000000000 --- a/news/ast-fix-deprecation-warnings.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* parsers: fix deprecation warnings triggered on python3.13 - -**Security:** - -* diff --git a/news/fix_warning_Expression.rst b/news/fix_warning_Expression.rst deleted file mode 100644 index e90daaeb9..000000000 --- a/news/fix_warning_Expression.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* Fix DeprecationWarning while initializing Expression - -**Security:** - -* diff --git a/news/remove-caseinsdict.rst b/news/remove-caseinsdict.rst deleted file mode 100644 index 196e04f0f..000000000 --- a/news/remove-caseinsdict.rst +++ /dev/null @@ -1,24 +0,0 @@ -**Added:** - -* - -**Changed:** - -* replaced `case_insensitive_dictionary` dependency with local - `CaseInsensitiveDict` class - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* From c85b8923a0a75c5a2acba588025969c703d783f7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 01:02:12 +0530 Subject: [PATCH 40/43] [pre-commit.ci] pre-commit autoupdate (#5746) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.8.1 → v0.8.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.8.1...v0.8.2) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 18a5d00f6..f09589ec4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ default_language_version: repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: 'v0.8.1' + rev: 'v0.8.2' hooks: - id: ruff args: [., --fix, --exit-non-zero-on-fix] From 4c0b223e7b98482de0fb06d1c1e77f3ac9782d1e Mon Sep 17 00:00:00 2001 From: Evgeny Date: Tue, 10 Dec 2024 13:26:12 +0700 Subject: [PATCH 41/43] Allow non-integer exit codes (#5721) * Allow non-integer exit codes justl like in Python proper * doc: add news item * Update fr-exit-str.rst --------- Co-authored-by: Andy Kipp --- news/fr-exit-str.rst | 23 +++++++++++++++++++++++ xonsh/main.py | 9 ++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 news/fr-exit-str.rst diff --git a/news/fr-exit-str.rst b/news/fr-exit-str.rst new file mode 100644 index 000000000..450a46c15 --- /dev/null +++ b/news/fr-exit-str.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* Fixed non-int sys.exit codes raising ValueError. + +**Security:** + +* diff --git a/xonsh/main.py b/xonsh/main.py index c833e1456..17ce7ac8c 100644 --- a/xonsh/main.py +++ b/xonsh/main.py @@ -606,7 +606,14 @@ def main_xonsh(args): err_type, err, _ = exc_info if err_type is SystemExit: code = getattr(exc_info[1], "code", 0) - exit_code = int(code) if code is not None else 0 + if code is None: + exit_code = 0 + else: + exit_code = code + try: + exit_code = int(code) + except ValueError: + pass XSH.exit = exit_code else: exit_code = 1 From 8898f605e96d0f1e09f4fd4c2a1bd2cbe3bb9ed7 Mon Sep 17 00:00:00 2001 From: Andy Kipp Date: Wed, 11 Dec 2024 16:19:25 +0600 Subject: [PATCH 42/43] xonsh/lib: Create README.md --- xonsh/lib/README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 xonsh/lib/README.md diff --git a/xonsh/lib/README.md b/xonsh/lib/README.md new file mode 100644 index 000000000..7725ffde9 --- /dev/null +++ b/xonsh/lib/README.md @@ -0,0 +1 @@ +Xonsh library contains the code that independent to xonsh core or a code that is fork from another projects. From ae283deeb95c3be0b7e16ff4f60aea5144446191 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Thu, 12 Dec 2024 15:00:26 +0700 Subject: [PATCH 43/43] ci: use current 3.13 version of python (#5751) pre-commit: use current version of python --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f09589ec4..6d4dbd395 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ default_language_version: # force all unspecified python hooks to run python3 - python: python3.10 + python: python3.13 #ci: # autofix_prs: false