diff --git a/docs/conf.py b/docs/conf.py
index d732ac29f..9b24d3671 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -48,10 +48,10 @@
# General information about the project.
current_year = datetime.datetime.now().year
-project = u'pythonguide'
+project = 'pythonguide'
copyright = (u'2011-{} Kenneth Reitz'
' & Real Python.'
- ' CC BY-NC-SA 3.0').format(current_year)
+ ' CC BY-NC-SA 3.0').format(current_year)
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@@ -203,7 +203,7 @@
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'pythonguide.tex', u'Python Guide Documentation',
- u'Kenneth Reitz', 'manual'),
+ [u'Kenneth Reitz'], 1)
]
# The name of an image file (relative to this directory) to place at the top of
diff --git a/docs/dev/virtualenvs.rst b/docs/dev/virtualenvs.rst
index b4591e43b..fe6bd3f9e 100644
--- a/docs/dev/virtualenvs.rst
+++ b/docs/dev/virtualenvs.rst
@@ -156,7 +156,7 @@ when you share your project with others. You should get output similar to this
Adding requests to Pipfile's [packages]...
P.S. You have excellent taste! ✨ 🍰 ✨
-.. _Requests: http://docs.python-requests.org/en/master/
+.. _Requests: https://requests.readthedocs.io/en/latest/
Using installed packages
diff --git a/docs/intro/duction.rst b/docs/intro/duction.rst
index 16baebc0d..f0dc95278 100644
--- a/docs/intro/duction.rst
+++ b/docs/intro/duction.rst
@@ -33,7 +33,7 @@ include:
Perl's `CPAN `_. There is a thriving community
of very powerful Python frameworks and tools like
the `Django `_ web framework and the
- `NumPy `_ set of math routines.
+ `NumPy `_ set of math routines.
* **integration with other systems**
diff --git a/docs/scenarios/admin.rst b/docs/scenarios/admin.rst
index 07d263945..f6433c213 100644
--- a/docs/scenarios/admin.rst
+++ b/docs/scenarios/admin.rst
@@ -155,44 +155,42 @@ tests (net, CPU) fail, it will send an email.
# Package for email services:
import smtplib
import string
- MAX_NET_USAGE = 400000
+ MAX_NET_USAGE = 400000 # bytes per seconds
MAX_ATTACKS = 4
attack = 0
- counter = 0
while attack <= MAX_ATTACKS:
sleep(4)
- counter = counter + 1
- # Check the cpu usage
- if cpu_percent(interval = 1) > 70:
- attack = attack + 1
- # Check the net usage
- neti1 = net_io_counters()[1]
- neto1 = net_io_counters()[0]
+
+ # Check the net usage wit named tuples
+ neti1 = net_io_counters().bytes_recv
+ neto1 = net_io_counters().bytes_sent
sleep(1)
- neti2 = net_io_counters()[1]
- neto2 = net_io_counters()[0]
+ neti2 = net_io_counters().bytes_recv
+ neto2 = net_io_counters().bytes_sent
+
# Calculate the bytes per second
net = ((neti2+neto2) - (neti1+neto1))/2
- if net > MAX_NET_USAGE:
- attack = attack + 1
- if counter > 25:
- attack = 0
- counter = 0
+
+ # Check the net and cpu usage
+ if (net > MAX_NET_USAGE) or (cpu_percent(interval = 1) > 70):
+ attack+=1
+ elif attack > 1:
+ attack-=1
+
# Write a very important email if attack is higher than 4
TO = "you@your_email.com"
FROM = "webmaster@your_domain.com"
SUBJECT = "Your domain is out of system resources!"
text = "Go and fix your server!"
- BODY = string.join(("From: %s" %FROM,"To: %s" %TO,"Subject: %s" %SUBJECT, "",text), "\r\n")
+ string="\r\n"
+ BODY = string.join(("From: %s" %FROM,"To: %s" %TO,
+ "Subject: %s" %SUBJECT, "",text))
server = smtplib.SMTP('127.0.0.1')
server.sendmail(FROM, [TO], BODY)
server.quit()
-A full terminal application like a widely extended top which is based on
-psutil and with the ability of a client-server monitoring is
-`glance `_.
-
+A full terminal application like a widely extended top is `Glance `_, which is based on psutil and has the ability for client-server monitoring.
*******
Ansible
@@ -397,17 +395,3 @@ up. Buildout is primarily used to download and set up dependencies in `Python
eggs `_
format of the software being developed or deployed. Recipes for build tasks in
any environment can be created, and many are already available.
-
-
-*******
-Shinken
-*******
-
-`Shinken `_ is a modern, Nagios compatible
-monitoring framework written in Python. Its main goal is to give users a flexible
-architecture for their monitoring system that is designed to scale to large
-environments.
-
-Shinken is backwards-compatible with the Nagios configuration standard and
-plugins. It works on any operating system and architecture that supports Python,
-which includes Windows, Linux, and FreeBSD.
diff --git a/docs/scenarios/client.rst b/docs/scenarios/client.rst
index 1457fa479..c2d5c289b 100644
--- a/docs/scenarios/client.rst
+++ b/docs/scenarios/client.rst
@@ -28,7 +28,7 @@ your URLs, or to form-encode your POST data. Keep-alive and HTTP connection
pooling are 100% automatic, powered by urllib3, which is embedded within
Requests.
-- `Documentation `_
+- `Documentation `_
- `PyPi `_
- `GitHub `_
diff --git a/docs/scenarios/imaging.rst b/docs/scenarios/imaging.rst
index 7b0e71935..8fe7e08fe 100644
--- a/docs/scenarios/imaging.rst
+++ b/docs/scenarios/imaging.rst
@@ -62,7 +62,7 @@ Example
exif_data
There are more examples of the Pillow library in the
-`Pillow tutorial `_.
+`Pillow tutorial `_.
***************************
@@ -109,4 +109,4 @@ Example
There are more Python-implemented examples of OpenCV in this `collection of
tutorials
-`_.
+`_.
diff --git a/docs/scenarios/scientific.rst b/docs/scenarios/scientific.rst
index bb0547323..9a92fc9a0 100644
--- a/docs/scenarios/scientific.rst
+++ b/docs/scenarios/scientific.rst
@@ -47,7 +47,7 @@ Libraries
NumPy
-----
-`NumPy `_ is a low level library written in C (and
+`NumPy `_ is a low level library written in C (and
Fortran) for high level mathematical functions. NumPy cleverly overcomes the
problem of running slower algorithms on Python by using multidimensional arrays
and functions that operate on arrays. Any algorithm can then be expressed as a
diff --git a/docs/scenarios/scrape.rst b/docs/scenarios/scrape.rst
index 54747b295..527719200 100644
--- a/docs/scenarios/scrape.rst
+++ b/docs/scenarios/scrape.rst
@@ -28,7 +28,7 @@ lxml and Requests
`lxml `_ is a pretty extensive library written for parsing
XML and HTML documents very quickly, even handling messed up tags in the
process. We will also be using the
-`Requests `_ module instead of the
+`Requests `_ module instead of the
already built-in urllib2 module due to improvements in speed and readability.
You can easily install both using ``pip install lxml`` and
``pip install requests``.
diff --git a/docs/scenarios/xml.rst b/docs/scenarios/xml.rst
index 3bdf15b6c..24dab5869 100644
--- a/docs/scenarios/xml.rst
+++ b/docs/scenarios/xml.rst
@@ -81,3 +81,30 @@ and then you can access elements, attributes, and values like this:
xmltodict also lets you roundtrip back to XML with the unparse function,
has a streaming mode suitable for handling files that don't fit in memory,
and supports XML namespaces.
+
+**********
+xmlschema
+**********
+
+`xmlschema `_ provides support for using XSD-Schemas in Python.
+Unlike other XML libraries, automatic type parsing is available, so f.e. if the schema defines an element to be of type ``int``, the parsed ``dict`` will contain also an ``int`` value for that element.
+Moreover the library supports automatic and explicit validation of XML documents against a schema.
+
+.. code-block:: python
+
+ from xmlschema import XMLSchema, etree_tostring
+
+ # load a XSD schema file
+ schema = XMLSchema("your_schema.xsd")
+
+ # validate against the schema
+ schema.validate("your_file.xml")
+
+ # or
+ schema.is_valid("your_file.xml")
+
+ # decode a file
+ data = schmema.decode("your_file.xml")
+
+ # encode to string
+ s = etree_tostring(schema.encode(data))
diff --git a/docs/starting/install/osx.rst b/docs/starting/install/osx.rst
index d0aa601aa..4a8a8e03b 100644
--- a/docs/starting/install/osx.rst
+++ b/docs/starting/install/osx.rst
@@ -10,9 +10,10 @@ Installing Python 2 on Mac OS X
.. note::
Check out our :ref:`guide for installing Python 3 on OS X`.
-**Mac OS X comes with Python 2.7 out of the box.**
+**Mac OS X comes with Python 2.7 out of the box between versions 10.8 and 12.3.**
-You do not need to install or configure anything else to use Python. Having said
+If your Mac OS X version is between the above versions,
+you do not need to install or configure anything else to use Python. Having said
that, I would strongly recommend that you install the tools and libraries
described in the next section before you start building Python applications for
real-world use. In particular, you should always install Setuptools, as it makes
diff --git a/docs/starting/install3/osx.rst b/docs/starting/install3/osx.rst
index 37252d615..fa90fb93a 100644
--- a/docs/starting/install3/osx.rst
+++ b/docs/starting/install3/osx.rst
@@ -9,9 +9,10 @@ Installing Python 3 on Mac OS X
.. image:: /_static/photos/34435689480_2e6f358510_k_d.jpg
-**Mac OS X comes with Python 2.7 out of the box.**
+**Mac OS X comes with Python 2.7 out of the box between versions 10.8 and 12.3.**
-You do not need to install or configure anything else to use Python 2. These
+If your Mac OS X version is between the above versions,
+you do not need to install or configure anything else to use Python 2. These
instructions document the installation of Python 3.
The version of Python that ships with OS X is great for learning, but it's not
diff --git a/docs/writing/reading.rst b/docs/writing/reading.rst
index ad67ea3cb..465587074 100644
--- a/docs/writing/reading.rst
+++ b/docs/writing/reading.rst
@@ -43,10 +43,10 @@ reading. Each one of these projects is a paragon of Python coding.
Requests is an Apache2 Licensed HTTP library, written in Python,
for human beings.
-- `Tablib `_
+- `Tablib `_
Tablib is a format-agnostic tabular dataset library, written in Python.
.. todo:: Include code examples of exemplary code from each of the projects listed. Explain why it is excellent code. Use complex examples.
-.. todo:: Explain techniques to rapidly identify data structures and algorithms and determine what the code is doing.
+.. todo:: Explain techniques for rapidly identifying data structures and algorithms and determining what the code is doing.
diff --git a/docs/writing/style.rst b/docs/writing/style.rst
index 9858112de..d8c096a05 100644
--- a/docs/writing/style.rst
+++ b/docs/writing/style.rst
@@ -465,8 +465,7 @@ easy-to-read version of PEP 8 is also available at `pep8.org `
This is highly recommended reading. The entire Python community does their
best to adhere to the guidelines laid out within this document. Some project
-may sway from it from time to time, while others may
-`amend its recommendations `_.
+may sway from it from time to time, while others may amend its recommendations.
That being said, conforming your Python code to PEP 8 is generally a good idea
and helps make code more consistent when working on projects with other
diff --git a/runtime.txt b/runtime.txt
index 5a958026d..cc1923a40 100644
--- a/runtime.txt
+++ b/runtime.txt
@@ -1 +1 @@
-3.5
+3.8