Skip to content

Adopt Christina Yang's (experimental) tui #110

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

Merged
merged 17 commits into from
Jul 28, 2024
Merged

Conversation

Bluesy1
Copy link
Collaborator

@Bluesy1 Bluesy1 commented Jul 25, 2024

As per the title.

Installable via pip install "problem_bank_scripts[tui] @ git+https://github.com/open-resources/problem_bank_scripts@adopt-yangchristina-tui" currently.

After installation, the tui should be usable via pbs-cli create-question ....., or python -m problem_bank_scripts.tui ...

If testing via the command above, I recommend using a fresh venv (via, for e.g., python -m venv ...)

More details about the tui can be found at https://github.com/yangchristina/opb-utils/blob/main/tui/README.md

Example usage:

gavin@wsl:~$ pbs-cli --help
usage: pbs-cli [-h] {checkq,check-server-ast,lint-server,process-q,process,create-question} ...

OPB Problem Bank Scripts CLI

positional arguments:
  {checkq,check-server-ast,lint-server,process-q,process,create-question}
    checkq              Check the syntax of a single question.
    check-server-ast    Check server code ast for one or more markdown files.
    lint-server         Lint the server code ast for one or more markdown files.
    process-q           Check the syntax of a single question.
    process             Processes all questions.
    create-question     Create a barebones OPB markdown question via a series of tui prompts.

options:
  -h, --help            show this help message and exit
gavin@wsl:~$ pbs-cli create-question --help
usage: pbs-cli create-question [-h] [--create-pr | --no-create-pr] [--gpt] [--saved-json SAVED_JSON]
                               [--env-file ENV_FILE | --no-env-file]

Create a barebones OPB markdown question via a series of tui prompts. It requires the following environment variables to
be set, either via '--env-file', or in the shell's environment: 'GITHUB_USERNAME', 'WRITE_PATH', 'PL_QUESTION_PATH',
'MY_NAME', and 'MY_INITIALS'

options:
  -h, --help                   show this help message and exit
  --create-pr, --no-create-pr  Create a PR with the generated question.
  --gpt                        Use ChatGPT gpt-4o-mini to generate the MCQ options and number input code. If this is
                               specified, the environment variable 'OPENAI_API_KEY' is also required to be available, or
                               be in the env file specified by --env-file. (default: False)
  --saved-json SAVED_JSON      File to read/save tui prompts to/from. (default: ./saved.json)
  --env-file ENV_FILE          Path to the environment file with the required environment variables (default: .env)
  --no-env-file                Do not read from any environment file. If you use this, make sure the required
                               environment variables are set in your shell's environment. (default: False)

This program requires both 'git' and 'gh' to be installed to create PRs. You can find the installation instructions for
'gh' at https://github.com/cli/cli#installation.

@Bluesy1 Bluesy1 added the enhancement New feature or request label Jul 25, 2024
@Bluesy1
Copy link
Collaborator Author

Bluesy1 commented Jul 25, 2024

cc @yangchristina

@Bluesy1 Bluesy1 force-pushed the adopt-yangchristina-tui branch from acc43c5 to d0affeb Compare July 25, 2024 20:03
@Bluesy1 Bluesy1 marked this pull request as ready for review July 27, 2024 00:02
@Bluesy1 Bluesy1 force-pushed the adopt-yangchristina-tui branch from cf5c684 to b475902 Compare July 28, 2024 05:21
@Bluesy1 Bluesy1 merged commit 5cdffd9 into main Jul 28, 2024
14 of 15 checks passed
@Bluesy1 Bluesy1 deleted the adopt-yangchristina-tui branch July 28, 2024 18:13
@Bluesy1
Copy link
Collaborator Author

Bluesy1 commented Jul 28, 2024

Docs/instructions now available at https://problem-bank-scripts.readthedocs.io/en/latest/question_creator.html

Use pip install "problem_bank_scripts[tui] @ git+https://github.com/open-resources/problem_bank_scripts" to install now, instead of the command in the pr description

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants