Commit graph

174 commits

Author SHA1 Message Date
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
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
Tim Gates
37f6adb159
docs: Fix a few typos (#4889)
There are small typos in:
- docs/python_virtual_environments.rst
- setup.py
- xonsh/procs/specs.py
- xontrib/abbrevs.py

Fixes:
- Should read `interpreter` rather than `intrepreter`.
- Should read `dictionary` rather than `disctionary`.
- Should read `descriptors` rather than `descriptiors`.
- Should read `because` rather than `becuase`.

Signed-off-by: Tim Gates <tim.gates@iress.com>
2022-07-23 04:42:46 +05:30
Gil Forsyth
013fa760a0
refactor(amalgamate): remove amalgamation (#4858)
Co-authored-by: Noorhteen Raja NJ <jnoortheen@gmail.com>
2022-07-04 10:40:16 +05:30
Noorhteen Raja NJ
ed4421ddf4
pr5-pep621 (#4803) 2022-05-10 11:39:43 -04:00
Noorhteen Raja NJ
73a880f76a
chore: drop py3.7 (#4770) 2022-04-26 09:00:31 -04:00
Daniel Shimon
dfa713c6fc virtualenv: Add activator plugin
Code from https://github.com/pypa/virtualenv/pull/2040
2022-03-26 17:43:51 +05:30
Noortheen Raja
72fd026c52 chore: update dist package 2022-03-24 19:49:30 +05:30
Noortheen Raja
48086a5778 feat: move fixtures to pytest-plugin 2022-03-24 19:49:30 +05:30
ylmrx
8e1a1f3342
fix: ptk now support modal cursor shape, use it when vi_mode is enabled (#4695)
* fix: ptk now support modal cursor shape, use it when vi_mode is enabled

* lint: use double-quotes

* bump ptk dependency in setup and integration

* lint: sorting imports
2022-03-05 15:45:32 +05:30
Noorhteen Raja NJ
039294c362
Xompletions (#4521)
* feat: add command completers logic

* feat: implement xompleter logic

* fix: handle callable object in exception

* chore: add xompletions package to setup.py

* fix: update tests for changes to command completer logic

* docs:

* fix: qa errors

fixes #4514

* feat: add xonsh completions

* refactor: split module matcher to separate class

* feat: add django-admin completions

* fix: failing tests

* feat: add more properties to completion-context

* refactor: cleanup code

* todo item add
2022-01-10 11:21:22 -05:00
Hierosme
343ea33998
Add uname command, Update uptime comand (#3909)
* Add uname support

* Changelog addition

* Migration to platform module

* Update uptime.py for the last version
Merge the original uptime module to a single file
Change the bootime() return be stay compatible with xonsh
Add support for Haiku , suppose to close #3882
Add dependency from uptime to support to MacOS 10.10 by add _posix.c file.

* Update uptime.py for the last version
Merge the original uptime module to a single file
Change the bootime() return be stay compatible with xonsh
Add support for Haiku , suppose to close #3882
Add dependency from uptime to support to MacOS 10.10 by add _posix.c file.

* typo fix

* black reformat

* remove usage of print

* black is black

* add original test for uptime
convert original test via 2to3
black reformat tests

* strange syntaxe fixe for flaske8

* black the incredible tool it stop a bug fixe just because it THE tool it want a return for make less readable code

* flake8 the famous tool it permit to stop a big fixe without any information's about the trouble

* workaround about xonsh CI don't respect docstring specs

* RISC OS only comment thing

* black is a good jock in a CI

* black is a good jock in a CI

* roll back uptime.py

* look if we can make it work

* fixe all i understand

* add command in corutils alias

* reformat uptime.py with black

* fixe version

* try with xonsh xp.LIBC lib

* black in a CI is a stupid thing

* stupid Windows and it \r

* use os.linestep

* use newline simple wrapper

* use newline simple wrapper

* use newline simple wrapper

* use newline simple wrapper

* try osx rollback method

* fixe

* fixe

* a test on window via the CI because i haven't the OS

* a test on window via the CI because i haven't the OS

* a test on window via the CI because i haven't the OS

* fix: black: format

* refactor: update uname command

now has auto-completions

* docs: update news item and fix qa error

* refactor: remove unused file

* fix: qa imports

* refactor: update getting boottime

fallback to monotonic time on unix

* fix: update haiku compatibility in uptime

* refactor: add uptime to aliases

* refactor: move xoreutils tests

* fix: call aliases using xonsh

Co-authored-by: Tuux <tuxa@rtnp.org>
Co-authored-by: Noortheen Raja <jnoortheen@gmail.com>
2022-01-08 18:28:46 +05:30
Noorhteen Raja NJ
c2d25ac251
pre-commit hook for pyupgrade (#4583)
* chore: add pyupgrade

* refactor: upgrade code to py3.7+

ran `pre-commit run pyupgrade -a` while excluding changes to ply

* fix: flake errors
2021-12-06 14:42:26 -05:00
Noorhteen Raja NJ
9a8cc74c4b
refactor: remove xonsh.ptk2 module (#4570) 2021-11-30 08:22:31 -05:00
Noorhteen Raja NJ
adafa20b88
adopt NEP-0029 (#4568)
* chore: adopt NEP-0029 for py version deprecation policy

fixes #4560

* chore: drop py3.6 from CI

* docs: add news item

* fix: failing qa because latest version to flake8-bugbear

see https://github.com/PyCQA/flake8-bugbear/issues/208

* chore: require >=py3.7
2021-11-29 12:48:48 -05:00
Samuel Dion-Girardeau
8c228ef061
Improve setup metadata (#4458)
* Add relevant Trove classifiers

From full list: https://pypi.org/classifiers/

* Add all project URLs

* Add keywords

Copied from the repo's tags, minus "hacktoberfest"

* Add news entry for the change

* Use more explicit key for repo URL
2021-09-05 10:45:00 +03:00
Daniel Shimon
daa27337dd
Amalgamated release (#4355)
* pip: Ensure the release version of xonsh is amalgamated

It will be amalgamated regardless of whether amalgamate.py is installed

* manifest: Remove non-existent PLY files

* pip: Add completion parser table

* amalgam: Update init files
2021-07-05 20:59:44 +03:00
Noorhteen Raja NJ
a52c364569
refactor: remove unused argument to parser (#4344) 2021-07-01 15:17:45 +03:00
Daniel Shimon
7f8aeefae8
tests: Run tests with the amalgamated xonsh (#4290)
* tests: Run tests with the amalgamated xonsh

* tests: Test xonsh loads correctly interactively

* tests: Ensure tests run from amalgamated xonsh

* environ: Separate $XONSH_DEBUG and $XONSH_NO_AMALGAMATE

* tests: Keep XONSH_NO_AMALGAMATE in a comment for ease of debugging

* tests: Fix monkeypatch for amalgamated code
2021-05-28 15:42:37 +03:00
Daniel Shimon
224fc55e41
Completion context (#4017)
* completion-context: Add CompletionContextParser placeholder

Implements the xonsh (tab-)completion context parser.
This parser is meant to parse a (possibly incomplete) command line.

* completers: tools: Implement ``contextual_completer`` decorator

This is used to mark completers that want to use the parsed completion context.

* completers: Enable using contextual completers in xonsh/completer.py

* completers: readline, ptk, jupyter: Enable using contextual completers

Pass ``multiline_text`` and ``cursor_index`` to ``Completer.complete()``

* parsers: base: Refactor out a ``raise_parse_error`` function

* tokenize: Enable ``tolerant`` mode

If ``tolerant`` is True, yield ERRORTOKEN instead of
    throwing an exception when encountering an error.

* lexer: Enable ``tolerant`` mode

Tokenize without extra checks (e.g. paren matching).
When True, ERRORTOKEN contains the erroneous string instead of an error msg.

* tests: lexer: Test ``tolerant`` mode

* completion-context: Implement simple CommandContext parsing

* completion-context: tests: Test simple CommandContext parsing

* completion-context: Implement parsing sub-commands

* completion-context: tests: Test parsing sub-commands

* completion-context: Add news file

* completion-context: parser: Add parser table path to relevant locations

Code-coverage, mypy ignore list, etc.

* completion-context: Implement parsing partial strings and line continuations

* completion-context: tests: Test parsing partial strings and line continuations

* completion-context: Convert ``Span`` object to a ``slice``

* completion-context: Refactor out ``create_command`` and ``cursor_in_span``

* completion-context: Implement handling empty commands

* completion-context: tests: Test handling empty commands

* completion-context: Implement handling multiple commands

Separated by newlines, `;`, `and`, `or`, `|`, `&&`, `||`

* completion-context: tests: Test handling multiple commands

Separated by newlines, `;`, `and`, `or`, `|`, `&&`, `||`

* completion-context: Implement handling python context

* completion-context: tests: Test handling python context

* completers: tools: Add `contextual_command_completer`

* completers: Make `complete_skipper` contextual

* completers: Make `complete_from_man` contextual

* completers: Make `complete_from_bash` contextual and add test

* completers: Make `complete_pip` contextual and update tests

* completers: Keep opening string quote if it exists

* completion-context: Handle cursor after a closing quote

For example - cursor at the end of ``ls "/usr/"``.
1. The closing quote will be appended to all completions.
 I.e the completion ``/usr/bin`` will turn into ``/usr/bin"``
2. If not specified, lprefix will cover the closing prefix.
 I.e for ``ls "/usr/"``, the default lprefix will be 6 to include the closing quote.

* completion-context: tests: Test handling cursor after a closing quote

* completion-context: Fix bug with multiple empty commands

e.g. `;;;`

* completion-context: tests: Speed up tests

From ~15 seconds to ~500 ms

* completion-context: Expand commands and subcommands

* completion-context: Simplify `commands` rules

* completion-context: Simplify `sub_expression` rules

* completion-context: Simplify editing a multi-command token

* completion-context: Inline `create_command`

* completion-context: Implement `contextual_command_completer_for` helper

* completers: Make `complete_cd`/`complete_rmdir` contextual and add tests

* completers: path: Don't append a double-backslash in a raw string

When completing a path, if a raw string is used (e.g. `r"C:\Windows\"`),
there's no reason to append a double-backslash (e.g. `r"C:\Windows\\"`).

* completers: Make `complete_xonfig`/`complete_xontrib` contextual and add tests

* completers: Make `complete_completer` contextual and add tests

* completers: Make `complete_import` contextual and add tests

* completion-context: Add python `ctx` attribute

* completion: tools: Simplify `RichCompletion` attributes handling

* completers: Make `base`, `python`, and `commands` contextual

* Add tests
* No need for `python_mode` completer anymore

* completion: tools: Add `append_space` attribute to `RichCompletion`

* completion-context: Get all lines in a main python context

* xontrib: jedi: Make the `jedi` completer contextual

* completers: tools: Remove `get_ptk_completer` and `PromptToolkitCompleter.current_document`

These aren't needed anymore now that contextual completers can access the multiline code (via `PythonContext.multiline_code`).

* completion-context: ptk: Expand aliases

* completion-context: jupyter: Expand aliases and fix line handling

* completer: Preserve custom prefix after closing quote

* completers: bash: Ensure bash completion uses the complete prefix

* completers: pip: Append a space after a pip command

* completers: pip: Prevent bad package name completions

* completers: Remove a common prefix from `RichCompletion` if `display` wasn't provided

* completion-context: Treat cursor at edge of `&& || | ;` as normal args

This will be used for completing a space

* completers: Complete end proc keywords correctly
2021-03-30 13:37:56 -04:00
Gil Forsyth
9bb91a0b4b
Cleanup remaining vended ptk bits (#4130) 2021-03-01 16:55:23 -05:00
Noorhteen Raja NJ
d44a352e0b
fix: update setup.py table generation function (#4044)
* fix: update setup.py table generation function

so that will work with relative paths
- update extras-requirement full
- remove invalid link

fixes #4039

* Update setup.py
2021-01-05 09:58:02 -05:00
Noortheen Raja
5b6ea6c993 feat: use PyperClipboard if available for ptk
closes #3989
2020-11-26 09:28:06 +05:30
Anthony Scopatz
3afd5430a0
Procs Initial Refactor (#3897)
* refectored builtins

* refectored posix and readers

* refectored posix and readers

* proxies

* pipelines

* basic procs import cleanup

* fixed / refactored tests

* procs docs

* amalgamate

* XONSH_DEBUG=1 in tests

* exclude xonsh.procs mypy

* Use `pip install` instead of `python setup.py install`

* Update docs/api/procs/pipelines.rst

Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>

Co-authored-by: Gil Forsyth <gil@forsyth.dev>
Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>
2020-10-20 10:21:11 -04:00
Jerzy Drozdz
bc924816a8 Updated prompt-toolkit version requirement 2020-10-19 14:29:17 +02:00
Bob Hyman
bed0011673 Move jup kernel spec from setup to xonfig; add doc. 2020-09-13 15:37:44 -04:00
Bob Hyman
f1d703d096 Merge branch 'master' into is_3622 2020-08-24 05:28:34 -04:00
Bob Hyman
9cd3f4bf18 Setup add [full] extras tag 2020-08-18 22:46:04 -04:00
Anthony Scopatz
7d1a7ea9cb fixed pip install && setup.py sdist to include generated files 2020-08-16 13:03:57 -05:00
Morten Enemark Lund
441c0a0c0a Fix vended prompt_toolkit packages not beeing installed with pip 2020-08-12 14:56:26 +02:00
Anthony Scopatz
377ab8d9de
Merge pull request #3662 from bobhy/is_3661
drop dependence on py.exe on Windows
2020-08-11 20:12:01 -04:00
Bob Hyman
224c555afe Document preference for pip install over setup.py. 2020-08-11 12:25:17 -04:00
Morten Enemark Lund
d855431f5e Exclude wcwidth from flake8/black tests 2020-08-10 12:43:25 +02:00
Bob Hyman
2f439fef21 install via pip install for best perf. 2020-08-09 23:05:21 -04:00
Bob Hyman
91f1962d28 Enable xonsh-cat for invocation directly from OS shell. 2020-08-08 02:33:07 -04:00
Bob Hyman
989db694a3 Use setuputils generated console scripts for xonsh and xonsh-cat 2020-08-08 00:53:44 -04:00
Morten Enemark Lund
6dcf619c01 Add vended ptk to pakages setup.py 2020-08-06 10:08:13 +02:00
Matthias Bussonnier
784c5286ef
Remove most of Python 3.5 compatibility code. (#3654)
There  now should not be any remaining  3,5 conditinal code.
We now directly use inspect's getouterframes, so remove it from
inspector

The 3.5 parser get merged into 3.6 and a number of global vaiable
referring to 3.5/3.6 are now gone.

The only remaining mention is appveyor test, which are anyway failing
but not being seen as so by GitHub, so I'll leave them alone.
2020-08-05 10:29:31 -04:00
Jason R. Coombs
f67c6e83ec Remove distutils fallback. Fixes #3638.
Also remove Python 2 compatibility imports.
2020-07-29 15:53:13 -04:00
Bob Hyman
53bfe8c99c
Add ptk3 (#3521)
* delete package ptk; rename ptk2 to ptk_shell.; leave ptk2 as alias for ptk_shell.
* SHELL_TYPE "prompt_toolkit" only; remove ptk1 specific behavior.
* Doc updates: eliminate reference to prompt-toolkit < 2.0
* update requirements files ptk>=2; test shell_style="none"
* fix ptk2 stub per code review
* Add ptk2 to list of packages to install.
2020-04-18 10:44:27 -04:00
Anthony Scopatz
9a3f0e5cb5 config interface improvement 2019-10-23 17:20:10 -04:00
Anthony Scopatz
6496c52336 some housekeeping for webconfig 2019-10-15 22:13:51 -04:00
Morten Enemark Lund
46cdf40b9b Remvoe win_unicode_console support
The new Windows terminal solves the problem
of unicode on windows much better
2019-10-07 22:21:13 +02:00
Jamie Bliss
83619d1745 Rewrite xontrib json stuff to be zipapp friendly 2019-06-17 14:46:28 -04:00
Anthony Scopatz
f1127ed916 Revert "updated setup.py for Python 3.4 (revert of 91ec14bb6d)"
This reverts commit 002a317951.
2019-05-14 17:41:35 -04:00
Anthony Scopatz
002a317951 updated setup.py for Python 3.4 (revert of 91ec14bb6d) 2019-05-14 17:32:31 -04:00
Anthony Scopatz
3e05159ba6 python_requires 2019-05-10 18:47:34 -04:00
Rodrigo Oliveira
91ec14bb6d Drop support for Python 3.4
Minimal required Python version is now 3.5.
2019-05-06 16:51:32 -03:00
Anthony Scopatz
94c09014ec version quotes 2018-08-30 09:25:36 -05:00
Anthony Scopatz
0557eecee0 black: the only color you need 2018-08-30 09:17:34 -05:00