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

Add entrypoint to setup.py to allow pipx installation #986

Closed
wants to merge 3 commits into from

Conversation

aranke
Copy link
Member

@aranke aranke commented Apr 25, 2024

Problem

Starting in Python 3.12, we can't install packages in the global venv: https://stackoverflow.com/a/75722775

Solution

As an alternative, we can allow users to install via pipx like so:

pipx install dbt-snowflake

Manual Testing

❯ dbt --version
pyenv: dbt: command not found

❯ pipx install git+https://github.com/dbt-labs/dbt-snowflake.git@entrypoint_setup_py
  installed package dbt-snowflake 1.8.0b3, installed using Python 3.12.2
  These apps are now globally available
    - dbt
done! ✨ 🌟 ✨

❯ dbt --version
Core:
  - installed: 1.8.0-b3
  - latest:    1.7.13   - Ahead of latest version!

Plugins:
  - snowflake: 1.8.0b3 - Ahead of latest version!

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX

Required so we can do `pipx install dbt-snowflake`.

Starting in Python 3.12, we can't install packages in the global venv: https://stackoverflow.com/a/75722775
@cla-bot cla-bot bot added the cla:yes label Apr 25, 2024
Copy link
Contributor

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the dbt-snowflake contributing guide.

@aranke aranke marked this pull request as ready for review April 25, 2024 12:33
@aranke aranke changed the title Add entrypoint to setup.py Add entrypoint to setup.py to allow pipx installation Apr 25, 2024
@mikealfare
Copy link
Contributor

@aranke To maake sure I follow, in py311 and prior, we automatically picked up the entrypoint from dbt-core when pip installed it as a dependency. But with py312 and forward, we need to explicitly add the entrypoint in the adapter since folks will run pip install dbt-snowflake. Is that right?

@aranke
Copy link
Member Author

aranke commented Apr 25, 2024

@mikealfare Thanks for the callout, here's a bit more detail:

Since Python 3.12 you can't install packages in the global virtual environment; so pip install dbt-snowflake outside a virtual environment now raises an error and exits.

There are two potential workarounds:

  1. Install dbt-snowflake in a virtual environment (works same as before)
  2. Use pipx, a tool to “Install and Run Python Applications in Isolated Environments”.

Workaround 2 doesn't work right now because pipx looks for a console entry point in the installed package (dbt-snowflake here). Since this console entry point doesn't exist right now, pipx throws an error. This PR aims to fix this by “passing through” dbt-core's console entry point to dbt-snowflake, thus allowing it to be installed by pipx.

Please let me know if I can make anything clearer still. Thanks!

Copy link
Contributor

This PR has been marked as Stale because it has been open with no activity as of late. If you would like the PR to remain open, please comment on the PR or else it will be closed in 7 days.

@github-actions github-actions bot added the Stale label Oct 23, 2024
Copy link
Contributor

Although we are closing this PR as stale, it can still be reopened to continue development. Just add a comment to notify the maintainers.

@github-actions github-actions bot closed this Oct 30, 2024
@mikealfare mikealfare deleted the entrypoint_setup_py branch November 9, 2024 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants