earthlab / dev-earthlab-site

Development of active learning focused data intensive university classroom materials.
MIT License
0 stars 3 forks source link

Libraries associated with languages #28

Closed lwasser closed 7 years ago

lwasser commented 7 years ago

Ok - now we have a final workflow to figure out. We have lots of lessons that use lots of libraries. We need code to query the lessons and create a list like this of libraries. Now i understand this will be difficult because we don't have nested lists that differentiate between R and python.

Here is the YAML list now.

- lang: python
  libs:
    - rpy2
    - h5py
- lang: r
  libs:
    - raster
    - rhdf5
    - base
- lang: javascript
  libs:

I added javascript. But we need

  1. to have each library listed in it's appropriate spot
  2. to have each library have an associated .md file in the : https://github.com/earthlab/dev-earthlab-site/tree/master/org/lang-lib directory

So... what is our workflow? I'll get the code working (it's not currently) and will create a few seed pages. Maybe we just auto generate a library list using my rmd code? And there are only a few lessons that have two languages so actually it won't be too hard to look at language and then library and generate a list like the one above but that maybe also has a fourth category (R & python) ? thoughts @mbjoseph

Sorry i'm bombarding you with issues! just trying to knock this out so we can push the site live.

lwasser commented 7 years ago

We can generalize this code which is now authors based, to make a list of any YAML element by turning this function generate_author_df

into generate_values_df

Then have the helper function take the file AND the yaml field we want to look at (ie authors, libs, etc)

mbjoseph commented 7 years ago

The function is now generalized to accept field as a parameter with commit b66cdcb73af1716e192ebd59c110a17c39e04419

lwasser commented 7 years ago

@mbjoseph -i just realized that the YAML is slightly different for library posts. Please see example below. I didn't think through the differences. can we just add an if statement for "lib:" vs "authors"?

---
layout: post-by-category
category: tutorials
title: "h5py Package - Python Data Intensive Tutorials"
permalink: tutorials/software/python/h5py
comments: false
author_profile: false
language: python
library: h5py
langSide: true
---

The files should be stored in the following dir:

/org/lang-lib/libs/

mbjoseph commented 7 years ago

Ok I think I've solved this with commits 5a2fa82453d994fc66c44d34a78541b32af6512b and https://github.com/earthlab/dev-earthlab-site/commit/93cad6b2c1303f15f412714abc1ca28a047d1dd3

Every step is automated except for writing the lang and lib in the frontmatter of posts. Just a note that all of this depends on each lib being specific to only one language, and each post being tagged with only one language (the post that uses R within Python is currently tagged as Python, and I think that's ok https://raw.githubusercontent.com/earthlab/dev-earthlab-site/master/_posts/python/2016-06-28-using-python-r-same-jupyter-notebook.md)