tensorflow / tensorflow/quantum

Avoid hard-coding "quantum" in `scripts/` scripts

Open Beginner friendly
#1,082 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

area/devops help wanted no QC knowledge needed priority/before-0.7.7
Dominant language
Python
Stars
2.2k
Forks
665
PR merge metrics
No merged PRs in 30d

Description

scripts/ci_validate_tutorials.sh has a hard-coded assumption that the user's local git working directory is named "quantum":

cd ..
examples_output=$(python3 quantum/scripts/test_tutorials.py)

This fails for developers who (like me) have multiple copies of the TFQ source tree, with different names for different concurrent development projects. Instead of assuming the directory is quantum, the scripts in the scripts/ directory should get the correct name using code such as the following:

thisdir=$(CDPATH="" cd -- "$(dirname -- "${0}")" && pwd -P)
repo_dir=$(git -C "${thisdir}" rev-parse --show-toplevel 2>/dev/null)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with scripts/ci_validate_tutorials.sh and the referenced scripts/test_tutorials.py, then inspect the other scripts in scripts/ for the same repository-name assumption. Run the tutorial validation from a checkout whose directory has been renamed; done means the scripts locate the repository without assuming it is named quantum.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, shell
Domain
ci-cd, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.