Commit Graph

71 Commits

Author SHA1 Message Date
Alex Myers
48258ecb31 reckless: correct logging levels
Some output was hidden under normal operation which should
not have been.
2024-08-08 11:33:39 +09:30
Alex Myers
fe58c731ed reckless: escape strings in log 2024-08-08 11:33:39 +09:30
Alex Myers
9a7481b532 reckless: handle failure to find entrypoint cleanly 2024-08-08 11:33:39 +09:30
Alex Myers
dff7b50040 reckless: handle other --json cases without crashing 2024-08-08 11:33:39 +09:30
Alex Myers
efd67b36f0 reckless: handle unresolvable situations in a --json friendly way 2024-08-08 11:33:39 +09:30
Alex Myers
4aef72648c reckless: accept json array arguments as input
Changelog-Added: Reckless: accepts json array input for command targets
2024-08-08 11:33:39 +09:30
Alex Myers
1ac6e25ffd reckless: don't polute stdout with python install
status if --json was requested.
2024-08-08 11:33:39 +09:30
Alex Myers
bb47bc1d4a reckless: all command functions return objects to enable json out
This more easily allows list output for commands accepting list
input, i.e., installing 3 plugins produces 3 outputs.
2024-08-08 11:33:39 +09:30
Alex Myers
a2e458047f reckless: add json output option
Also redirect config creation prompts to stderr in order to not interfere
with json output on stdout.

Changelog-Added: reckless provides json output with option flag -j/--json
2024-08-08 11:33:39 +09:30
Alex Myers
75d8d8b91f reckless: add logger class
This will allow redirection of json output in the following commits.
2024-08-08 11:33:39 +09:30
Alex Myers
40c24065f7 reckless: make options flags position independent
Changelog-Changed: Reckless option flags are now position independent.
2024-08-08 11:33:39 +09:30
Alex Myers
0a6c58133d reckless: add version information to reckless 2024-08-08 11:33:39 +09:30
Alex Myers
9cbaafb525 reckless: add installer for rust plugins
This follows the same structure that enables python virtual environments:
  reckless/
    <plugin_name>/
      <symlink to compiled bin>
      source/
        <clone of original source plugin dir>/

Changelog-Added: Reckless: added the ability to install rust plugins.
2024-08-08 11:33:39 +09:30
Alex Myers
ed2c0ae18f reckless: place source code in source/plugin_name/
rather than just source/.  This is required for cargo install, so let's just
use this paradigm globally.
2024-08-08 11:33:39 +09:30
Alex Myers
c1d46d6ef9 reckless: add type hints for InstInfo 2024-08-08 11:33:39 +09:30
Alex Myers
7387c9cb1f reckless: remove mimetype
The python mimetype package wasn't useful enough in indentifying
filetypes anyhow.
2024-08-08 11:33:39 +09:30
Rusty Russell
fd9975c288 reckless: don't use time-based directories.
This always fails on my test machine, which runs many tests in parallel.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-06-24 21:12:43 +09:30
Alex Myers
5c475067b8 reckless: populate local submodules for searching
Git ls-tree does not report submodule contents which was not previously
accounted for.
2024-02-21 14:33:11 +01:00
Alex Myers
538b4c850e reckless: prefer to search a local copy of a remote source
If it has already been cloned, this is less problematic than
using the github rest API.
2024-02-21 14:33:11 +01:00
Alex Myers
bfb29aaef0 reckless: Clone github sources when API access fails
Due to the API ratelimit, this allows cloning a github repo and searching
the result rather than searching via the REST API.  If a source has
already been cloned, it is fetched and the default branch checked out.

Fixes a failure reported by @farscapian

Changelog-Fixed: Reckless no longer fails on github API ratelimit.
2024-02-21 14:33:11 +01:00
Alex Myers
ba9ec412c7 reckless: set relative path of local git repo directories 2024-02-21 14:33:11 +01:00
Alex Myers
47c81995e3 reckless: initialize repos with submodules and other cleanup 2024-02-21 14:33:11 +01:00
Alex Myers
61bbd70bc7 reckless: reduce github API calls
Github API calls are now ratelimited to 60 per hour.  Searching through
the subdirectory contents of lightningd/plugins will hit this limit after
two searches or installs.  The simple answer is to look for the directory
rather than verifying a valid entrypoint in a suitably-named directory
prior to cloning the repository.

Also corrects a bug that was flagging submodules as files while
populating directory contents.
2024-02-21 14:33:11 +01:00
Alex Myers
3879d7b9bd reckless: update timeouts 2024-02-07 13:24:34 +01:00
Alex Myers
90a20ff6e3 reckless: create virtual environments for python plugins
This uses pip to install to a venv when the dependencies are specified
with requirements.txt and poetry when it's present on the system and the
plugin has a pyproject.toml.

The directory structure will be:
reckless/
    source/                (original plugin code here)
        plugin_entrypoint  (original entrypoint)
    plugin_name            (symlink or wrapper to activate venv)
    .metadata              (installation information)
    .venv/                 (python virtual environment)

The wrapper matches the naming of the original plugin entrypoint. The
shebang is modified to use the virtual environment's python binary,
then the original plugin is imported as a module and executed as though
it was run directly.

