Skip to content

Commit c1c5fd4

Browse files
committed
Merge pull request ricardoduarte#3 from luisgustavoneves/master
chapters 8-15
2 parents 2d0171d + 91a3fc8 commit c1c5fd4

26 files changed

+6087
-0
lines changed
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
{
2+
"metadata": {
3+
"name": ""
4+
},
5+
"nbformat": 3,
6+
"nbformat_minor": 0,
7+
"worksheets": [
8+
{
9+
"cells": [
10+
{
11+
"cell_type": "markdown",
12+
"metadata": {},
13+
"source": [
14+
"[Python for Developers](http://ricardoduarte.github.io/python-for-developers/#content)\n",
15+
"===================================\n",
16+
"First Edition\n",
17+
"-----------------------------------\n",
18+
"\n",
19+
"Chapter 10: Packages\n",
20+
"=============================\n",
21+
"_____________________________\n",
22+
"Packages are folders that are identified by the interpreter by the presence of a file named `__init__.py`. Packages work as collections to organize hierarchically modules.\n",
23+
"\n",
24+
"![Package](files/bpypd_diags8.png)\n",
25+
"\n",
26+
"You can import all package modules using the statement `from packagename import *`.\n",
27+
"\n",
28+
"The `__init__.py` file can be empty or contain package initialization code or define a variable called `__all__`, a list of modules of the package that will be imported when using \"*\". Without the file, Python does not recognize the folder as a valid packet."
29+
]
30+
},
31+
{
32+
"cell_type": "code",
33+
"collapsed": false,
34+
"input": [],
35+
"language": "python",
36+
"metadata": {},
37+
"outputs": [
38+
{
39+
"html": [
40+
"<style>\n",
41+
" @font-face {\n",
42+
" font-family: \"Computer Modern\";\n",
43+
" src: url('http://mirrors.ctan.org/fonts/cm-unicode/fonts/otf/cmunss.otf');\n",
44+
" }\n",
45+
" div.cell{\n",
46+
" width:800px;\n",
47+
" margin-left:16% !important;\n",
48+
" margin-right:auto;\n",
49+
" }\n",
50+
" h1 {\n",
51+
" font-family: Helvetica, serif;\n",
52+
" }\n",
53+
" h4{\n",
54+
" margin-top:12px;\n",
55+
" margin-bottom: 3px;\n",
56+
" }\n",
57+
" div.text_cell_render{\n",
58+
" font-family: Computer Modern, \"Helvetica Neue\", Arial, Helvetica, Geneva, sans-serif;\n",
59+
" line-height: 145%;\n",
60+
" font-size: 130%;\n",
61+
" width:800px;\n",
62+
" margin-left:auto;\n",
63+
" margin-right:auto;\n",
64+
" }\n",
65+
" .CodeMirror{\n",
66+
" font-family: \"Source Code Pro\", source-code-pro,Consolas, monospace;\n",
67+
" }\n",
68+
" .note{\n",
69+
" border-bottom: 1px black dotted;\n",
70+
" }\n",
71+
" .prompt{\n",
72+
" display: None;\n",
73+
" }\n",
74+
" .text_cell_render h5 {\n",
75+
" font-weight: 300;\n",
76+
" font-size: 16pt;\n",
77+
" color: #4057A1;\n",
78+
" font-style: italic;\n",
79+
" margin-bottom: .5em;\n",
80+
" margin-top: 0.5em;\n",
81+
" display: block;\n",
82+
" }\n",
83+
" \n",
84+
" .warning{\n",
85+
" color: rgb( 240, 20, 20 )\n",
86+
" } \n",
87+
"</style>\n",
88+
"<script>\n",
89+
" MathJax.Hub.Config({\n",
90+
" TeX: {\n",
91+
" extensions: [\"AMSmath.js\"]\n",
92+
" },\n",
93+
" tex2jax: {\n",
94+
" inlineMath: [ ['$','$'], [\"\\\\(\",\"\\\\)\"] ],\n",
95+
" displayMath: [ ['$$','$$'], [\"\\\\[\",\"\\\\]\"] ]\n",
96+
" },\n",
97+
" displayAlign: 'center', // Change this to 'center' to center equations.\n",
98+
" \"HTML-CSS\": {\n",
99+
" styles: {'.MathJax_Display': {\"margin\": 4}}\n",
100+
" }\n",
101+
" });\n",
102+
"</script>"
103+
],
104+
"output_type": "pyout",
105+
"prompt_number": 1,
106+
"text": [
107+
"<IPython.core.display.HTML at 0x50f8f98>"
108+
]
109+
}
110+
],
111+
"prompt_number": 1
112+
}
113+
],
114+
"metadata": {}
115+
}
116+
]
117+
}

