Commit Graph

46 Commits

Author SHA1 Message Date
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
Christian Decker
7b12d3eb60 reckless: Replace custom logging with the logging crate 2022-11-10 16:29:56 +01:00
Christian Decker
77b7a74cd6 reckless: Replace urllib3 with urllib
`urllib3` does not ship as built-in with any of the recent python
releases, whereas `urllib` does, and for the uses we have, they are
pretty much identical.
2022-11-10 16:29:56 +01:00
Alex Myers
fd52e260f0 reckless: neaten path conversions
Changelog-None
2022-11-10 16:29:56 +01:00
Alex Myers
f1c2f811b7 reckless: avoid changing directory during install 2022-11-10 16:29:56 +01:00
Alex Myers
36b4457c04 reckless: Use urllib3 instead of requests
The requests package is preferred, but until installation of python user
dependencies is implemented, sticking with standard modules allows a
frictionless experience.
2022-11-10 16:29:56 +01:00
Alex Myers
341d73fdc2 reckless: fix git clone issue with removed dir
Reckless was failing to install multiple plugins due to git not
appreciating the cwd being a now removed dir after the first plugin
tmp files were cleaned up.
2022-11-08 13:19:36 +01:00
Alex Myers
e48fda1ba0 reckless: analyze repositories with urlparse 2022-11-08 13:19:36 +01:00
Alex Myers
2f4e862863 reckless: improve config file handling
While loading the appropriate lightningconfig file, it is now checked
against the active config file in lightningd. Because a deviation from the
default file structure would not be possible, a -conf option is also added
to explicitly pass the lightningd config file into reckless.
2022-11-08 13:19:36 +01:00
Alex Myers
53ad1ee576 reckless: add function for lightning-cli calls
This also simplifies dynamic enable/disable by catching the exception
raised when the cli is unable to connect to RPC (lightningd offline or
misconfigured relative to reckless).
2022-11-08 13:19:36 +01:00
Alex Myers
4a95a4c7da reckless: multiline string style cleanup 2022-11-08 13:19:36 +01:00
Alex Myers
71351ceacf reckless: replace os.path with pathlib operations
This change makes it easier to follow retrieval of parent directories.
Additional os.path operations replaced with their pathlib.Path equivalents
to keep module usage consistent.
2022-11-08 13:19:36 +01:00
Alex Myers
df98c8b927 reckless: refactor argument list handling.
The goal was to support passing a list to install, enable, etc. in order
to improve performance. Passing lists to most of the functions was less
practical than iterating through the items from the top level.
2022-11-08 13:19:36 +01:00
Alex Myers
24422e9f7c reckless: add type hints 2022-11-08 13:19:36 +01:00
Alex Myers
5d23c7ab0b reckless: raise exception or early termination instead of returning None
More pythonic than returning mixed types.
2022-11-08 13:19:36 +01:00
Alex Myers
791e521179 reckless: update help alias
`reckless help <cmd>` previously called the function docstring. This could
be updated to use the subparser help, but would require a strict naming
convention or a dictionary. Providing a hint to use the built-in
contextual help via the option flag is hopefully sufficient.
2022-11-08 13:19:36 +01:00
Alex Myers
f3934cda50 reckless: use argparse subparsers
A more pythonic approach which should also enable additional help context
for subcommands.
2022-11-08 13:19:36 +01:00
Alex Myers
651c5b6de0 reckless: use config that was explicitly passed to lightningd
Regtest environments commonly use explicit definition of the config
file for lightningd.  This can be queried and utilized by default,
saving redundant definitions between lightning and reckless.
2022-11-08 13:19:36 +01:00
Alex Myers
f18c5e320d reckless: detect pip3 or pip 2022-11-08 13:19:36 +01:00
Alex Myers
83dd431cdc reckless: use the lightning path when invoking lightning-cli
This enables compatibility with startup_regtest.sh among other uses.
The lightning-cli network flag is also set in case there is no config file.
2022-11-08 13:19:36 +01:00
Alex Myers
7e8a889d89 reckless: it turns out the warning is a bit much.
The user should be informed that their config now has a new source, but
but any config files created downstream should be automatically populated.
2022-11-08 13:19:36 +01:00
Alex Myers
b1b280d10b reckless: new tool to manage lightningd plugins
A simple standalone python executable to track plugin repositories, clone
to /tmp, install requirements, test plugin runs, then install and enable in
lightningd and in the config.
Changelog-Added: Reckless - a Core Lightning plugin manager
2022-11-08 13:19:36 +01:00