Skip to content
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

UIP-47: Simplify narrative installation #3559

Merged
merged 5 commits into from
Jun 14, 2024
Merged

Conversation

ialarmedalien
Copy link
Collaborator

@ialarmedalien ialarmedalien commented Jun 10, 2024

Description of PR purpose/changes

Removing antiquated setup.py and adding the src/ directory to the PYTHONPATH env var to simplify narrative installation and use.

Jira Ticket / Issue

Related Jira ticket: https://kbase-jira.atlassian.net/browse/UIP-47

  • Added the Jira Ticket to the title of the PR (e.g. DATAUP-69 Adds a PR template)

Testing Instructions

  • Details for how to test the PR:
  • Tests pass locally and in GitHub Actions
  • Changes available by spinning up a local narrative and checking that the backend works, or spinning up a docker image and checking that the backend works. Alternatively, just run the tests.

Dev Checklist:

  • My code follows the guidelines at https://sites.google.com/lbl.gov/trussresources/home?authuser=0
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • (JavaScript) I have run Prettier and ESLint on changed code manually or with a git precommit hook
  • (Python) I have run Ruff format and check on changed Python code manually or with a git precommit hook
  • Any dependent changes have been merged and published in downstream modules

Updating Version and Release Notes (if applicable)

N/A

@ialarmedalien ialarmedalien self-assigned this Jun 10, 2024
NAR_NAME="kbase/narrative"
NAR_VER_NAME="kbase/narrative_version" # Image for serving up the narrative version

# Get the current branch, so that we can tag images to branch
BRANCH=${TRAVIS_BRANCH:-`git symbolic-ref --short HEAD`}
BRANCH=${GIT_BRANCH:-`git symbolic-ref --short HEAD`}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TRAVIS_BRANCH was annoying me

npm install 2>&1 | tee -a ${logfile}
npm run install-npm

# Install Narrative requirements
# ------------------------------
log "Installing biokbase requirements from src/requirements.txt"
cd "$NARRATIVE_ROOT_DIR/src"
cat requirements.txt | sed -e '/^\s*#.*$/d' -e '/^\s*$/d' | xargs -n 1 pip --no-cache-dir install 2>&1 | tee -a "${logfile}"
cat $NARRATIVE_ROOT_DIR/src/requirements.txt | sed -e '/^\s*#.*$/d' -e '/^\s*$/d' | xargs -n 1 pip --no-cache-dir install 2>&1 | tee -a "${logfile}"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this command is what the install_docker_narrative.sh script uses

Comment on lines -78 to -86
# Install Narrative code
# ----------------------
log "Installing biokbase modules"
cd "$NARRATIVE_ROOT_DIR/src"
log "Running local 'setup.py'"
python setup.py install 2>&1 | tee -a "${logfile}"
log "Done installing biokbase."
cd "$NARRATIVE_ROOT_DIR"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Begone foul setup.py!

@@ -110,7 +101,6 @@ then
cd nbextensions
sh install.sh
cd ../..
jupyter nbextension enable --py --sys-prefix widgetsnbextension
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line is in the install.sh script

Comment on lines -32 to -38
# Install Narrative code
# ----------------------
console "Installing biokbase modules"
cd $NARRATIVE_ROOT_DIR/src
console "Running local 'setup.py'"
${PYTHON} setup.py install
console "Done installing biokbase."
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Begone again foul setup.py!


cp $NARRATIVE_DIR/src/config.json $JUPYTER_CONFIG_DIR/static/kbase/config/

python /kb/dev_container/narrative/src/biokbase/narrative/exporter/run_narrative.py "$@"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this script does not exist. I meant to delete this file in the last PR but must have forgotten

@@ -6,6 +6,7 @@ export JUPYTER_RUNTIME_DIR=/tmp/jupyter_runtime
export JUPYTER_DATA_DIR=/tmp/jupyter_data
export JUPYTER_PATH=$NARRATIVE_DIR/kbase-extension
export IPYTHONDIR=$NARRATIVE_DIR/kbase-extension/ipython
export PYTHONPATH=$NARRATIVE_DIR/src/:$PYTHONPATH
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool new PYTHONPATH

@@ -1,6 +1,6 @@
#!/bin/bash
export NARRATIVE_DIR=$(pwd)

export PYTHONPATH=$NARRATIVE_DIR/src:$PYTHONPATH
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

amend the PYTHONPATH

Base automatically changed from random_updates to develop June 11, 2024 12:23
Copy link

codecov bot commented Jun 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 25.71%. Comparing base (5bb158c) to head (775e9e1).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3559      +/-   ##
===========================================
- Coverage    25.72%   25.71%   -0.02%     
===========================================
  Files          461      461              
  Lines        46694    46694              
===========================================
- Hits         12014    12007       -7     
- Misses       34680    34687       +7     

see 3 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 53b6896...775e9e1. Read the comment docs.

Copy link

sonarcloud bot commented Jun 13, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@ialarmedalien ialarmedalien merged commit 476bd09 into develop Jun 14, 2024
7 of 10 checks passed
@ialarmedalien ialarmedalien deleted the remove_setup_py branch June 14, 2024 10:51
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