Skip to content

Conversation

@nfx
Copy link
Collaborator

@nfx nfx commented Aug 5, 2023

Allow for labs.yml definition in target repositories:

---
name: dbx
context: workspace
description: Databricks CLI extensions
hooks:
  install: install.py
entrypoint: main.py
commands:
  - name: foo
    description: foo command
    flags:
      - name: first
        description: first flag description
      - name: second
        description: second flag description
  - name: bar
    description: bar command
    flags:
      - name: first
        description: first flag description
      - name: second
        description: second flag description

and simple command entry points that are aware of both CLI flags and Unified Authentication env variables:

import os, sys, json

print(f'host is {os.environ["DATABRICKS_HOST"]}')

payload = json.loads(sys.argv[1])
print(f'[{payload["command"]}]: flags are {payload["flags"]}')

answer = input('What is your name? ')

print(f'got answer: {answer}')

answer = input('Preferences? ')

print(f'got answer: {answer}')

Changes

Tests

Allow for `labs.yml` definition in target repositories:

```
---
name: dbx
context: workspace
description: Databricks CLI extensions
hooks:
  install: install.py
entrypoint: main.py
commands:
  - name: foo
    description: foo command
    flags:
      - name: first
        description: first flag description
      - name: second
        description: second flag description
  - name: bar
    description: bar command
    flags:
      - name: first
        description: first flag description
      - name: second
        description: second flag description
```

and simple command entry points that are aware of both CLI flags and Unified Authentication env variables:

```
import os, sys, json

print(f'host is {os.environ["DATABRICKS_HOST"]}')

payload = json.loads(sys.argv[1])
print(f'[{payload["command"]}]: flags are {payload["flags"]}')

answer = input('What is your name? ')

print(f'got answer: {answer}')

answer = input('Preferences? ')

print(f'got answer: {answer}')
```
nfx added a commit to databrickslabs/dbx that referenced this pull request Aug 7, 2023
@nfx
Copy link
Collaborator Author

nfx commented Aug 9, 2023

TODO: add open_notebook hook for installation

github-merge-queue bot pushed a commit that referenced this pull request Sep 27, 2023
## Changes
This PR adds higher-level wrappers for calling subprocesses. One of the
steps to get #637 in, as
previously discussed.

The reason to add `process.Forwarded()` is to proxy Python's `input()`
calls from a child process seamlessly. Another use-case is plugging in
`less` as a pager for the list results.

## Tests
`make test`
github-merge-queue bot pushed a commit that referenced this pull request Oct 3, 2023
This PR adds a few utilities related to Python interpreter detection:

- `python.DetectInterpreters` to detect all Python versions available in
`$PATH` by executing every matched binary name with `--version` flag.
- `python.DetectVirtualEnvPath` to detect if there's any child virtual
environment in `src` directory
- `python.DetectExecutable` to detect if there's python3 installed
either by `which python3` command or by calling
`python.DetectInterpreters().AtLeast("v3.8")`

To be merged after #804, as one of
the steps to get #637 in, as
previously discussed.
hectorcast-db pushed a commit that referenced this pull request Oct 13, 2023
## Changes
This PR adds higher-level wrappers for calling subprocesses. One of the
steps to get #637 in, as
previously discussed.

The reason to add `process.Forwarded()` is to proxy Python's `input()`
calls from a child process seamlessly. Another use-case is plugging in
`less` as a pager for the list results.

## Tests
`make test`
hectorcast-db pushed a commit that referenced this pull request Oct 13, 2023
This PR adds a few utilities related to Python interpreter detection:

- `python.DetectInterpreters` to detect all Python versions available in
`$PATH` by executing every matched binary name with `--version` flag.
- `python.DetectVirtualEnvPath` to detect if there's any child virtual
environment in `src` directory
- `python.DetectExecutable` to detect if there's python3 installed
either by `which python3` command or by calling
`python.DetectInterpreters().AtLeast("v3.8")`

To be merged after #804, as one of
the steps to get #637 in, as
previously discussed.
@nfx
Copy link
Collaborator Author

nfx commented Nov 17, 2023

Fixed in #914

@nfx nfx closed this Nov 17, 2023
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.

2 participants