Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reckless update: enable install @ commit and add python virtual environments #7018

Merged
merged 8 commits into from
Feb 7, 2024

Conversation

endothermicdev
Copy link
Collaborator

This PR contains several reckless updates:
fixes an issue with removing sources from the reckless source list
refactors the installation process staging individual plugins in a separate directory from their cloned source
adds metadata to the installation directory - this will be used in a future 'update' command
adds the ability to install a specific commit or tag with @<tag/commit> syntax
creates individual python virtual environments using pip (requirements.txt) or poetry (pyproject.toml)

Copy link
Collaborator

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a comment, let me know if I am missing something

tools/reckless Outdated Show resolved Hide resolved
@endothermicdev endothermicdev force-pushed the reckless-python-venv branch 2 times, most recently from bd8d730 to 51da432 Compare January 31, 2024 19:07
@endothermicdev
Copy link
Collaborator Author

I removed timeouts on the pip and poetry install (grpcio took a very long time to build) and reenabled streaming output. Expanded test coverage of the installed poetry environment and forced poetry installation into a new virtual environment by removing the VIRTUAL_ENV environment variable. Without this Poetry was preferring the already active (CI) venv and merely updating it.

@endothermicdev endothermicdev force-pushed the reckless-python-venv branch 2 times, most recently from ba7a37d to 0e0c3b5 Compare February 1, 2024 23:14
Fixes a bug introduced in 6163138 which
avoided gratuitous rewrites of the lightningd config
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.
@endothermicdev endothermicdev force-pushed the reckless-python-venv branch 2 times, most recently from e9b07e0 to ece7b2d Compare February 2, 2024 17:39
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.
... using the syntax reckless install <plugin_name>@<commit hash>
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
Also test checkout of a git tag on installation.
Copy link
Member

@cdecker cdecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 1251743

assert n.rpc.testmethod() == 'I live.'


@unittest.skipIf(VALGRIND, "virtual environment triggers memleak detection")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are all these skipped if VALGRIND is set? If yes there is a way to disable tests in the entire file with the following anywhere before the first test:

if VALGRIND:
    pytest.skip(allow_module_level=True)

@cdecker cdecker merged commit 61e1e0c into ElementsProject:master Feb 7, 2024
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants