Commit graph

10741 commits

Author SHA1 Message Date
Andy Kipp
d08248f6aa
builtin: added `__xonsh__.imp` to have an ability to import and use modules immediately in one line (#5595)
* imp

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

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

* imp

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

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

* imp

* [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-12 02:21:21 +02:00
Andy Kipp
87032f6d30
Alias that returns modified command (#5473)
* Command Alias

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

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

* tests

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

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

* tests

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

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

* news

* docs

* tests

* docs

* wip

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

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

* tests

* tests

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

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

* tests

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

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

* tests

* tests

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

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

* tests

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

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

* tests

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

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

* tests

* tests

* clean

* news

* news

* bumptests

* bumptests

* new api

* tests

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

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

* doooocs

* comments

* comments

* comments

* aliases.CUT_ARGS

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

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

* aliases.CUT_ARGS

* aliases.CUT_ARGS

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

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

* aliases.CUT_ARGS

* aliases.CUT_ARGS

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

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

* aliases.CUT_ARGS

* comments

* bump test

* remove CUT_ARGS

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

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

* test

* test

* wip

* revert

* wip

* wip

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

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

* wip

* docs

* news

* tests

* tests

* test

* test

* test

* Update docs/tutorial.rst

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>

* Update xonsh/aliases.py

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>

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

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

* fix, thanks jaraco!

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

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

* more comments

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

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

* cleaning

---------

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: Jason R. Coombs <jaraco@jaraco.com>
2024-07-12 01:35:20 +02:00
Andy Kipp
24fcbb4638
fix link 2024-07-12 00:39:28 +02:00
Andy Kipp
bea8e3a300
Added lix to projects 2024-07-12 00:39:04 +02:00
Andy Kipp
645c335fc6
builtins: add color to printx (#5588)
* color

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

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

* Update xonsh/tools.py

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>

---------

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: Jason R. Coombs <jaraco@jaraco.com>
2024-07-11 13:29:35 +02:00
Jason R. Coombs
247ecba38a
Move note about last subprocess (#5592)
Move the note about the last subprocess and return code to the section on Running Commands.

When found only in the 'Captured Subprocess' section, it implies that the behavior is only available for captured subprocesses, when in fact it's available for any command. This bit could have gone into its own section, but since it's already carved out as a 'Note', it seems fine to put it here in the Running Commands section.

Closes #5591
2024-07-11 09:57:05 +05:30
Andy Kipp
2142a7b85e
tools: added `mkdir to xonsh.tools.chdir` (#5589)
* mkdir chdir

* mkdir chdir

* mkdir chdir

* mkdir chdir

* [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-10 22:49:57 +02:00
Andy Kipp
71e1f991d3
Update pyproject.toml: change email to zuilp channel. (#5590) 2024-07-10 16:43:37 +02:00
Andy Kipp
b998cd4603
Update pyproject.toml: update description. 2024-07-10 16:34:23 +02:00
a
7085a94fca Revert "color"
This reverts commit 729f55238e.
2024-07-10 14:03:54 +02:00
a
729f55238e color 2024-07-10 14:02:58 +02:00
Andy Kipp
86d3f9427e
xontrib: do not autoload xontribs in `xonsh --no-rc` mode (#5586)
* no rc no autoload

* docs

---------

Co-authored-by: a <1@1.1>
2024-07-09 17:21:20 +02:00
Andy Kipp
10a75ec8ac
Update README.rst 2024-07-09 10:45:56 +02:00
Andy Kipp
059fc301e7
Introduce new resolver for executables to replace commands_cache usages and speed up everything (#5544)
* remove commands_cache from pyghooks to avoid cc.update_cache on every key press

* create executables.py

* replace cc.locate_binary to locate_executable

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

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

* vc: replace locate_binary

* pyghooks: remove commands_cache

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

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

* remove unused func _yield_executables

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

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

* Move `executables_in` from tools to commands_cache to avoid circular imports.

* First steps to `procs.executables` that is based on `commands_cache` and `tools`.

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

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

* test_executables

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

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

* add not recommended notes

* tests

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

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

* Add `get_paths` with test

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

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

* Fix source test

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

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

* vc: remove tests because commands cache is not used

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

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

* specs: fix exception for recursive call

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

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

* specs: fix exception for recursive call

* improve test_locate_executable

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

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

* fix test

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

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

* fix test

* beautify pathext

* tests

* docs

* tests

* update locators

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

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

* locate_file

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

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

* comments

* return environ locate bin test

* comments

* Update xonsh/procs/executables.py

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>

* Update xonsh/procs/executables.py

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>

* Update xonsh/procs/executables.py

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>

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

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

* add itertools

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

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

* moving is_executable

* doc

* optimization is_executable_in_windows

* micro improvements

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

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

* news

* news

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

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

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

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

* bump test

* [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>
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2024-07-09 09:44:03 +02:00
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