Commit graph

69 commits

Author SHA1 Message Date
Noortheen Raja
aa857e8260 refactor: update line length to default setting
and ruff-format
2024-04-16 11:23:35 -04:00
Noortheen Raja
b3d58e6ff2 chore: remove unused flake8 config 2024-04-16 11:23:35 -04:00
Andy Kipp
4819005ce0
cleaning (#5094) 2023-03-17 13:25:38 +05:30
Andy Kipp
042487745a
Moving old xontribs to repositories (#5055)
* Update and rename README to README.rst

* Create hello_world.py

* Update README.rst

* init

* remove bashisms

* Transfer abbrevs to xontrib-abbrevs

* Transfer free-cwd to xontrib-free-cwd

* news

* black

* Transfer fish-completer to xonsh/xontrib-fish-completer

* Transfer vox to xonsh/xontrib-vox

* Transfer pdb, xog to xonsh/xontrib-debug-tools

* remove hello_world

* fix tests

* black

* fix whitespaces

* fix readme

* Update python_virtual_environments.rst

* Update README.rst

* Update xontribs_transfer.rst

---------

Co-authored-by: a <1@1.1>
2023-03-17 13:25:22 +06:00
Noorhteen Raja NJ
2d29b04a4a fix: mypy errors since v0.991 2022-12-20 10:25:28 +05:30
Noorhteen Raja NJ
bb183244a9 chore: update flake8 config which fails with flake8-v6 2022-12-20 10:25:28 +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
cbf23e60fb
Pre commit ci (#4863) 2022-07-01 11:47:01 -04:00
Noorhteen Raja NJ
a00b6014fe
chore: type check xontribs,xompletions (#4642)
as well as match dmypy semantics
2022-01-18 09:54:31 -05:00
Noorhteen Raja NJ
71f2258c57
test: update test configs (#4603) 2021-12-23 06:31:26 +05:30
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
Noorhteen Raja NJ
4b0918f9e3
fix: failing ci checks with black and mypy (#4517)
pip21.3 has changed the behaviour of build - https://pip.pypa.io/en/stable/news/#v21-3 to use in-tree-build by default. this creates amalgamated files.

this will install as editable dependency during qa checks

for some reason mypy exclude for __amalgam__.py is not working
2021-10-14 17:01:44 -04:00
Noorhteen Raja NJ
50a1c92004
chore: enable flake8 for tests (#4482) 2021-09-26 11:32:24 -04:00
Noorhteen Raja NJ
f3d314bc36
chore: move news items check to qa (#4314)
fixes #4313
2021-06-11 15:01:35 +03:00
Noorhteen Raja NJ
948129b7a0
feat: add flake8-bugbear (#4288)
* feat: add flake8-bugbear

* style: remove pylint disable comments

* chore: add flake8 as pre-push check

* chore: add bunch pf pre-commit hooks

* style: remove hasattr __call__
2021-05-26 23:15:34 +03:00
Noorhteen Raja NJ
38295a1dd9
Remove globals (#4280)
* refactor: remove usage of global variables in abbrevs.py

* chore: add flake8-mutable to prevent mutable defaults

* fix: abbrevs expand test

* refactor: add xonsh session singleton

* refactor: fix circular errors when using xonshSession as singleton

* refactor: remove black magicked builtin attributes

* style: black format tests as well

* refactor: update tests to use xonsh-session singleton

* refactor: update abbrevs to not use builtins

* test: remove DummyCommandsCache and patch orig class

* fix: failing test_command_completers

* test: use monkeypatch to update xession fixture

* fix: failing test_pipelines

* fix: failing test_main

* chore: run test suit as single invocation

* test: fix tests/test_xonsh.xsh

* refactor: remove builtins from docs/conf.py

* fix: mypy error in jobs

* fix: test error from test_main

* test: close xession error in test_command_completers

* chore: use pytest-cov for reporting coverage

this will include subprocess calls, and will increase coverage

* style:
2021-05-20 13:14:26 +03:00
Noorhteen Raja NJ
4dc08232e6
Fix commands cache testing (#4257)
* fix: update failing commands-cache tests

in some cases, the thread updates the binaries faster than the next call

* chore: upgrade black to 21.5b0

* chore: upgrade mypy to 0.812 version

* fix: handle corrupt commands-cache file

* fix: parser-table output dir. this should be same as the defaults

* fix: flake8 error
2021-05-06 09:54:09 -04: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
80aca856e4
refactor: convert prompt_ret_code to be a py file (#4032)
to take advantage of flake/coverage
2021-01-12 13:35:38 -05:00
Noortheen Raja
0c2c8d1061 chore: update test runner to not show traceback if tests fail 2020-11-10 11:07:40 +05:30
Noortheen Raja
8c88030d6b refactor: some backlog from when flake8 setup 2020-11-08 23:31:10 +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
Noorhteen Raja NJ
fd597e6971
chore (ci): improve ci workflows and deps management (#3873)
* chore (ci): improve elm job speed by caching

* chore (ci): update ci generator script to be run from any dir

* chore: update pre-commit to use local black binary

* chore: mypy config skip amalgam generated modules

* chore: run-tests.xsh parameterisation

use argparser to make this file a cli

* feat: use requirements.txt during CI

* feat: run black/flake8/mypy during ci from pip-env

* chore: mypy version 0.790 fix

since the loose pinning on mypy version causes new PRs to fail

* refactor: update github actions template

remove poetry/environment.yml files
2020-10-19 11:52:37 -04:00
Noortheen Raja
197251e818 fix: during amalgamate it removes type-ignore comments 2020-10-09 20:19:09 +05:30
Noortheen Raja
68e723917b chore: update mypy config for different platforms 2020-10-09 20:19:09 +05:30
Noortheen Raja
609e9304e9 feat: add mypy to project 2020-10-09 20:19:09 +05:30
Noortheen Raja
64efb3b3df feat: integrate flake8-docstring
most of the rules are disabled since it will take longer to fix them all

maybe in future version we can fix them one by one
2020-09-30 16:07:58 +05:30
Bob Hyman
409bea12bd First round doc update getting started. 2020-08-19 04:20:05 -04: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
Morten Enemark Lund
d855431f5e Exclude wcwidth from flake8/black tests 2020-08-10 12:43:25 +02:00
Morten Enemark Lund
1acfeb771f Merge remote-tracking branch 'remotes/origin/master' into vend_ptk 2020-08-10 11:22:57 +02:00
Bob Hyman
c22e80b717 Fix test dependency on xonsh.bat (and xon.sh) 2020-08-10 00:42:36 -04:00
Anthony Scopatz
c3c58efb5e other flake skips 2020-08-09 15:08:56 -05:00
Morten Enemark Lund
df55eab0b4 Exclude veded ptk from black and flake8 checks 2020-08-06 10:06:23 +02:00
Bob Hyman
c03178de17 Merge branch 'flake8_in_CI' of https://github.com/bobhy/xonsh into flake8_in_CI 2020-05-09 10:34:40 -04:00
Bob Hyman
29644e404d Test that flake8 error actually fails CI 2020-05-09 10:24:28 -04:00
Bob Hyman
910fb42f78 Test that flake8 error actually fails CI; don't show stacktrace for flake8 failure 2020-05-09 09:29:04 -04:00
Bob Hyman
a6bb5e2d56 Run (pure) flake8 in CI; deprecate config for pytest-flake8 2020-05-06 22:49:11 -04:00
Bob Hyman
26475146e2
Flake8 1 (#3550)
* flake8 fixes -- tests only

* fix ci failure

* integrate fix from is_3551 so tests will pass.

* Update tests/test_builtins.py

Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>
2020-05-05 06:42:28 -04:00
Bob Hyman
94ac8f67f5
black-fix - split from ls_color for separate review (#3431)
* black-fix - split from ls_color for separate review
2020-02-14 09:09:34 -05:00
Anthony Scopatz
b494de1541 E203 whitespace before ':' 2018-08-30 23:06:30 -05:00
Morten Enemark Lund
e11fa92d63 pep8 2018-08-21 14:30:22 +02:00
Anthony Scopatz
d6dd55502f some more flake fixes 2018-08-02 23:27:12 -04:00
Morten Enemark Lund
2e064dd630 Alternative way to exclude pygments_cache from flake8 2018-07-21 22:19:25 +02:00
Gil Forsyth
54585a9a77 Update pytest syntax in setup.cfg
This warning has been popping up for ages, so I've finally made the
change.  Time to see what else breaks.
2018-07-20 13:47:15 -04:00
Anthony Scopatz
f67f405c70 fix linting 2018-06-17 12:23:18 -04:00
Anthony Scopatz
060d4acb75 exclude external projects 2018-06-03 18:00:42 -04:00
Gil Forsyth
aafa7ae3d9 Add exceptions to ignore flake8 errors for 3.6
These should be fixed, but outside of the scope of this.
2018-03-12 12:09:58 -04:00
Gil Forsyth
4efc8e36a3 ignore F821 in style_tools 2017-01-27 11:19:33 -05:00