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

Add a Jupyter notebook demo #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

thompsonmj
Copy link

I suspect users would like to use notebooks, so this adds a setup.py script to instantiate the virtual environment and create the kernel for this use.

It also provides a mini demo notebook to start with building on the examples provided for the interactive Python session.

setup.py should work for any OS setup. I haven't used venv before, so the activation was a bit strange on my Windows system using git bash. This creates the Unix activate script under the Windows location venv/Scripts. The setup script takes this into account.

@andynines
Copy link
Owner

Thanks so much for putting this together! It'll be great to set everything up with one command.

In my Linux environment, I get this error:

$ python setup.py 
/bin/sh: 1: source: not found
Traceback (most recent call last):
  File "/home/ams975@drexel.edu/inhs-outlining/setup.py", line 18, in <module>
    run_command(activate_cmd)
  File "/home/ams975@drexel.edu/inhs-outlining/setup.py", line 5, in run_command
    subprocess.run(command, shell=True, check=True)
  File "/usr/lib/python3.10/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'source venv/bin/activate' returned non-zero exit status 127.

I think it's because source is a Bash shell builtin unavailable to subprocess.run() commands. And I can't find a good way to activate a Python venv from within a Python script on Linux. So it might be simpler to create separate setup.sh and setup.bat scripts. Each would consolidate our four setup steps on their respective platforms:

  • create the virtual environment,
  • activate it,
  • install Pip dependencies, and
  • install the Jupyter kernel.

Then the instructions should say that setup.sh needs to be source'd to persist its venv activation.

I'm happy to hear any other ideas you have!

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.

None yet

2 participants