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 docstrings and minor style fixes for application files and JuliaBuildPack #213

Merged
merged 14 commits into from
Mar 19, 2018

Conversation

willingc
Copy link
Contributor

@willingc willingc commented Feb 5, 2018

Partially addresses #211

Covers repo2docker application files:

  • app.py
  • utils.py
  • __main__.py

And JuliaBuildPack

@willingc willingc changed the title [WIP] Add docstrings and minor style fixes [WIP] Add docstrings and minor style fixes for application files and JuliaBuildPack Feb 5, 2018
@willingc willingc changed the title [WIP] Add docstrings and minor style fixes for application files and JuliaBuildPack Add docstrings and minor style fixes for application files and JuliaBuildPack Feb 5, 2018
Copy link
Collaborator

@yuvipanda yuvipanda left a comment

Choose a reason for hiding this comment

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

This is awesome, @willingc! Left some comments with suggested changes, but everything looks pretty accurate to me.

name = 'jupyter-repo2docker'
version = __version__
description = __doc__

@default('log_level')
def _default_log_level(self):
"""The system's default log level"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

The application's default log level?

Validate image_name read by argparse contains only lowercase characters
Validate image_name read by argparse

Note: image_name contains only lowercase characters
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, I think you've found a bug in our docs :) This is not the actual validation logic we use nor the actual liimts, but I see our exception in 194 says this too.

The logic we use + the valid criteria is 'Container names must start with an alphanumeric character and can then use _ . or - in addition to alphanumeric. [a-zA-Z0-9][a-zA-Z0-9_.-]+'. We can either update that in this PR or do that in a separate one! Good catch!

@@ -444,6 +463,7 @@ def push_image(self):
last_emit_time = time.time()

def run_image(self):
"""Run docker image"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

"Run docker container from built image" perhaps?

"""
def get_env(self):
"""Get additional environment settings for Julia and Jupyter

Returns:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the docstrings here should explain what exactly is being returned, since the generic docstring for what get_env is returning is already in the base BuildPack. I think explaining each of the env variable set here and why we do it would be the useful thing here.

  • JULIA_PATH - base path where all Julia Binaries and libraries will be installed
  • JULIA_HOME - path where all Julia Binaries will be installed
  • JULIA_PKGDIR - path where all Julia libraries will be installed
  • JULIA_VERSION - default version of julia to be installed
  • JUPYTER - environment variable required by IJulia to point to jupyter executable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added 👍

@@ -22,9 +31,30 @@ def get_env(self):
]

def get_path(self):
"""Get path for Julia executables

Returns:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Adds path to Julia binaries to user's PATH.

Also we can simplify this code to just be:

return super().get_path() + ['${JULIA_HOME}']

but also ok to not do that!


This sets up:

- a directory for the specified Julia version and path
Copy link
Collaborator

Choose a reason for hiding this comment

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

It installs Julia itself, and also installs IJulia (Pkg.add sounds like you are adding to something, but it really is installing the package)

"""
Return series of build-steps specific to "this" Julia repository

Precompile all Julia libraries found in the repository's REQUIRE
Copy link
Collaborator

Choose a reason for hiding this comment

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

+1!

"""
Check if current repo should be built with the Julia Build pack

super().detect() is called if Julia Build pack should be used.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think similar to the R build pack, we should actually not call super().detect() here, for the same reason as on the R build pack (we want to use Julia even if there is no environment.yml file). Whenever I'm doing doc fixes I'm also happy to fix bugs so documenting them is easier, but happy to deal with that in a separate PR too!

@@ -53,55 +54,65 @@ def flush():

@contextmanager
def maybe_cleanup(path, cleanup=False):
"""Execute cleanup of the passed path when cleanup flag is True."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

"Delete the directory at passed path if cleanup flag is True"

This installs:

- the specified Julia version and path
- Julia packages with ownership granted to the notebook user
Copy link
Collaborator

Choose a reason for hiding this comment

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

It only creates a directory with permissions for installing julia packages (from get_assemble_scripts), does not actually install them here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I will update. Still working on the corrections from yesterday.

@willingc
Copy link
Contributor Author

@yuvipanda I think that I've covered all your review comments.

@minrk
Copy link
Member

minrk commented Mar 19, 2018

Great!

@minrk minrk merged commit 0567187 into jupyterhub:master Mar 19, 2018
@willingc
Copy link
Contributor Author

Thanks @minrk for the merge. Going to try to finish all the docstrings today.

@willingc willingc deleted the docstring-conda branch March 19, 2018 17:39
markmo pushed a commit to markmo/repo2docker that referenced this pull request Jan 22, 2021
Add docstrings and minor style fixes for application files and JuliaBuildPack
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.

3 participants