py4ds /
nbless
Construct, deconstruct, convert, execute, and prepare slides from Jupyter notebooks
49/100 healthLoading repository data…
astropy-learn / repository
Execute and convert collections of Jupyter notebooks to static HTML
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
Archive note: The functionality this repository provided is now integrated into the workflow process run over individual tutorial repositories. See the build.yml workflow in a given tutorial repository and the action-- repositories in this organization.
Tools for building collections of Jupyter notebooks into web pages for public consumption.
This project serves as a thin wrapper around nbconvert to enable converting
and executing directories or directory structures full of Jupyter notebooks to
static HTML pages.
nbcollection is free software made available under the MIT License. For details
see the LICENSE file.
Imagine we have a directory containing Jupyter notebook files and some other sub-directories that also contain notebook files, such as:
my_notebooks
├── notebook1.ipynb
└── sub_path1
├── notebook2.ipynb
└── notebook3.ipynb
From the top level, we could use nbcollection to execute and convert all of these
notebook files to HTML by running:
nbcollection convert my_notebooks
With no options specified, this will create a directory within the specified
path, my_notebooks/_build, to store the executed notebooks and the converted
HTML pages:
my_notebooks
└── _build
├── notebook1.ipynb
├── notebook1.html
└── sub_path1
├── notebook2.ipynb
├── notebook3.ipynb
├── notebook2.html
└── notebook3.html
If you are only interested in executing the notebooks, you can instead use the
execute command:
nbcollection execute my_notebooks
which still creates a new _build path but now only contains the executed
notebook files:
my_notebooks
└── _build
├── notebook1.ipynb
└── sub_path1
├── notebook2.ipynb
└── notebook3.ipynb
Instead of running on a full directory, it is also possible to convert or
execute single notebook files (but you should probably use jupyter nbconvert
directly), or lists of notebook files. For example, to convert a set of specific
notebook files within the above example directory layout:
nbcollection convert my_notebooks/notebook1.ipynb my_notebooks/sub_path1/notebook2.ipynb
Because these files could in principle be in two completely separate paths, the
build products here will instead be written to the current working directory by
default (but see the command option --build-path below to customize). So, the
above command would result in:
_build
├── notebook1.ipynb
└── sub_path1
└── notebook2.ipynb
Several options are available to modify the default behavior of the nbcollection
commands.
As outlined above, the default locations for storing the executed notebooks or
converted HTML pages is either in a parallel directory structure contained
within a _build directory created at the top-level of the specified path, or
in a _build path in the current working directory (if a list of notebook files
are specified). However, the build path can be overridden and specified
explicitly by specifying the --build-path command line flag. For example, with
the notebook directory structure illustrated in the above examples, we could
instead specify the build path with:
nbcollection convert my_notebooks --build-path=/new/path/my_build
With this option specified, the executed notebook files and converted HTML
notebooks would be placed under /new/path/my_build instead.
If your notebook files are spread throughout a nested directory structure, you
may want to place all of the converted notebook files in a single path rather
than reproduce the relative path structure of your content. To enable this, use
the --flatten boolean flag. For example, if your content has the following
path structure:
my_notebooks
├── notebook1.ipynb
└── sub_path1
├── notebook2.ipynb
└── notebook3.ipynb
You can convert all of the notebooks to a single build path with:
nbcollection convert my_notebooks --flatten
This will result in:
my_notebooks
└── _build
├── notebook1.ipynb
├── notebook2.ipynb
├── notebook3.ipynb
├── notebook1.html
├── notebook2.html
└── notebook3.html
This command also works in conjunction with --build-path if you want to, e.g.,
convert a list of individual notebook files and have the build products end up
in the same root path.
nbconvert allows specifying custom jinja2 template
files for
exporting notebook files to HTML. We support this through the --template
command-line flag, which allows specifying a path to a jinja2 template file.
For example:
nbcollection convert my_notebooks --template-file=templates/custom.tpl
You can enable additional
preprocessors
for the HTML exporter by passing one or more preprocessor names to the
--preprocessors option. A useful preprocessor is ExtractOutputPreprocessor,
which extracts figures from the HTML into separate files for better page loading
performance:
nbcollection convert my_notebooks --preprocessors=nbconvert.preprocessors.ExtractOutputPreprocessor
Though the primary utility of nbcollection is to enable converting a collection of
notebook files to static HTML pages, you can also use the nbcollection execute
command to instead only execute a collection of notebooks. This command is used
the same way as nbcollection convert, but also enable executing the notebook files
in place as a way to test the notebooks. To execute a collection of notebooks
in-place (i.e., this will not create a _build path with the executed
notebooks):
nbcollection execute my_notebooks --inplace
Selected from shared topics, language and repository description—not editorial ratings.
py4ds /
Construct, deconstruct, convert, execute, and prepare slides from Jupyter notebooks
49/100 healthjlira5418 /
## Step 1 - Scraping Complete your initial scraping using Jupyter Notebook, BeautifulSoup, Pandas, and Requests/Splinter. * Create a Jupyter Notebook file called `mission_to_mars.ipynb` and use this to complete all of your scraping and analysis tasks. The following outlines what you need to scrape. ### NASA Mars News * Scrape the [Mars News Site](https://redplanetscience.com/) and collect the latest News Title and Paragraph Text. Assign the text to variables that you can reference later. ```python # Example: news_title = "NASA's Next Mars Mission to Investigate Interior of Red Planet" news_p = "Preparation of NASA's next spacecraft to Mars, InSight, has ramped up this summer, on course for launch next May from Vandenberg Air Force Base in central California -- the first interplanetary launch in history from America's West Coast." ``` ### JPL Mars Space Images - Featured Image * Visit the url for the Featured Space Image site [here](https://spaceimages-mars.com). * Use splinter to navigate the site and find the image url for the current Featured Mars Image and assign the url string to a variable called `featured_image_url`. * Make sure to find the image url to the full size `.jpg` image. * Make sure to save a complete url string for this image. ```python # Example: featured_image_url = 'https://spaceimages-mars.com/image/featured/mars2.jpg' ``` ### Mars Facts * Visit the Mars Facts webpage [here](https://galaxyfacts-mars.com) and use Pandas to scrape the table containing facts about the planet including Diameter, Mass, etc. * Use Pandas to convert the data to a HTML table string. ### Mars Hemispheres * Visit the astrogeology site [here](https://marshemispheres.com/) to obtain high resolution images for each of Mar's hemispheres. * You will need to click each of the links to the hemispheres in order to find the image url to the full resolution image. * Save both the image url string for the full resolution hemisphere image, and the Hemisphere title containing the hemisphere name. Use a Python dictionary to store the data using the keys `img_url` and `title`. * Append the dictionary with the image url string and the hemisphere title to a list. This list will contain one dictionary for each hemisphere. ```python # Example: hemisphere_image_urls = [ {"title": "Valles Marineris Hemisphere", "img_url": "..."}, {"title": "Cerberus Hemisphere", "img_url": "..."}, {"title": "Schiaparelli Hemisphere", "img_url": "..."}, {"title": "Syrtis Major Hemisphere", "img_url": "..."}, ] ``` - - - ## Step 2 - MongoDB and Flask Application Use MongoDB with Flask templating to create a new HTML page that displays all of the information that was scraped from the URLs above. * Start by converting your Jupyter notebook into a Python script called `scrape_mars.py` with a function called `scrape` that will execute all of your scraping code from above and return one Python dictionary containing all of the scraped data. * Next, create a route called `/scrape` that will import your `scrape_mars.py` script and call your `scrape` function. * Store the return value in Mongo as a Python dictionary. * Create a root route `/` that will query your Mongo database and pass the mars data into an HTML template to display the data. * Create a template HTML file called `index.html` that will take the mars data dictionary and display all of the data in the appropriate HTML elements. Use the following as a guide for what the final product should look like, but feel free to create your own design.  - - - ## Step 3 - Submission To submit your work to BootCampSpot, create a new GitHub repository and upload the following: 1. The Jupyter Notebook containing the scraping code used. 2. Screenshots of your final application. 3. Submit the link to your new repository to BootCampSpot. 4. Ensure your repository has regular commits and a thorough README.md file ## Hints * Use Splinter to navigate the sites when needed and BeautifulSoup to help find and parse out the necessary data. * Use Pymongo for CRUD applications for your database. For this homework, you can simply overwrite the existing document each time the `/scrape` url is visited and new data is obtained. * Use Bootstrap to structure your HTML template.
rus1ru /
A Python tool that converts instructional PDF documents into executable Jupyter notebooks, using Groq's LLM API to intelligently detect and separate code blocks from explanatory text.
27/100 healthDevelop a Python-based application within a Jupyter Notebook that uses the GPT API to convert natural language queries into SQL queries. These SQL queries should be executed on a database containing credit card fraud data, and the results should be displayed as a DataFrame.
44/100 healthastropy-learn /
This is an action to execute and convert Jupyter notebooks using jupyter-book.
32/100 healthStephen-McDaniel /
Batch-execute Jupyter Notebooks from the command line: automatically convert them to Python scripts, record and append execution logs, and capture exact runtime (in seconds) for seamless archival and reproducibility.
37/100 health