|
1 | | -# modernpython |
2 | | -Code use in Modern Python videos |
| 1 | +Modern Python: Big ideas, Little Code |
| 2 | +===================================== |
| 3 | + |
| 4 | +This code is offered as an accompaniment to a Python Video course |
| 5 | +by Raymond Hettinger. |
| 6 | + |
| 7 | +Raymond runs an international Python training and consulting |
| 8 | +company and is available for basic, intermediate, and advanced |
| 9 | +python training. |
| 10 | + |
| 11 | + |
| 12 | +Getting Setup |
| 13 | +------------- |
| 14 | + |
| 15 | +1) Install the latest Python 3.6 (at least 3.6.1) from |
| 16 | + https://www.python.org |
| 17 | + |
| 18 | +2) Setup and activate a virtual environment: |
| 19 | + |
| 20 | + $ python3.6 -m venv modernpython |
| 21 | + $ source modernpython/bin/activate |
| 22 | + |
| 23 | +3) Install the packages used in the code |
| 24 | + |
| 25 | + (modernpython) $ pip install pyflakes |
| 26 | + (modernpython) $ pip install bottle |
| 27 | + (modernpython) $ pip install pytest |
| 28 | + (modernpython) $ pip install hypothesis |
| 29 | + (modernpython) $ pip install mypy |
| 30 | + |
| 31 | + |
| 32 | +Resampling |
| 33 | +---------- |
| 34 | + |
| 35 | +This code demonstrates simulations, resampling, bootstrapping, |
| 36 | +hypothesis testing, and estimating confidence intervals. |
| 37 | + |
| 38 | + |
| 39 | +Machine Learning |
| 40 | +---------------- |
| 41 | + |
| 42 | +The `kmeans.py` file implements k-means from scratch. The |
| 43 | +`congress_data` directory has CSV files with the voting histories |
| 44 | +of senators in the 114th U.S. Congress. The `congress.py` file |
| 45 | +demonstrates ETL (extract-transfrom-load) and unsupervised |
| 46 | +machine learning (k-means) to analyze the voting clusters. |
| 47 | + |
| 48 | + |
| 49 | +Publisher Subscriber |
| 50 | +-------------------- |
| 51 | + |
| 52 | +This code implements a simple publisher-subscriber notification |
| 53 | +service. The `pubsub.py` implements the data model and core |
| 54 | +services. The `session.py` loads sample data. The `webapp.py` |
| 55 | +file runs a webserver for the application. The `views` directory |
| 56 | +has the Bottle templates and the `static` directory has the |
| 57 | +static resources (icons and photos). |
| 58 | + |
| 59 | +To start the service, run: |
| 60 | + |
| 61 | + (modernpython) $ python webapp.py |
| 62 | + |
| 63 | +Then point your browser to `http://localhost:8080/` |
| 64 | + |
| 65 | +The login information is in the `session.py` file. |
| 66 | + |
| 67 | + |
| 68 | +Testing |
| 69 | +------- |
| 70 | + |
| 71 | +The `quadratic.py` file is a module with a simple function to |
| 72 | +demonstrate various approaches to testing included in |
| 73 | +`test_quadratic.py`. |
| 74 | + |
| 75 | + |
| 76 | +Validation |
| 77 | +---------- |
| 78 | + |
| 79 | +The `pricing_tool.py` file is used to demonstrate the descriptor |
| 80 | +based data validation tools in `validators.py` |
| 81 | + |
0 commit comments