You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "snazy (via GitHub)" <gi...@apache.org> on 2025/03/20 07:36:23 UTC

[PR] Simplify `polaris` client script [polaris]

snazy opened a new pull request, #1220:
URL: https://github.com/apache/polaris/pull/1220

   Address [SC2164](https://github.com/koalaman/shellcheck/wiki/SC2164), [SC2098](https://github.com/koalaman/shellcheck/wiki/SC2098), [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086)
   
   <!--
       Possible security vulnerabilities: STOP here and contact security@apache.org instead!
   
       Please update the title of the PR with a meaningful message - do not leave it "empty" or "generated"
       Please update this summary field:
   
       The summary should cover these topics, if applicable:
       * the motivation for the change
       * a description of the status quo, for example the current behavior
       * the desired behavior
       * etc
   
       PR checklist:
       - Do a self-review of your code before opening a pull request
       - Make sure that there's good test coverage for the changes included in this PR
       - Run tests locally before pushing a PR (./gradlew check)
       - Code should have comments where applicable. Particularly hard-to-understand
         areas deserve good in-line documentation.
       - Include changes and enhancements to the documentation (in site/content/in-dev/unreleased)
       - For Work In Progress Pull Requests, please use the Draft PR feature.
   
       Make sure to add the information BELOW this comment.
       Everything in this comment will NOT be added to the PR description.
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Simplify `polaris` client script [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on PR #1220:
URL: https://github.com/apache/polaris/pull/1220#issuecomment-2742081631

   @snazy should we make the same change to `regtests/polaris-reg-test`? This file was used during regtest (yes..during regtest, it is not using `polairs` but this one instead). But I think with recent change with moving python client code out and keep the same layout in docker as well, we can remove `regtests/polaris-reg-test` if there is no other reason to keep it (I can PR this a bit later this weekend).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Simplify `polaris` client script [polaris]

Posted by "snazy (via GitHub)" <gi...@apache.org>.
snazy commented on PR #1220:
URL: https://github.com/apache/polaris/pull/1220#issuecomment-2741614935

   cc @MonkeyCanCode 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Simplify `polaris` client script [polaris]

Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on code in PR #1220:
URL: https://github.com/apache/polaris/pull/1220#discussion_r2005064843


##########
polaris:
##########
@@ -17,29 +17,24 @@
 # specific language governing permissions and limitations
 # under the License.
 #
-SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
 
-if [ ! -d ${SCRIPT_DIR}/polaris-venv ]; then
+set -e
+
+dir=${0%/*}
+
+if [ ! -d "${dir}"/polaris-venv ]; then
   echo "Performing first-time setup for the Python client..."
-  rm -f ${SCRIPT_DIR}/poetry.lock
-  python3 -m venv ${SCRIPT_DIR}/polaris-venv
-  . ${SCRIPT_DIR}/polaris-venv/bin/activate
+  rm -f "${dir}"/poetry.lock
+  python3 -m venv "${dir}"/polaris-venv
+  . "${dir}"/polaris-venv/bin/activate
   pip install -r regtests/requirements.txt
 
-  cp ${SCRIPT_DIR}/client/python/pyproject.toml ${SCRIPT_DIR}
-  pushd $SCRIPT_DIR && poetry install ; popd
+  cp "${dir}"/client/python/pyproject.toml "${dir}"
+  pushd "$dir" && poetry install ; popd
 
   deactivate
   echo "First time setup complete."
 fi
 
-pushd $SCRIPT_DIR > /dev/null
-PYTHONPATH=client/python SCRIPT_DIR="$SCRIPT_DIR" ${SCRIPT_DIR}/polaris-venv/bin/python3 client/python/cli/polaris_cli.py "$@"
-status=$?
-popd > /dev/null
-
-if [ $status -ne 0 ]; then
-  exit 1
-fi
-
-exit 0
+cd "$dir"
+PYTHONPATH=client/python SCRIPT_DIR="$dir" "${dir}"/polaris-venv/bin/python3 client/python/cli/polaris_cli.py "$@"

Review Comment:
   It seems that using the `env` command to modify the environment is more portable:
   
   ```suggestion
   env PYTHONPATH=client/python SCRIPT_DIR="$dir" "${dir}"/polaris-venv/bin/python3 client/python/cli/polaris_cli.py "$@"
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Simplify `polaris` client script [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on PR #1220:
URL: https://github.com/apache/polaris/pull/1220#issuecomment-2741652173

   > cc @MonkeyCanCode 
   
   Will check tonight. Thanks 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Simplify `polaris` client script [polaris]

Posted by "snazy (via GitHub)" <gi...@apache.org>.
snazy commented on PR #1220:
URL: https://github.com/apache/polaris/pull/1220#issuecomment-2742704427

   >  should we make the same change to regtests/polaris-reg-test? 
   
   That's going away with #1219 
   
   >  this has essentially no test coverage
   
   Yea, I've been asking for this in #1058 
   
   > We should have CI enforcing these checks
   
   Mind taking a stab at it?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Simplify `polaris` client script [polaris]

Posted by "snazy (via GitHub)" <gi...@apache.org>.
snazy merged PR #1220:
URL: https://github.com/apache/polaris/pull/1220


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org