ucx icon indicating copy to clipboard operation
ucx copied to clipboard

[BUG]: I would like to lint local code, locally, literally

Open rwforest opened this issue 1 year ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

If I try to run databricks labs ucx lint-local-code, it will try to hit a Datarbricks instance via profile. If I don't setup my profile or my token is invalid, it would throw an error:

(.venv) yipman@jasons-mbp-2 flight_delay % databricks labs ucx lint-local-code Which file or directory do you want to lint? (default: /Users/yipman/Downloads/flight_delay/flight_delay): 00:09:06 INFO [d.l.u.framework.utils] Invoking command: ['pip', '--disable-pip-version-check', 'install', '-r', '/Users/yipman/Downloads/flight_delay/flight_delay/requirements.txt', '-t', '/private/var/folders/fz/zkvh37qx3kdcv_8w1sw8kckm0000gn/T/ucx-_qoz88sx'] 00:10:26 INFO [d.l.u.framework.utils] Invoking command: ['pip', '--disable-pip-version-check', 'install', '-r', '/Users/yipman/Downloads/flight_delay/flight_delay/requirements.txt', '-t', '/private/var/folders/fz/zkvh37qx3kdcv_8w1sw8kckm0000gn/T/ucx-_qoz88sx'] 00:10:41 INFO [d.l.u.framework.utils] Invoking command: ['pip', '--disable-pip-version-check', 'install', '-r', '/Users/yipman/Downloads/flight_delay/flight_delay/requirements.txt', '-t', '/private/var/folders/fz/zkvh37qx3kdcv_8w1sw8kckm0000gn/T/ucx-_qoz88sx'] 00:10:55 ERROR [d.l.ucx.lint-local-code] PermissionDenied: Invalid access token. Config: host=https://adb-xxxxxxxxx.azuredatabricks.net, token=***, auth_type=pat. Env: DATABRICKS_HOST, DATABRICKS_TOKEN

Expected Behavior

This command should not attempt to make any external connections and just lint the code locally as the command name suggested.

Steps To Reproduce

(.venv) yipman@jasons-mbp-2 flight_delay % databricks labs ucx lint-local-code Which file or directory do you want to lint? (default: /Users/yipman/Downloads/flight_delay/flight_delay): 00:09:06 INFO [d.l.u.framework.utils] Invoking command: ['pip', '--disable-pip-version-check', 'install', '-r', '/Users/yipman/Downloads/flight_delay/flight_delay/requirements.txt', '-t', '/private/var/folders/fz/zkvh37qx3kdcv_8w1sw8kckm0000gn/T/ucx-_qoz88sx'] 00:10:26 INFO [d.l.u.framework.utils] Invoking command: ['pip', '--disable-pip-version-check', 'install', '-r', '/Users/yipman/Downloads/flight_delay/flight_delay/requirements.txt', '-t', '/private/var/folders/fz/zkvh37qx3kdcv_8w1sw8kckm0000gn/T/ucx-_qoz88sx'] 00:10:41 INFO [d.l.u.framework.utils] Invoking command: ['pip', '--disable-pip-version-check', 'install', '-r', '/Users/yipman/Downloads/flight_delay/flight_delay/requirements.txt', '-t', '/private/var/folders/fz/zkvh37qx3kdcv_8w1sw8kckm0000gn/T/ucx-_qoz88sx'] 00:10:55 ERROR [d.l.ucx.lint-local-code] PermissionDenied: Invalid access token. Config: host=https://adb-xxxxxx.azuredatabricks.net, token=***, auth_type=pat. Env: DATABRICKS_HOST, DATABRICKS_TOKEN

Cloud

Azure

Operating System

macOS

Version

latest via Databricks CLI

Relevant log output

No response

rwforest avatar Aug 07 '24 07:08 rwforest

@rwforest thanks for this. Are you able to share the requirements.txt file that seems to be triggering the issue ?

ericvergnaud avatar Aug 07 '24 10:08 ericvergnaud

(.venv) @.*** flight_delay % cat requirements.txt mlflow==2.7.1 numpy>=1.23.0 pandas==1.5.3 scikit-learn>=1.1.1 matplotlib>=3.5.2 pillow>=10.0.1 Jinja2==3.0.3 pyspark~=3.3.0 pytz~=2022.2.1 pytest>=7.1.2

On Wed, Aug 7, 2024 at 3:16 AM Eric Vergnaud @.***> wrote:

@rwforest https://github.com/rwforest thanks for this. Are you able to share the requirements.txt file that seems to be triggering the issue ?

— Reply to this email directly, view it on GitHub https://github.com/databrickslabs/ucx/issues/2378#issuecomment-2273122884, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGTFJS7755H3F2OIRL3CATZQHXYHAVCNFSM6AAAAABMDY3OGGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZTGEZDEOBYGQ . You are receiving this because you were mentioned.Message ID: @.***>

rwforest avatar Aug 08 '24 05:08 rwforest

@rwforest you have to use a valid Databricks CLI auth profile to install UCX and to use this command

nfx avatar Oct 09 '24 17:10 nfx

I know.. I was just saying can we just do it locally without connecting to any Databricks? If it's a hard requirement then I will live with it

On Wed, Oct 9, 2024, 10:22 Serge Smertin @.***> wrote:

@rwforest https://github.com/rwforest you have to use a valid Databricks CLI auth profile to install UCX and to use this command

— Reply to this email directly, view it on GitHub https://github.com/databrickslabs/ucx/issues/2378#issuecomment-2402886853, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGTFJXZ2SNSQMQY3UBMVFLZ2VQ4LAVCNFSM6AAAAABMDY3OGGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBSHA4DMOBVGM . You are receiving this because you were mentioned.Message ID: @.***>

rwforest avatar Oct 09 '24 17:10 rwforest

UCX requires access to infrastructure. Closing as won't fix

ericvergnaud avatar Oct 11 '24 12:10 ericvergnaud