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

Pjob/poc/pyapp binary with plugins #2035

Draft
wants to merge 2 commits into
base: pjob/SNOW-1747473-enable-disable-plugin-commands
Choose a base branch
from

Conversation

sfc-gh-pjob
Copy link
Contributor

Pre-review checklist

  • I've confirmed that instructions included in README.md are still correct after my changes in the codebase.
  • I've added or updated automated unit tests to verify correctness of my new code.
  • I've added or updated integration tests to verify correctness of my new code.
  • I've confirmed that my changes are working by executing CLI's commands manually on MacOS.
  • I've confirmed that my changes are working by executing CLI's commands manually on Windows.
  • I've confirmed that my changes are up-to-date with the target branch.
  • I've described my changes in the release notes.
  • I've described my changes in the section below.

Changes description

PoC: PyApp + plugins installed and loaded to/from custom directory

@sfc-gh-pjob sfc-gh-pjob changed the base branch from main to pjob/SNOW-1747473-enable-disable-plugin-commands January 30, 2025 17:36
@@ -14,4 +14,4 @@

from __future__ import annotations

VERSION = "3.4.0.dev0"
VERSION = "3.4.0.dev8"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have issues with caching of my builds, that's why I bump version in my PoC. This should be resolved.

pip install -U hatch
hatch clean
hatch build
pip install git+https://github.com/hobbsd/[email protected]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. It's external script. It should be reviewed.
  2. The script uses tomllib, so it requires python 3.11.

@@ -188,3 +188,6 @@ markers = [

[tool.codespell]
skip = 'tests/*,snow.spec'

[tool.hatch.build.targets.binary]
python-version = "3.11"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I use python 3.11 but we had issues with pyinstaller binaries when using python 3.11 - we should check it.

from dataclasses import dataclass

from snowflake.cli.api.plugins.command import CommandSpec

sys.path.append("/tmp/cli_plugins/lib/python3.11/site-packages")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should consider if we can do it better. For sure we need to load plugins from configurable directory.

) -> CommandResult:
"""Installs a plugin from a package"""
target_dir: str = (
"/tmp/cli_plugins" # TODO make it configurable in config.toml with some default
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should be configurable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. This script is just PoC - probably not all commands are needed.
  2. I don't know how it works on different operating systems and CPUs.
  3. I don't how will work signing of the binaries.
  4. We should probably move the script to scripts directory.

"-m",
"pip",
"install",
"--prefix",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

--prefix, not --target to install only the plugin and new dependencies, without installation of existing CLI's dependencies.

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.

1 participant