Chapter10/Chapter10_Packages.ipynb

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
{
2+
"metadata": {
3+
"name": ""
4+
},
5+
"nbformat": 3,
6+
"nbformat_minor": 0,
7+
"worksheets": [
8+
{
9+
"cells": [
10+
{
11+
"cell_type": "markdown",
12+
"metadata": {},
13+
"source": [
14+
"[Python for Developers](http://ricardoduarte.github.io/python-for-developers/#content)\n",
15+
"===================================\n",
16+
"First Edition\n",
17+
"-----------------------------------\n",
18+
"\n",
19+
"Chapter 10: Packages\n",
20+
"=============================\n",
21+
"_____________________________\n",
22+
"Packages are folders that are identified by the interpreter by the presence of a file named `__init__.py`. Packages work as collections to organize hierarchically modules.\n",
23+
"\n",
24+
"![Package](files/bpypd_diags8.png)\n",
25+
"\n",
26+
"You can import all package modules using the statement `from packagename import *`.\n",
27+
"\n",
28+
"The `__init__.py` file can be empty or contain package initialization code or define a variable called `__all__`, a list of modules of the package that will be imported when using \"*\". Without the file, Python does not recognize the folder as a valid packet."
29+
]
30+
},
31+
{
32+
"cell_type": "code",
33+
"collapsed": false,
34+
"input": [],
35+
"language": "python",
36+
"metadata": {},
37+
"outputs": [
38+
{
39+
"html": [
40+
"<style>\n",
41+
" @font-face {\n",
42+
" font-family: \"Computer Modern\";\n",
43+
" src: url('http://mirrors.ctan.org/fonts/cm-unicode/fonts/otf/cmunss.otf');\n",
44+
" }\n",
45+
" div.cell{\n",
46+
" width:800px;\n",
47+
" margin-left:16% !important;\n",
48+
" margin-right:auto;\n",
49+
" }\n",
50+
" h1 {\n",
51+
" font-family: Helvetica, serif;\n",
52+
" }\n",
53+
" h4{\n",
54+
" margin-top:12px;\n",
55+
" margin-bottom: 3px;\n",
56+
" }\n",
57+
" div.text_cell_render{\n",
58+
" font-family: Computer Modern, \"Helvetica Neue\", Arial, Helvetica, Geneva, sans-serif;\n",
59+
" line-height: 145%;\n",
60+
" font-size: 130%;\n",
61+
" width:800px;\n",
62+
" margin-left:auto;\n",
63+
" margin-right:auto;\n",
64+
" }\n",
65+
" .CodeMirror{\n",
66+
" font-family: \"Source Code Pro\", source-code-pro,Consolas, monospace;\n",
67+
" }\n",
68+
" .note{\n",
69+
" border-bottom: 1px black dotted;\n",
70+
" }\n",
71+
" .prompt{\n",
72+
" display: None;\n",
73+
" }\n",
74+
" .text_cell_render h5 {\n",
75+
" font-weight: 300;\n",
76+
" font-size: 16pt;\n",
77+
" color: #4057A1;\n",
78+
" font-style: italic;\n",
79+
" margin-bottom: .5em;\n",
80+
" margin-top: 0.5em;\n",
81+
" display: block;\n",
82+
" }\n",
83+
" \n",
84+
" .warning{\n",
85+
" color: rgb( 240, 20, 20 )\n",
86+
" } \n",
87+
"</style>\n",
88+
"<script>\n",
89+
" MathJax.Hub.Config({\n",
90+
" TeX: {\n",
91+
" extensions: [\"AMSmath.js\"]\n",
92+
" },\n",
93+
" tex2jax: {\n",
94+
" inlineMath: [ ['$','$'], [\"\\\\(\",\"\\\\)\"] ],\n",
95+
" displayMath: [ ['$$','$$'], [\"\\\\[\",\"\\\\]\"] ]\n",
96+
" },\n",
97+
" displayAlign: 'center', // Change this to 'center' to center equations.\n",
98+
" \"HTML-CSS\": {\n",
99+
" styles: {'.MathJax_Display': {\"margin\": 4}}\n",
100+
" }\n",
101+
" });\n",
102+
"</script>"
103+
],
104+
"output_type": "pyout",
105+
"prompt_number": 1,
106+
"text": [
107+
"<IPython.core.display.HTML at 0x50f8f98>"
108+
]
109+
}
110+
],
111+
"prompt_number": 1
112+
}
113+
],
114+
"metadata": {}
115+
}
116+
]
117+
}

Chapter10/bpypd_diags8.png

93.2 KB
Loading

0 commit comments

Comments
 (0)