Skip to content

Commit

Permalink
first Data Science Sciprog 2018 commit
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidLeoni committed Sep 21, 2018
1 parent 307cfee commit c8d3424
Show file tree
Hide file tree
Showing 12 changed files with 392 additions and 2,861 deletions.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@

# Jupman
# DataSciproLab

Jupyter Python 3 worksheets build system and exam manager, see manual at [http://jupman.readthedocs.io](jupman.readthedocs.io)

Jupman uses [NbSphinx](http://nbsphinx.readthedocs.io/) and [ReadTheDocs](https://readthedocs.org).
Source code as Jupyter Python worksheets for algorithms lab of Scientific Programming course (Data Science master, University of Trento)


For Students:

* Officiale course website is here [datasciprolab.readthedocs.org](http://datasciprolab.readthedocs.org)
* In this repository you will find the pages for building the website, the only thing interesting to you
should be the [exercises folder](exercises)


For instructors: see [Jupman](http://jupman.readthedocs.io)
56 changes: 3 additions & 53 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,9 @@

# Changelog

Jupman Jupyter Manager http://jupman.readthedocs.com
DataSciproLab http://datasciprolab.readthedocs.com


## 1.0, September 19th, 2018

- fixed build.py
- added html templates examples
- cleaned toc (was showing too much when loading)


## 0.9, August 26th, 2018

- implemented generation of exercises from solutions
see https://github.com/DavidLeoni/jupman/issues/14
- reverted to old jupman.init() code
see https://github.com/DavidLeoni/jupman/issues/12

## v0.8, August 12th, 2018

- Prepended all functions in jupman.py with `jupman_`

- replaced index with proper homepage.
see https://github.com/DavidLeoni/jupman/issues/11

- from now on you need home.ipynb file, because replacing index.rst is a nightmare!
- new index.rst is just a placeholder which simply redirects to home.html. Do not modify it.
- put the toctree in toc.rst

- exercises ipynb can now stay in exercises/ folder; when exercises are zipped,
jupman automatically adds to the zip the required site files.
see https://github.com/DavidLeoni/jupman/issues/12

- Tried %run at beginning of notebooks, without much satisfaction
(see discussion in https://github.com/DavidLeoni/jupman/issues/12):

- disabled toc by default in html files. To enable it, in python use `%run -i ../../jupman --toc`
- renamed past-exams directory from 'past-exams' to 'exams'
- created `info`, `error`, `warn`, `fatal` functions to `conf.py`
- introduced new variable `exercise_common_files` in `conf.py` for common files to be zipped
- added pages `exam-project` , `markdown` , `project-ideas`,
- added `cc-by.png`
- renamed `changelog.txt` to `changelog.md`
- now using templates with curly brackets in in templating, like `_JM_{some_property}`
- jupman.js : now when manually saving html in Jupyter, resulting html correctly hides cells
- Fixes https://github.com/DavidLeoni/jupman/issues/2 :
now toc is present in local build for pdfs

## V0.7 , August 3rd, 2018

- added jupman.py pytut() for displaying Python tutor in the cells
- added jupman.py toc=False option to jupman.py init to disable toc
- removed jupman.pyuseless networkx import from

- fixed usage indentation
- added changelog.txt
## 0.1, September 2018

Site is born
228 changes: 228 additions & 0 deletions commandments.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Commandments\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The Supreme Committee for the Doctrine of Coding has emanated wise rules for you to follow. \n",
"\n",
"If you do follow, you shall become a true Python Jedi."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<div class=\"alert alert-warning\">\n",
"\n",
"**WARNING**: If you do not follow, you shall fail miserably\n",
"</div>\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"<div class=\"alert alert-info\" >\n",
"**COMMANDMENT 1**: You shall test!\n",
"</div>\n",
"\n",
"To run tests, enter the following command in the terminal:\n",
"\n",
"\n",
"Windows Anaconda:\n",
"\n",
"```bash\n",
" python -m unittest my-file\n",
"```\n",
"\n",
"Linux/Mac: remember the three after python command:\n",
"\n",
"```bash\n",
" python3 -m unittest my-file\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<div class=\"alert alert-warning\">\n",
"\n",
"**WARNING:** In the call above, DON'T append the extension <i>.py</i> to <i>my-file</i>\n",
"<br/>\n",
"**WARNING:** Still, on the hard-disk the file MUST be named with a _.py_ at the end, like _my-file.py_\n",
"<br/>\n",
"**WARNING:** If strange errors occur, make sure to be using python version **3**. Just run the interpreter and it will display the current version.\n",
"</div>\n",
"\n",
"<div class=\"alert alert-info\" >\n",
"\n",
"**COMMANDMENT 2:** You shall also write on paper!\n",
"</div>\n",
"\n",
"If staring at the monitor doesn't work, help yourself and draw a representation of the state sof the program. \n",
"Tables, nodes, arrows, all can help figuring out a solution for the problem. \n",
"<br/>\n",
"<br/>\n",
"<div class=\"alert alert-info\" >\n",
"\n",
"**COMMANDMENT 3:** You shall copy *exactly the same* function definitions as in the exercises!\n",
"</div>\n",
"\n",
"For example don't write :\n",
"\n",
"```python\n",
" def MY_selection_sort(A): \n",
"```\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<div class=\"alert alert-info\" >\n",
"\n",
"**COMMANDMENT 4:** You shall never ever reassign function parameters:\n",
"</div>\n",
"\n",
"```python\n",
"\n",
" def myfun(i, s, L, D):\n",
"\n",
" # You shall not do any of such evil, no matter what the type of the parameter is:\n",
" i = 666 # basic types (int, float, ...)\n",
" s = \"666\" # strings\n",
" L = [666] # containers \n",
" D = {\"evil\":666} # dictionaries\n",
"\n",
" # For the sole case of composite parameters like lists or dictionaries, \n",
" # you can write stuff like this IF AND ONLY IF the function specification \n",
" # requires you to modify the parameter internal elements (i.e. sorting a list\n",
" # or changing a dictionary field):\n",
"\n",
" L[4] = 2 # list\n",
" D[\"my field\"] = 5 # dictionary\n",
" C.my_field = 7 # class\n",
"```\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<div class=\"alert alert-info\">\n",
"\n",
"**COMMANDMENT 5: You shall never ever reassign `self`:** \n",
"</div>\n",
"\n",
"Never ever write horrors such as:\n",
"\n",
"```python\n",
"\n",
"class MyClass\n",
" def my_method(self, x, y):\n",
" self = {a:666} # since self is a kind of dictionary, you might be tempted to do like this\n",
" # but to the outside world this will bring no effect.\n",
" # For example, let's say somebody from outside makes a call like this:\n",
" # mc = MyClass()\n",
" # mc.my_method()\n",
" # after the call mc will not point to {a:666}\n",
" self = ['666'] # self is only supposed to be a sort of dictionary and passed from outside\n",
" self = 6 # self is only supposed to be a sort of dictionary and passed from outside\n",
"```\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"<div class=\"alert alert-info\" >\n",
"\n",
"**COMMANDMENT 6:** You shall never ever assign values to method calls:\n",
"</div>\n",
"\n",
"_WRONG WRONG STUFF:_\n",
"\n",
"```python\n",
"\n",
"my_fun() = 666\n",
"my_fun() = '666'\n",
"my_fun() = [666]\n",
"\n",
"```\n",
"\n",
"_CORRECT STUFF:_ \n",
"\n",
"With the assignment operator we want to store in the left side a value from the right side, so all of these are valid operations:\n",
"\n",
"```python\n",
"x = 5\n",
"y = my_fun()\n",
"z = []\n",
"z[0] = 7\n",
"d = {}\n",
"d[\"a\"] = 6\n",
"```\n",
"\n",
"Function calls such as `my_fun()` return instead results of calculations in a box that is created just for the purpose of the call and Python will just not allow us to reuse it as a variable. So whenever you see 'name()' at the left side, it _can't_ be possibly follewed by one equality `=` sign (but it can be followed by two equality signs `==` if you are performing a comparison). \n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<div class=\"alert alert-info\" >\n",
"\n",
"**COMMANDMENT 7:** You shall use `return` command only if you see written _return_ in the function description!\n",
"</div>\n",
"\n",
"If there is no `return` in function description, the function is intended to return `None`. In this case you don't even need to write `return None`, as Python will do it implicitly for you."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": false,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 2
}
14 changes: 7 additions & 7 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@

################### TODO EDIT AS NEEDED !! ####################

course = "TODO CHANGE COURSE"
degree = "TODO CHANGE DEGREE"
author = 'TODO CHANGE NAME'
copyright = '# TODO FIRST YEAR - %s, %s' % (datetime.datetime.now().year, author)
course = "Data Science Scientific Programming Lab"
degree = "Data Science @ University of Trento"
author = 'David Leoni'
copyright = '# 2018 - %s, %s' % (datetime.datetime.now().year, author)

##### 'filename' IS *VERY* IMPORTANT !!!!
##### IT IS PREPENDED IN MANY GENERATED FILES
##### AND IT SHOULD ALSO BE THE SAME NAME ON READTHEDOCS
##### (like i.e. jupman.readthedocs.org)

filename = 'jupman' # The filename without the extension
filename = 'datasciprolab' # The filename without the extension

# common files for exercise and exams as paths. Paths are intended relative to the project root. Globs are allowed.
# note 'overlay/_static/css','overlay/_static/js' are automatically injected when you call jupman.init()
exercise_common_files = ['jupman.py', 'my_lib.py', 'img/cc-by.png' ]
exercise_common_files = ['jupman.py', 'sciprog.py', 'img/cc-by.png' ]


# words used in ipynb files - you might want to translate these in your language. Use plural.
Expand Down Expand Up @@ -75,7 +75,7 @@
}
MANUALS = {
"student": {
"name" : "Jupman", # TODO put manual name, like "Scientific Programming"
"name" : "DS Sciprog Lab", # TODO put manual name, like "Scientific Programming"
"audience" : "studenti",
"args" : "",
"output" : "",
Expand Down

0 comments on commit c8d3424

Please sign in to comment.