Changelog-Changed: reckless installs python plugins in virtual environments
2024-02-07 13:24:34 +01:00
Alex Myers
03e78ce6d9 reckless: add option to check out a specific commit
... using the syntax reckless install <plugin_name>@<commit hash>
2024-02-07 13:24:34 +01:00
Alex Myers
d5ed7b7b5c reckless: add installation metadata
The metadata includes an original retrieval source, timestamp, and commit
hash.  This will allow a future update command to more easily evaluate the
status of the existing installation.
2024-02-07 13:24:34 +01:00
Alex Myers
2b502ebcbc reckless: add staging directory and symlink
This creates a separate staging directory from the one used to clone
the source.  A symlink is then added to the plugin's entrypoint which is
now in the source directory.
2024-02-07 13:24:34 +01:00
Alex Myers
c043bf2255 reckless: properly remove entry from reckless sources
Fixes a bug introduced in 6163138420 which
avoided gratuitous rewrites of the lightningd config
2024-02-07 13:24:34 +01:00
Alex Myers
8704a4b499 reckless: add installation capability for additional sources
Abstracts search and directory traversal. Adds support for installing
from a local git repository, a local directory, or a web hosted git repo
without relying on an api.

Changelog-Changed: Reckless can now install directly from local sources.
2023-07-27 06:53:49 +09:30
Alex Myers
30b873de31 reckless: style cleanups, type hints, simplify create_dir 2023-07-27 06:53:49 +09:30
Rusty Russell
8d02f33d28 reckless: use modern listconfigs.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-06-03 10:50:29 +09:30
Alex Myers
8163bfc7bd reckless: simplify installer registration
Fixes a bug in installer registration where executable is evaluated
before entrypoints and other details are added.

***RECKLESS STDERR***
Traceback (most recent call last):
  File lightning/tools/reckless, line 382, in <module>
    INSTALLERS['nodejs'].add_entrypoint('{name}')
KeyError: 'nodejs'

Reported by @ksedgwic

Changelog-None
2023-04-24 13:08:15 -07:00
Alex Myers
f731695430 reckless: provide response when failing to add source 2023-04-15 10:33:07 -07:00
Alex Myers
233f05e0e2 reckless: enable case-insensitive searching
Adds a test to validate case matching.
2023-04-15 10:33:07 -07:00
Alex Myers
d279da551b reckless: add missing type hints 2023-04-15 10:33:07 -07:00
Alex Myers
347e7237f8 reckless: match name using installer entry formats
When enabling or disabling a plugin, the entrypoint is inferred
from the user provided name. A canonical name should be used, which
the installer entrypoint formats help to determine (this generally strips
the file extension if one is provided.)
2023-04-15 10:33:07 -07:00
Alex Myers
2577096e71 reckless: install command now uses Installer class methods
Also adds a timeout when testing a plugin.  Previously the behavior
of pyln-client was relied upon to exit if not communicating with
lightningd, however, this behavior is not universal.

Changlelog-Changed: reckless now installs node.js plugins
2023-04-15 10:33:07 -07:00
Alex Myers
32dd8258d4 reckless: add installer methods
Also removes support for pip editable install using pyproject.toml
`pip install -e .` This was a fallback method when a requirements
file was not present, but was hacky and often failed anyway.

reckless: remove installation via pyproject.toml

This method relied on pip install in editable mode (hacky) and often
failed to complete anyhow.  We should instead encourage a requirements
file to be created/used for user installation.
2023-04-15 10:33:07 -07:00
Alex Myers
d5df26f613 reckless: add Installer class to support additional languages
This abstracts the installation procedure to allow generic operations
such as dependency installation to be performed for languages.
2023-04-15 10:33:07 -07:00
Alex Myers
6ac0842aa1 reckless: fix crash on non-verbose output
Also cleans up verbose logic
2023-04-15 10:33:07 -07:00
Alex Myers
f5a132314a reckless: remove extraneous web request 2023-04-15 10:33:07 -07:00
Alex Myers
6163138420 reckless: avoid superfluous config rewrites 2023-04-15 10:33:07 -07:00
Alex Myers
b59b6b9cec reckless: fix CLI redirect, minor cleanup 2023-04-15 10:33:07 -07:00
Alex Myers
cf203369bc reckless: use environment variable redirects
This will be used during CI testing in the following commit.
2023-04-09 12:41:11 +09:30
Alex Myers
55cddcd350 reckless: add support for additional networks
This should have been added earlier as @cdecker suggested, but is needed
to enable CI testing.

Changelog-Changed: Reckless - added support for networks beyond bitocoin and regtest
2023-04-09 12:41:11 +09:30
Alex Myers
e61401aab9 reckless: don't crash on subprocess calls
They prefer Paths to be explicitly cast as strings
2023-04-09 12:41:11 +09:30
Alex Myers
70fc702ee4 reckless: further verbosity/squelch of pip output 2022-12-06 10:42:29 +01:00
Alex Myers
8653d1200f reckless: avoid redundant include statement in config 2022-12-06 10:42:29 +01:00
Alex Myers
3f2e923e81 reckless: fix verbose option
The switch to logging enabled verbose output regardless of the option
flag. Here the functionality is restored.

Changelog-Fixed: reckless verbosity properly applied.
2022-12-06 10:42:29 +01:00