Commit graph

10709 commits

Author SHA1 Message Date
pre-commit-ci[bot]
6b30c3aae3
[pre-commit.ci] pre-commit autoupdate (#5566)
<!--pre-commit.ci start-->
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.10 →
v0.5.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.10...v0.5.0)
- [github.com/pre-commit/mirrors-mypy: v1.10.0 →
v1.10.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.10.0...v1.10.1)
<!--pre-commit.ci end-->

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-07-01 20:47:17 +02:00
Andy Kipp
ae7fefee06
colors: `COLOR_RESULTS switched to False` for non-interactive command case (#5562)
### Motivation

Running commands with disabled `COLOR_RESULTS` around 40% faster. It
should be by default.


Closes #5561

---------

Co-authored-by: a <1@1.1>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-07-01 21:12:46 +05:30
Andy Kipp
69dce1b293
refactoring: revert platform moving to backwards compatibility (#5564)
Consensus with #5549 
cc #5538

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

---------

Co-authored-by: a <1@1.1>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-07-01 13:44:38 +02:00
a
6860388c88 bump xonsh-in-docker version 2024-06-30 00:28:31 +02:00
a
00c6d4042c Merge remote-tracking branch 'origin/main' 2024-06-29 16:26:59 +02:00
a
b770abcda6 fix news 2024-06-29 16:26:49 +02:00
Spencer Bliven
7311cb9067
Callable Alias: Update documentation (#5524)
Reorders and updates the callable alias examples.

- Start with examples of valid return types first, then show uses for
different arguments
- Add example of using stdin (documents behavior from #5233)


<!---

Thanks for opening a PR on xonsh!

Please do this:

1. Include a news file with your PR
(https://xon.sh/devguide.html#changelog).
2. Add the documentation for your feature into `/docs`.
3. Add the example of usage or before-after behavior.
4. Mention the issue that this PR is addressing e.g. `#1234`.

-->
(I don't think this PR is significant enough for a changelog item.)

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**
2024-06-29 12:49:57 +02:00
Andy Kipp
2788ae3308
refactoring: move lazy to lib (#5560)
#5538

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

---------

Co-authored-by: a <1@1.1>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-29 12:19:08 +02:00
Andy Kipp
143042aff5
refactoring: create xonsh.api, update xonsh.lib (#5557)
To have clear `./xonsh` directory with the list of components we need to
move common packages that are not components of xonsh to lib directory.
cc #5538

I see that `lib.os` and `lib.subprocess` have a bit different intention.
I think more clearer will be put them to `xonsh.api`. This is the first
step to #5383.



## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

---------

Co-authored-by: a <1@1.1>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-29 11:58:11 +02:00
Andy Kipp
659b404f72
refactoring 5538: news about refactoring (#5559)
See the list of pull requests in
https://github.com/xonsh/xonsh/issues/5538

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

---------

Co-authored-by: a <1@1.1>
2024-06-29 11:46:28 +02:00
Andy Kipp
4913edca7a
refactoring: move tests to component dirs: lib, procs (#5558)
https://github.com/xonsh/xonsh/issues/5538

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

---------

Co-authored-by: a <1@1.1>
2024-06-29 11:23:16 +02:00
Andy Kipp
1d7cc00962
refactoring: move shell to shells.shell to avoid unwanted init (#5556)
Continue #5550 for https://github.com/xonsh/xonsh/issues/5538 

---------

Co-authored-by: a <1@1.1>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Noorhteen Raja NJ <jnoortheen@gmail.com>
2024-06-29 14:26:50 +05:30
Andy Kipp
7ffce23d29
refactoring: move parsers (#5552)
#5538


Co-authored-by: a <1@1.1>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Noorhteen Raja NJ <jnoortheen@gmail.com>
2024-06-29 13:58:02 +05:30
Andy Kipp
610f1a41e8
refactoring: form shell submodule (#5550)
#5538


Co-authored-by: a <1@1.1>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-29 12:25:07 +05:30
Andy Kipp
0bece0f5e4
refactoring: move jobs to procs (#5547)
#5538

Co-authored-by: a <1@1.1>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-29 12:21:10 +05:30
Andy Kipp
87fb03c5c7
refactoring: move tokenize (#5555)
#5538

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

---------

Co-authored-by: a <1@1.1>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-29 03:02:09 +02:00
Andy Kipp
21ce490376
refactoring: move diff hist (#5554)
#5538

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

Co-authored-by: a <1@1.1>
2024-06-29 02:46:38 +02:00
Andy Kipp
2ef4e329f7
refactoring: move platform, winutils, macutils to platform submodule (#5549)
https://github.com/xonsh/xonsh/issues/5538
## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

---------

Co-authored-by: a <1@1.1>
2024-06-29 02:01:15 +02:00
Andy Kipp
772ee21643
refactoring: move openpy, inspectors to lib (#5553)
https://github.com/xonsh/xonsh/issues/5538

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

---------

Co-authored-by: a <1@1.1>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-29 01:56:18 +02:00
Andy Kipp
d7ca254ae3
refactoring: move pretty to lib (#5551)
#5538

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

---------

Co-authored-by: a <1@1.1>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-29 00:56:16 +02:00
Andy Kipp
b9998ac5be
refactoring: move jsonutils to lib (#5548)
https://github.com/xonsh/xonsh/issues/5538

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

Co-authored-by: a <1@1.1>
2024-06-29 00:46:04 +02:00
Noorhteen Raja NJ
fa254914d7
fix: argparse based completions should work in newer python versions (#5542)
PS.

e47ecbd042

fixes #5471
2024-06-27 11:55:39 +05:30
Andy Kipp
12aa885d7b
main: minor message with link (#5545)
<!---

Thanks for opening a PR on xonsh!

Please do this:

1. Include a news file with your PR
(https://xon.sh/devguide.html#changelog).
2. Add the documentation for your feature into `/docs`.
3. Add the example of usage or before-after behavior.
4. Mention the issue that this PR is addressing e.g. `#1234`.

-->

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

Co-authored-by: a <1@1.1>
2024-06-27 03:35:23 +02:00
Noorhteen Raja NJ
0f2011d302
fix: Fixed `history gc invocation failing when sqlite` history … (#5540)
…backend is used.


## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**
2024-06-26 13:19:26 +05:30
Andy Kipp
a52aa5febc
Command cache: fix update cache logic (#5539)
### Motivation

I noticed that when I type every letter in the prompt on the remote
server the typing is lagging. I thought it's ssh but no.
After inspection the commands cache code I found that on every key press
there is reading all 2000+ files in PATH because the code for cache
update has funny issue.

### Quiz

```xsh
def f():
    print(1)
    yield False
    print(2)
    yield True
    print(3)

print(any(f()))
```
What will be in the output? Answer:

<details>

```
1
2
True
```

The execution of `print(3)` ignored because `any()` interrupts the
execution of the function.
If we call `print(list(f()))` the output will be `1 2 3 [False, True]`.

</details>

### Before

* Updating cache (read all files in PATH and list of aliases) two times
after start.
* Updating cache (read all files in PATH and list of aliases) on every
key press in prompt.

### After

* Update cache once at start.
* Update cache only when we have real changes of paths or aliases.

cc #4954 #3895 #5309

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

---------

Co-authored-by: a <1@1.1>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-26 12:02:51 +05:30
Andy Kipp
4fb3c79ede
environ docs: move variables to new sections (#5501)
### Motivation

Section "General" in https://xon.sh/envvars.html became huge. It's time
to add new sections and just move vars to them.

Example of the most expected sections:
* cache
* subprocess
* locale

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

---------

Co-authored-by: a <1@1.1>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-25 22:36:05 +05:30
Andy Kipp
0b65348d5e
prompt: switching to prompt_toolkit in case of stdin with interactive mode (#5536)
### Motivation

There is an edge case that we're using mostly in integration tests from
the beginning of the world:
`echo 'echo 1' | xonsh -i` and it's not working with `TERM=dumb` because
dumb is readline.
So in this case we need to force using prompt_toolkit to avoid hanging.

Closes #5462 #5517

### Before

These all produces hanging because reading stdin is not implemented in
readline backend:
```xsh
echo whoami | TERM=dumb xonsh -i --no-rc   # dumb is readline in fact
# or the same
echo whoami | xonsh -st dumb -i  # dumb is readline in fact
# or the same
echo whoami | xonsh -st readline -i
```

### After

Switching to prompt_toolkit in these cases.

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

---------

Co-authored-by: a <1@1.1>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-25 21:34:14 +05:30
a
584a84d645 news 2024-06-25 00:46:32 +02:00
a
1faca101ab fix 2024-06-24 21:46:09 +02:00
Andy Kipp
d351df384a
tests: SpecAttrModifierAlias: integration test (#5533)
Added test.

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

---------

Co-authored-by: a <1@1.1>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-24 15:12:23 -04:00
Andy Kipp
3e41a744d4
sqlite3: optional loading (#5534)
After testing xonsh on ALT linux
(https://github.com/xonsh/xonsh/issues/5517#issuecomment-2187069017) I
see that we need to make sqlite3 loading optional.

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

---------

Co-authored-by: a <1@1.1>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-24 15:11:55 -04:00
Andy Kipp
934351254a
docs: SpecModifierAlias to the tutorial (#5518)
Added SpecModifierAlias (#5443) to the tutorial.

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

---------

Co-authored-by: a <1@1.1>
2024-06-24 14:28:39 -04:00
pre-commit-ci[bot]
105942d4d4
[pre-commit.ci] pre-commit autoupdate (#5535)
<!--pre-commit.ci start-->
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.9 →
v0.4.10](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.9...v0.4.10)
<!--pre-commit.ci end-->

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-24 20:14:39 +02:00
Andy Kipp
9f0bf03753
xonsh.lib: minor docstring (#5529)
Closes #2726. Self merge minor doc.

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

---------

Co-authored-by: a <1@1.1>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-23 03:16:52 +02:00
Andy Kipp
c3e1bd106f
Micro update README.rst (#5528)
Change the moto like in other places. Self merge.

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**
2024-06-22 22:53:50 +02:00
Andy Kipp
93e493afd0
Update AppImage README.rst (#5523)
<!---

Thanks for opening a PR on xonsh!

Please do this:

1. Include a news file with your PR
(https://xon.sh/devguide.html#changelog).
2. Add the documentation for your feature into `/docs`.
3. Add the example of usage or before-after behavior.
4. Mention the issue that this PR is addressing e.g. `#1234`.

-->

Minor, self merge

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**
2024-06-21 10:33:21 +02:00
Andy Kipp
295e7f0582
xonshrc: add docs and tests for py files (#5515)
* Added py mention to docs
* Added tests
* Microfix

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

---------

Co-authored-by: a <1@1.1>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-20 14:02:48 +00:00
Andy Kipp
60db3e6138
fix main page (#5514)
* fix section
* added link to latest release

Please update https://xon.sh after merge this.

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

Co-authored-by: a <1@1.1>
2024-06-20 09:37:50 -04:00
lunrenyi
80d68f583b
Update README.rst (#5513)
Add x-cmd to the projects-that-use-xonsh-or-compatible list

x-cmd is a toolset implemented using posix shell and awk. It is very
small in size and offers many interesting features. Here is a milestone
demo: https://www.x-cmd.com/mod/onsh

<!---

Thanks for opening a PR on xonsh!

Please do this:

1. Include a news file with your PR
(https://xon.sh/devguide.html#changelog).
2. Add the documentation for your feature into `/docs`.
3. Add the example of usage or before-after behavior.
4. Mention the issue that this PR is addressing e.g. `#1234`.

-->

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-18 18:15:49 +02:00
Gil Forsyth
5332d75505 Updated CHANGELOG for 0.17.0 2024-06-18 08:47:50 -04:00
Gil Forsyth
fe8448c2c1 bumped version to 0.17.0 2024-06-18 08:47:50 -04:00
Gil Forsyth
9901bc442a Updated authorship for 0.17.0 2024-06-18 08:47:50 -04:00
Andy Kipp
4e12834e84
spec: added raise_subproc_error (#5494)
### Motivation

Add `spec.raise_subproc_error` to have an ability to use
`SpecModifierAlias` to manage the errors. Also this is the first step to
#4351.

Generally in scripts it's good to have RAISE_SUBPROC_ERROR=True to avoid
processing the error for every executed command. But in some cases (e.g.
`![]`) it's needed to avoid raising the error. To more elegant doing
this we can make an ability to create SpecModifier.

### After

```xsh
from xonsh.procs.specs import SpecModifierAlias
class SpecModifierNoErrAlias(SpecModifierAlias):
    def on_modifer_added(self, spec):
        spec.raise_subproc_error = False
aliases['noraise'] = SpecModifierNoErrAlias()

$RAISE_SUBPROC_ERROR = True

if ![noraise git pull]:
    git add --all
```

Cc #5443 

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

---------

Co-authored-by: a <1@1.1>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-18 08:43:10 -04:00
pre-commit-ci[bot]
6b9f6ba0e1
[pre-commit.ci] pre-commit autoupdate (#5510)
<!--pre-commit.ci start-->
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.8 →
v0.4.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.8...v0.4.9)
<!--pre-commit.ci end-->

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-17 20:44:50 +02:00
Andy Kipp
09a89bf9b4
docs: install xonsh as a core shell (#5504)
### Motivation

I'm using [xonsh-install](https://github.com/anki-code/xonsh-install)
pretty long time and I see that it works pretty predictable, expected
and stable. I suggest to mention this approach in our docs to get more
attention and testing around this from users and some day move
xonsh-install to the xonsh project.

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

---------

Co-authored-by: a <1@1.1>
Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-17 13:17:10 -04:00
Andy Kipp
09bdfaee00
coreutils which: fix none matching (#5508)
After #5379 #5432 we need to check None.

Closes https://github.com/anki-code/xontrib-argcomplete/issues/10

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

Co-authored-by: a <1@1.1>
2024-06-17 12:55:54 +02:00
a
de50a09a6c Merge remote-tracking branch 'origin/main' 2024-06-15 22:14:32 +02:00
Andy Kipp
d30d0a5446
docs: more links to xonshrc article (#5505)
After #5099 #5491 we need more links to xonshrc article in our docs. So
I've added them.

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

---------

Co-authored-by: a <1@1.1>
2024-06-15 18:32:32 +02:00
Andy Kipp
f9d2842fb1
docs: move section "Use the Nix Package manager with Xonsh" from rc to platform tips and tricks (#5503)
<!---

Thanks for opening a PR on xonsh!

Please do this:

1. Include a news file with your PR
(https://xon.sh/devguide.html#changelog).
2. Add the documentation for your feature into `/docs`.
3. Add the example of usage or before-after behavior.
4. Mention the issue that this PR is addressing e.g. `#1234`.

-->

subj

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

---------

Co-authored-by: a <1@1.1>
2024-06-15 18:31:50 +02:00
Andy Kipp
40f5eea840
devguide: fix knight vs snail pic (#5502)
### Before

<img width="762" alt="image"
src="https://github.com/xonsh/xonsh/assets/1708680/21b3620c-cbf3-489d-b5c7-0f8d92cdfb01">


### After

<img width="760" alt="image"
src="https://github.com/xonsh/xonsh/assets/1708680/4f61b77b-8e99-4372-9aac-1d13a6ee8e1f">


## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

Co-authored-by: a <1@1.1>
2024-06-15 09:28:00 +02:00