Commit graph

10727 commits

Author SHA1 Message Date
pre-commit-ci[bot]
2c826c9b75
[pre-commit.ci] pre-commit autoupdate (#5584)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.5.0 → v0.5.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.5.0...v0.5.1)

* [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>
2024-07-08 20:29:00 +02:00
Andy Kipp
31ee913eb7
Update logo.txt: fix char to @ 2024-07-07 18:56:49 +02:00
Andy Kipp
7c2f0f404b
Update README.rst 2024-07-06 01:28:49 +02:00
Andy Kipp
1653faaeee
refactoring: tests for case when env var is class with repr. (#5583)
* tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

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-05 23:23:36 +02:00
Andy Kipp
01dc8858e6
Update site: update text (#5578)
* Update index.html: update moto

* docs

* Update index.html

* docs

* Update index.html

* docs
2024-07-04 21:31:59 +02:00
Andy Kipp
3957367644
Update xonsh-landing-preview.png (#5577)
* Delete xonsh-landing-preview.png

* Rename xonsh_landing_preview2.png to xonsh_landing_preview.png
2024-07-04 21:13:43 +02:00
Andy Kipp
36c4000a43
Add files via upload 2024-07-04 21:11:08 +02:00
Andy Kipp
0656eb3d3e
refactoring: deprecation warnings and revert shell moving for backwards compatibility (#5575)
* deprecation warnings

* deprecation warnings

* deprecation warnings

* restore shell

* restore shell

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

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-04 17:24:04 +02:00
a
8e5f460376 Solve a high priority issue 2024-07-04 16:48:01 +02:00
Andy Kipp
6fd8937ee5
aliases: Added ability to set multiple spec modifiers (#5574)
* wip

* test

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* test

---------

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-04 16:10:02 +02:00
Andy Kipp
b3439ad390
xonfig: conch (#5499)
* conch conch conch

* more conch

* fix

---------

Co-authored-by: a <1@1.1>
2024-07-04 16:06:03 +02:00
Andy Kipp
2552ef1727
docs: update comparision (#5509)
wip

Co-authored-by: a <1@1.1>
2024-07-04 16:05:45 +02:00
Andy Kipp
b6d8d3d823
refactoring: fix deprecated sys.last (#5573)
* fix deprecated

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix deprecated

* fix deprecated

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix deprecated

* fix deprecated

---------

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-04 11:04:15 +02:00
Niraj Kulkarni
4e06328bec
Rewrited deprecated in print_exception (#5407)
* Change deprecated sys variable assignment in print_exception

* Add changelog in news/print_exception_fix.rst
2024-07-04 10:37:55 +02:00
Andy Kipp
b1ffb11f27
refactoring: do not load user rc in tests (#5572)
wip

Co-authored-by: a <1@1.1>
2024-07-03 21:20:36 +02:00
Andy Kipp
40be260cb0
refactoring: restore parser to backwards compatibility after refactoring (#5571)
Restore parser location after movings in #5552 for backwards
compatibility.

## 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-03 10:33:17 +02:00
Andy Kipp
c638fbbc71
refactoring: fix test_main on mac (#5570)
<!---

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>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-07-03 08:10:03 +02:00
Andy Kipp
61a77ac3ce
Callable alias: fixed capturing stdout in case of redirect (#5527)
### Motivation

Closes #5512. 
The issue was introduced in #4445. It's needed to add checking the
redirect case.

### Before

```xsh
cd /tmp
@aliases.register('a')
def _a():
    print("1-hello")
    echo 2-hello
a > o.txt
# 2-hello
cat o.txt
# 1-hello
```

### After

```xsh
cd /tmp
@aliases.register('a')
def _a():
    print("1-hello")
    echo 2-hello
a > o.txt
cat o.txt
# 1-hello
# 2-hello
```

## 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-02 09:30:06 +02:00
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