100% found this document useful (1 vote)
28 views

Download DevOps in Python: Infrastructure as Python, 2nd Edition Moshe Zadka ebook All Chapters PDF

DevOps

Uploaded by

morzantaam
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
28 views

Download DevOps in Python: Infrastructure as Python, 2nd Edition Moshe Zadka ebook All Chapters PDF

DevOps

Uploaded by

morzantaam
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 65

Download Full Version ebook - Visit ebookmeta.

com

DevOps in Python: Infrastructure as Python, 2nd


Edition Moshe Zadka

https://ebookmeta.com/product/devops-in-python-
infrastructure-as-python-2nd-edition-moshe-zadka/

OR CLICK HERE

DOWLOAD NOW

Discover More Ebook - Explore Now at ebookmeta.com


Instant digital products (PDF, ePub, MOBI) ready for you
Download now and discover formats that fit your needs...

Start reading on any device today!

DevOps in Python: Infrastructure as Python 2nd Edition


Moshe Zadka

https://ebookmeta.com/product/devops-in-python-infrastructure-as-
python-2nd-edition-moshe-zadka-2/

ebookmeta.com

Patterns and Practices for Infrastructure as Code: With


examples in Python and Terraform (MEAP V08) Rosemary Wang

https://ebookmeta.com/product/patterns-and-practices-for-
infrastructure-as-code-with-examples-in-python-and-terraform-
meap-v08-rosemary-wang/
ebookmeta.com

Mastering Python Networking Your one stop solution to


using Python for network automation programmability and
DevOps 3rd Edition Eric Chou
https://ebookmeta.com/product/mastering-python-networking-your-one-
stop-solution-to-using-python-for-network-automation-programmability-
and-devops-3rd-edition-eric-chou/
ebookmeta.com

Introduction to Algorithms Data Structures 2 A solid


foundation for the real world of machine learning and data
analytics 1st Edition Bolakale Aremu
https://ebookmeta.com/product/introduction-to-algorithms-data-
structures-2-a-solid-foundation-for-the-real-world-of-machine-
learning-and-data-analytics-1st-edition-bolakale-aremu/
ebookmeta.com
Turmoil A Scottish Medieval Romance Crown Crosses Book 3
1st Edition Violet Malvik

https://ebookmeta.com/product/turmoil-a-scottish-medieval-romance-
crown-crosses-book-3-1st-edition-violet-malvik/

ebookmeta.com

Good Enough Mothers Practicing Nurture and Motherhood in


Chiapas Mexico 1st Edition J M Lopez

https://ebookmeta.com/product/good-enough-mothers-practicing-nurture-
and-motherhood-in-chiapas-mexico-1st-edition-j-m-lopez/

ebookmeta.com

Philosophy of Digital Currencies A Theory of Monetizing


Time 1st Edition Ugochukwu Chigoziem Ikpeazu

https://ebookmeta.com/product/philosophy-of-digital-currencies-a-
theory-of-monetizing-time-1st-edition-ugochukwu-chigoziem-ikpeazu/

ebookmeta.com

Probability and Statistics for Economists 12th Edition


Bruce Hansen

https://ebookmeta.com/product/probability-and-statistics-for-
economists-12th-edition-bruce-hansen/

ebookmeta.com

2022 CFA Level III SchweserNotes Book 1 Behavioral Finance


Capital Market Expectations and Asset Alocation 1st
Edition Kaplan Schweser
https://ebookmeta.com/product/2022-cfa-level-iii-schwesernotes-
book-1-behavioral-finance-capital-market-expectations-and-asset-
alocation-1st-edition-kaplan-schweser/
ebookmeta.com
Huge Working Hero Hard Working Hero 3 1st Edition Penny
Wylder

https://ebookmeta.com/product/huge-working-hero-hard-working-
hero-3-1st-edition-penny-wylder/

ebookmeta.com
DevOps in Python
Infrastructure as Python
Second Edition

Moshe Zadka
DevOps in Python: Infrastructure as Python
Moshe Zadka
Belmont, CA, USA

ISBN-13 (pbk): 978-1-4842-7995-3 ISBN-13 (electronic): 978-1-4842-7996-0


https://doi.org/10.1007/978-1-4842-7996-0

Copyright © 2022 by Moshe Zadka


This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the
material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation,
broadcasting, reproduction on microfilms or in any other physical way, and transmission or information
storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now
known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with
every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an
editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the
trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not
identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to
proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication,
neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or
omissions that may be made. The publisher makes no warranty, express or implied, with respect to the
material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Celestin Suresh John
Development Editor: James Markham
Coordinating Editor: Divya Modi
Copy Editor: Kim Burton
Cover designed by eStudioCalamar
Cover image designed by Pixabay
Distributed to the book trade worldwide by Springer Science+Business Media New York, 1 New York Plaza,
Suite 4600, New York, NY 10004-1562, USA. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-
[email protected], or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole
member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc
is a Delaware corporation.
For information on translations, please e-mail [email protected]; for reprint,
paperback, or audio rights, please e-mail [email protected].
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and
licenses are also available for most titles. For more information, reference our Print and eBook Bulk Sales
web page at http://www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is available to
readers on GitHub (github.com/apress). For more detailed information, please visit http://www.apress.
comhttps://github.com/Apress/DevOps-­in-­Python-­2nd-­ed-­
Printed on acid-free paper
Dedicated to A and N, my favorite two projects
Table of Contents
About the Author����������������������������������������������������������������������������������������������������� xi

About the Technical Reviewer������������������������������������������������������������������������������� xiii


Acknowledgments���������������������������������������������������������������������������������������������������xv

Introduction�����������������������������������������������������������������������������������������������������������xvii

Chapter 1: Installing Python������������������������������������������������������������������������������������� 1


1.1 OS Packages��������������������������������������������������������������������������������������������������������������������������� 1
1.2 Using pyenv����������������������������������������������������������������������������������������������������������������������������� 2
1.3 Building Python from Source�������������������������������������������������������������������������������������������������� 4
1.4 PyPy���������������������������������������������������������������������������������������������������������������������������������������� 5
1.5 Anaconda�������������������������������������������������������������������������������������������������������������������������������� 5
1.6 Summary�������������������������������������������������������������������������������������������������������������������������������� 6

Chapter 2: Packaging����������������������������������������������������������������������������������������������� 7
2.1 Virtual Environments��������������������������������������������������������������������������������������������������������������� 7
2.2 pip������������������������������������������������������������������������������������������������������������������������������������������� 9
2.3 Setup and Wheels����������������������������������������������������������������������������������������������������������������� 12
2.4 Binary Wheels����������������������������������������������������������������������������������������������������������������������� 16
2.5 m anylinux Wheels������������������������������������������������������������������������������������������������������������� 18
2.5.1 Self-Contained Wheels������������������������������������������������������������������������������������������������� 19
2.5.2 Portable Wheels������������������������������������������������������������������������������������������������������������ 19
2.5.3 manylinux Containers��������������������������������������������������������������������������������������������������� 20
2.5.4 Installing manylinux Wheels����������������������������������������������������������������������������������������� 20
2.6 tox���������������������������������������������������������������������������������������������������������������������������������������� 21
2.6.1 One Environment���������������������������������������������������������������������������������������������������������� 22
2.6.2 Multiple Environments�������������������������������������������������������������������������������������������������� 23
2.6.3 Multiple Differently Configured Environments�������������������������������������������������������������� 23
v
Table of Contents

2.7 Pip Tools�������������������������������������������������������������������������������������������������������������������������������� 26


2.8 Poetry������������������������������������������������������������������������������������������������������������������������������������ 28
2.8.1 Installing����������������������������������������������������������������������������������������������������������������������� 28
2.8.2 Creating������������������������������������������������������������������������������������������������������������������������ 29
2.8.3 Dependencies��������������������������������������������������������������������������������������������������������������� 31
2.8.4 Developing�������������������������������������������������������������������������������������������������������������������� 32
2.8.5 Building������������������������������������������������������������������������������������������������������������������������ 32
2.9 Pipenv����������������������������������������������������������������������������������������������������������������������������������� 33
2.10 DevPI����������������������������������������������������������������������������������������������������������������������������������� 34
2.11 pex and shiv������������������������������������������������������������������������������������������������������������������������ 37
2.11.1 pex������������������������������������������������������������������������������������������������������������������������������ 38
2.11.2 shiv����������������������������������������������������������������������������������������������������������������������������� 40
2.12 Summary���������������������������������������������������������������������������������������������������������������������������� 40

Chapter 3: Interactive Usage���������������������������������������������������������������������������������� 41


3.1 Native Console���������������������������������������������������������������������������������������������������������������������� 42
3.2 The Code Module������������������������������������������������������������������������������������������������������������������ 43
3.3 ptpython�������������������������������������������������������������������������������������������������������������������������������� 44
3.4 IPython���������������������������������������������������������������������������������������������������������������������������������� 45
3.5 JupyterLab���������������������������������������������������������������������������������������������������������������������������� 47
3.6 Summary������������������������������������������������������������������������������������������������������������������������������ 51

Chapter 4: OS Automation�������������������������������������������������������������������������������������� 53


4.1 Files�������������������������������������������������������������������������������������������������������������������������������������� 53
4.2 Processes������������������������������������������������������������������������������������������������������������������������������ 58
4.3 Networking��������������������������������������������������������������������������������������������������������������������������� 61
4.4 Summary������������������������������������������������������������������������������������������������������������������������������ 65

Chapter 5: Testing��������������������������������������������������������������������������������������������������� 67
5.1 Unit Testing��������������������������������������������������������������������������������������������������������������������������� 67
5.2 Mocks, Stubs, and Fakes������������������������������������������������������������������������������������������������������ 72
5.3 Testing Files�������������������������������������������������������������������������������������������������������������������������� 73

vi
Table of Contents

5.3.1 Testing with Subdirectories������������������������������������������������������������������������������������������ 74


5.3.2 Accelerating Tests with eatmydata������������������������������������������������������������������������������� 79
5.3.3 Accelerating Tests with tmpfs�������������������������������������������������������������������������������������� 82
5.4 Testing Processes����������������������������������������������������������������������������������������������������������������� 85
5.5 Testing Networking��������������������������������������������������������������������������������������������������������������� 90
5.6 Testing HTTP Clients�������������������������������������������������������������������������������������������������������������� 92

Chapter 6: Text Manipulation���������������������������������������������������������������������������������� 97


6.1 Bytes, Strings, and Unicode�������������������������������������������������������������������������������������������������� 97
6.2 Strings����������������������������������������������������������������������������������������������������������������������������������� 99
6.3 Regular Expressions����������������������������������������������������������������������������������������������������������� 102
6.4 JSON����������������������������������������������������������������������������������������������������������������������������������� 106
6.5 CSV�������������������������������������������������������������������������������������������������������������������������������������� 108
6.6 Summary���������������������������������������������������������������������������������������������������������������������������� 110

Chapter 7: HTTPX�������������������������������������������������������������������������������������������������� 111


7.1 Clients��������������������������������������������������������������������������������������������������������������������������������� 111
7.2 REST������������������������������������������������������������������������������������������������������������������������������������ 113
7.3 Security������������������������������������������������������������������������������������������������������������������������������� 115
7.4 Authentication��������������������������������������������������������������������������������������������������������������������� 117
7.5 Async client������������������������������������������������������������������������������������������������������������������������� 120
7.6 Summary���������������������������������������������������������������������������������������������������������������������������� 122

Chapter 8: Cryptography�������������������������������������������������������������������������������������� 123


8.1 Fernet���������������������������������������������������������������������������������������������������������������������������������� 123
8.2 PyNaCl��������������������������������������������������������������������������������������������������������������������������������� 125
8.3 Passlib�������������������������������������������������������������������������������������������������������������������������������� 130
8.4 TLS Certificates������������������������������������������������������������������������������������������������������������������� 133
8.5 Summary���������������������������������������������������������������������������������������������������������������������������� 138

vii
Table of Contents

Chapter 9: Paramiko��������������������������������������������������������������������������������������������� 139


9.1 SSH Security����������������������������������������������������������������������������������������������������������������������� 140
9.2 Client Keys�������������������������������������������������������������������������������������������������������������������������� 141
9.3 Host Identity������������������������������������������������������������������������������������������������������������������������ 143
9.4 Connecting�������������������������������������������������������������������������������������������������������������������������� 143
9.5 Running Commands������������������������������������������������������������������������������������������������������������ 145
9.6 Remote Files����������������������������������������������������������������������������������������������������������������������� 146
9.6.1 Metadata Management���������������������������������������������������������������������������������������������� 146
9.6.2 Upload������������������������������������������������������������������������������������������������������������������������ 147
9.6.3 Download�������������������������������������������������������������������������������������������������������������������� 148
9.7 Summary���������������������������������������������������������������������������������������������������������������������������� 148

Chapter 10: SaltStack������������������������������������������������������������������������������������������� 149


10.1 Salt Basics������������������������������������������������������������������������������������������������������������������������ 149
10.2 Salt Concepts�������������������������������������������������������������������������������������������������������������������� 154
10.3 Salt Formats���������������������������������������������������������������������������������������������������������������������� 158
10.4 Salt Extensions����������������������������������������������������������������������������������������������������������������� 161
10.4.1 States����������������������������������������������������������������������������������������������������������������������� 161
10.4.2 Execution������������������������������������������������������������������������������������������������������������������ 163
10.4.3 Utility������������������������������������������������������������������������������������������������������������������������ 164
10.4.4 Extra Third-Party Dependencies������������������������������������������������������������������������������� 165
10.5 Summary�������������������������������������������������������������������������������������������������������������������������� 166

Chapter 11: Ansible���������������������������������������������������������������������������������������������� 167


11.1 Ansible Basics������������������������������������������������������������������������������������������������������������������� 167
11.2 Ansible Concepts��������������������������������������������������������������������������������������������������������������� 170
11.3 Ansible Extensions������������������������������������������������������������������������������������������������������������ 172
11.4 Summary�������������������������������������������������������������������������������������������������������������������������� 174

viii
Table of Contents

Chapter 12: Containers����������������������������������������������������������������������������������������� 175


12.1 Choosing a Base Image���������������������������������������������������������������������������������������������������� 176
12.1.1 GNU C Library Support���������������������������������������������������������������������������������������������� 176
12.1.2 Long-Term Support��������������������������������������������������������������������������������������������������� 176
12.1.3 Avoiding Unexpected Changes��������������������������������������������������������������������������������� 176
12.2 Installing the Python Interpreter��������������������������������������������������������������������������������������� 177
12.2.1 conda������������������������������������������������������������������������������������������������������������������������ 178
12.2.2 Third-Party Repositories������������������������������������������������������������������������������������������� 178
12.2.3 Building Python in the Container������������������������������������������������������������������������������ 178
12.2.4 Python Base Image��������������������������������������������������������������������������������������������������� 179
12.3 Installing Python Applications������������������������������������������������������������������������������������������� 179
12.4 Optimizing Container Build Cache������������������������������������������������������������������������������������� 182
12.5 Rebuilding Containers������������������������������������������������������������������������������������������������������� 184
12.6 Container Security����������������������������������������������������������������������������������������������������������� 185
12.7 Summary�������������������������������������������������������������������������������������������������������������������������� 186

Chapter 13: Amazon Web Services����������������������������������������������������������������������� 187


13.1 Security����������������������������������������������������������������������������������������������������������������������������� 188
13.1.1 Configuring Access Keys������������������������������������������������������������������������������������������ 188
13.1.2 Creating Short-Term Tokens������������������������������������������������������������������������������������� 189
13.2 Elastic Computing Cloud (EC2)������������������������������������������������������������������������������������������ 191
13.2.1 Regions��������������������������������������������������������������������������������������������������������������������� 191
13.2.2 Amazon Machine Images����������������������������������������������������������������������������������������� 191
13.2.3 SSH Keys������������������������������������������������������������������������������������������������������������������ 192
13.2.4 Bringing up Machines����������������������������������������������������������������������������������������������� 193
13.2.5 Securely Logging In�������������������������������������������������������������������������������������������������� 194
13.2.6 Building Images�������������������������������������������������������������������������������������������������������� 195
13.3 Simple Storage Service (S3)��������������������������������������������������������������������������������������������� 196
13.3.1 Managing Buckets���������������������������������������������������������������������������������������������������� 197
13.4 Summary�������������������������������������������������������������������������������������������������������������������������� 200

ix
Table of Contents

Chapter 14: Kubernetes���������������������������������������������������������������������������������������� 201


14.1 Pods���������������������������������������������������������������������������������������������������������������������������������� 201
14.1.1 Liveness and Readiness������������������������������������������������������������������������������������������� 201
14.1.2 Configuration������������������������������������������������������������������������������������������������������������ 205
14.1.3 Python Sidecars�������������������������������������������������������������������������������������������������������� 211
14.2 REST API���������������������������������������������������������������������������������������������������������������������������� 212
14.3 Operators�������������������������������������������������������������������������������������������������������������������������� 213
14.3.1 Permissions�������������������������������������������������������������������������������������������������������������� 214
14.3.2 Custom Types����������������������������������������������������������������������������������������������������������� 214
14.3.3 Retrieval������������������������������������������������������������������������������������������������������������������� 217
14.3.4 Goal State����������������������������������������������������������������������������������������������������������������� 219
14.3.5 Comparison�������������������������������������������������������������������������������������������������������������� 220
14.3.6 Reconciliation����������������������������������������������������������������������������������������������������������� 222
14.3.7 Combining the Pieces����������������������������������������������������������������������������������������������� 223
14.4 Summary�������������������������������������������������������������������������������������������������������������������������� 224

Chapter 15: Terraform������������������������������������������������������������������������������������������ 225


15.1 JSON Syntax��������������������������������������������������������������������������������������������������������������������� 226
15.2 Generating Terraform Configurations�������������������������������������������������������������������������������� 228
15.3 Summary�������������������������������������������������������������������������������������������������������������������������� 230

Index��������������������������������������������������������������������������������������������������������������������� 231

x
About the Author
Moshe Zadka has been involved in the Linux community
since 1998, helping in Linux “installation parties.” He has
been programming Python since 1999 and has contributed
to the core Python interpreter. Moshe has been a DevOps/
SRE since before those terms existed, caring deeply about
software reliability, build reproducibility, and more. He has
worked in companies as small as three people and as big as
tens of thousands—and usually in a position where software
meets system administration.

xi
About the Technical Reviewer
Martyn Bristow is a software developer in the United
Kingdom. He began using Python as a researcher but is
now an experienced broad user of Python for data analysis,
software test automation, and DevOps. He currently builds
data analysis web apps in Python deployed to Kubernetes.
You can find Martyn on GitHub @martynbristow.

xiii
Acknowledgments
Thanks to my wife, Jennifer Zadka, without whose support I could not have written
this book.
Thanks to my parents, Yaacov and Pnina Zadka, who taught me how to learn.
Thanks to my advisor, Yael Karshon, who taught me how to write.
Thanks to Mahmoud Hashemi for inspiration and encouragement.
Thanks to Mark Williams for being there for me.
Thanks to Glyph Lefkowitz for teaching me about Python, programming, and being a
good person.
Thanks to Brennon Church and Andrea Ross, who supported my personal growth
and learning journey.

xv
Introduction
Python began as a language to automate an operating system: the Amoeba. A typical
Unix shell would be ill-suited since it had an API, not just textual file representations.
The Amoeba OS is a relic now. However, Python continues to be a useful tool for
automation of operations—the heart of typical DevOps work.
It is easy to learn and easy to write readable code is a necessity when a critical part of
the work is responding to a 4 a.m. alert and modifying some misbehaving program.
It has powerful bindings to C and C++, the universal languages of the operating
system—and yet is natively memory-safe, leading to few crashes at the automation layer.
Finally, although not true when it was created, Python is one of the most popular
languages. This means that it is relatively easy to hire people with Python experience and
easy to get training materials and courses for people who need to learn on the job.
This book guides you through how to take advantage of Python to automate
operations.
To get the most out of the book, you need to be somewhat familiar with Python. If
you are new to Python, there are many great resources to learn it, including the official
Python tutorial at docs.python.org. You also need to be somewhat familiar with Unix-like
operating systems like Linux, especially how to use the command line.

xvii
CHAPTER 1

Installing Python
Before you can use Python, you need to install it. Some operating systems, such as
macOS and some Linux variants, have Python preinstalled. Those versions of Python,
colloquially called system Python, often make poor defaults for people who want to
develop in Python.
The version of Python installed is often behind the latest practices. System
integrators often patch Python in ways that can lead to surprises. For example, Debian-
based Python is often missing modules like venv and ensurepip. macOS Python links
against a Mac shim around its native SSL library. Those things mean, especially when
starting and consuming FAQs and web resources, it is better to install Python from
scratch.
This chapter covers a few ways to do so and the pros and cons of each.

1.1 OS Packages
Volunteers have built ready-to-install packages for some of the more popular operating
systems.
The most famous is the deadsnakes PPA (Personal Package Archives). The dead in
the name refers to the fact that those packages are already built—with the metaphor
that sources are “alive.” Those packages are built for Ubuntu and usually support all the
versions of Ubuntu that are still supported upstream. Getting those packages is done
with a simple

$ sudo add-apt-repository ppa:deadsnakes/ppa


$ sudo apt update

1
© Moshe Zadka 2022
M. Zadka, DevOps in Python, https://doi.org/10.1007/978-1-4842-7996-0_1
Chapter 1 Installing Python

On macOS, the Homebrew third-party package manager has up-to-date Python


packages. An introduction to Homebrew is beyond the scope of this book. Homebrew
being a rolling release, the Python version is upgraded from time to time. While this
means that it is a useful way to get an up-to-date Python, it makes it a poor target for
reliably distributing tools.
It also has some downsides for doing day-to-day development. Since it upgrades
quickly after a new Python release, development environments can break quickly and
without warning. It also means that sometimes code can stop working; even if you are
careful to watch upcoming Python versions for breaking changes, not all packages will.
Homebrew is a good fit when needing a well-built up-to-date Python interpreter for a
one-off task. Writing a quick script to analyze data, or automate some APIs, is a good use
of Homebrew Python.
Finally, for Windows, it is possible to download an installer from Python.org for any
version of Python.

1.2 Using pyenv
pyenv tends to offer the highest return on investment for installing Python for local
development. The initial setup does have some subtleties. However, it allows installing
many side-by-side Python versions as needed. It also allows you to manage how each is
accessed—either using a per-user default or a per-directory default.
Installing pyenv itself depends on the operating system. On a macOS, the easiest
way is to install it via Homebrew. Note that in this case, pyenv itself might need to be
upgraded to install new versions of Python.
On a Unix-based operating system, such as Linux or FreeBSD, the easiest way to
install pyenv is by using the curl|bash command.

$ PROJECT=https://github.com/pyenv/pyenv-installer \
  PATH=raw/master/bin/pyenv-installer \
  curl -L $PROJECT/PATH | bash

Of course, this comes with its own security issues and could be replaced with a
two-step process where you can inspect the shell script before running or even use git-
checkout to pin to a specific revision.

$ git clone https://github.com/pyenv/pyenv-installer

2
Chapter 1 Installing Python

$ cd pyenv-installer
$ bash pyenv-installer

Unfortunately, pyenv does not work on Windows.


After installing pyenv, it is useful to integrate it with the running shell. You do this by
adding the following to the shell initialization file (e.g., .bash_profile).

export PATH="~/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

This allows pyenv to properly intercept all the necessary commands.


pyenv separates the notion of installed interpreters from available interpreters. Enter
the following to install a version.

$ pyenv install <version>

For CPython, <version> is the version number, such as 3.6.6 or 3.7.0rc1.


An installed version is distinct from an available version. Versions are available
globally (for a user) by using

$ pyenv global 3.7.0

or locally by using

$ pyenv local 3.7.0

Local means they are available in a given directory. This is done by putting a python-
version.txt file in this directory. This is important for version-controlled repositories,
but a few different strategies are used to manage those. One strategy is to add this file to
the ignored list. This is useful for heterogeneous teams or open source projects. Another
strategy is to check in the file so that the same version of Python is used in the repository.
Note that since pyenv is designed to install side-by-side versions of Python, it has no
concept of upgrading Python. A newer Python version needs to be installed with pyenv
and then set as the default.
By default, pyenv installs non-optimized versions of Python. If optimized versions
are needed, enter the following.

env PYTHON_CONFIGURE_OPTS="--enable-shared
                           --enable-optimizations

3
Chapter 1 Installing Python

                           --with-computed-gotos
                           --with-lto
                           --enable-ipv6" pyenv install

Let’s build a version that is pretty similar to binary versions from python.org.

1.3 Building Python from Source


The main challenge in building Python from source is that, in some sense, it is too
forgiving. It is all too easy to build it with one of the built-in modules disabled because its
dependency was not detected. This is why it is important to know which dependencies
are fragile and how to make sure a local installation is good.
The first fragile dependency is SSL. It is disabled by default and must be enabled
in Modules/Setup.dist. Carefully follow the instructions there about the location of the
OpenSSL library. If you have installed OpenSSL via system packages, it is usually in
/usr/. If you have installed it from source, it is usually in /usr/local.
The most important thing is to know how to test for it. When Python is done
building, run ./python.exe -c 'import _ssl'. That .exe is not a mistake; this is how
the build process calls the newly built executable, which is renamed to Python during
installation. If this succeeds, the SSL module was built correctly.
Another extension that can fail to build is SQLite. Since it is a built-in, many
third-party packages depend on it, even if you are not using it yourself. This means a
Python installation without the SQLite module is pretty broken. Test it by running
./python.exe -c 'import sqlite3'.
In a Debian-based system (such as Ubuntu), libsqlite3-dev is required for this
to succeed. In a Red Hat-based system (such as Fedora or CentOS), libsqlite3-dev is
required for this to succeed.
Next, check for _ctypes with ./python.exe -c 'import _ctypes'. If this fails,
likely, the libffi headers are not installed.
Finally, remember to run the built-in regression test suite after building from source.
This ensures that there have been no silly mistakes while building the package.

4
Chapter 1 Installing Python

1.4 PyPy
The usual implementation of Python is sometimes known as CPython to distinguish
it from the language proper. The most popular alternative implementation is PyPy, a
Python-based JIT implementation of Python in Python. Because it has a dynamic JIT
(just-in-time) compilation to assembly, it can sometimes achieve phenomenal speed-
ups (three times or even ten times) over regular Python.
There are sometimes challenges in using PyPy. Many tools and packages are
tested only with CPython. However, sometimes spending the effort to check if PyPy is
compatible with the environment is worth it if performance matters.
There are a few subtleties in installing Python from source. While it is theoretically
possible to translate using CPython, in practice, the optimizations in PyPy mean that
translating using PyPy works on more reasonable machines. Even when installing from
source, it is better to first install a binary version to bootstrap.
The bootstrapping version should be PyPy, not PyPy3. PyPy is written in the
Python 2 dialect, which is one of the only cases where worrying about the deprecation
is irrelevant since PyPy is a Python 2 dialect interpreter. PyPy3 is the Python 3 dialect
implementation, which is usually better in production as most packages are slowly
dropping support for Python 2.
The latest PyPy3 supports 3.5 features of Python, as well as f-strings. However, the
latest async features, added in Python 3.6, do not work.

1.5 Anaconda
The closest to a system Python that is still reasonable for use as a development platform
is Anaconda, a metadistribution. It is, in essence, an operating system on top of the
operating system. Anaconda has its grounding in the scientific computing community,
and so its Python comes with easy-to-install modules for many scientific applications.
Many of these modules are non-trivial to install from PyPI, requiring a complicated build
environment.
It is possible to install multiple Anaconda environments on the same machine. This
is handy when needing different Python versions or different versions of PyPI modules.
To bootstrap Anaconda, you can use the bash installer available at https://conda.
io/miniconda.html. The installer also modifies ~/.bash_profile to add the path to
conda, the installer.

5
Chapter 1 Installing Python

conda environments are created using conda create --name <name> and activated
using source conda activate <name>. There is no easy way to use inactivated
environments. It is possible to create a conda environment while installing packages:
conda create --name some-name python. You can specify the version using = – conda
create --name some-name python=3.5. It is also possible to install more packages into
a conda environment, using conda install package[=version], after the environment
has been activated. Anaconda has a lot of prebuilt Python packages, especially ones
that are non-trivial to build locally. This makes it a good choice if those packages are
important to your use case.

1.6 Summary
Running a Python program requires an interpreter installed on the system. Depending
on the operating system and the versions, there are several different ways to install
Python. Using the system Python is a problematic option. On macOS and Unix systems,
using pyenv is almost always the preferred option. On Windows, using the prepackaged
installers from Python.org is often a good idea.

6
CHAPTER 2

Packaging
One of the main strengths of Python is the ecosystem, the third-party packages on
PyPI. There are packages to do anything from running computations in parallel on GPUs
for machine learning to reducing the boilerplate needed for writing classes. This means
that a lot of the practical work with Python is handling the third-party dependencies.
The current packaging tooling is pretty good, but things have not always been this
way. It is important to understand which best practices are antiquated rituals based on
faulty assumptions but have some merit and are actually good ideas.
When dealing with packaging, there are two ways to interact. One is to be a
consumer wanting to use the functionality of a package. Another is to be the producer,
publishing a package. These describe, usually, different development tasks, not
different people.
It is important to have a solid understanding of the consumer side of packages before
moving to production. If the goal of a package publisher is to be useful to the package
user, it is crucial to imagine the last mile before starting to write a single line of code.

2.1 Virtual Environments
Virtual environments are often misunderstood because the concept of environments is
not clear. A Python environment refers to the root of the Python installation. The reason
an environment is important is because of the lib/site-packages subdirectory of that
root. The lib/site-packages subdirectory is where third-party packages are installed.
The most popular tool to add packages to an environment is pip, which is covered
in the next section. Before using pip, it is important to understand how virtual
environments work.
A real environment is based on Python installation, which means that to get a new
real environment, a new Python must be installed and often rebuilt. This is sometimes
an expensive proposition.

7
© Moshe Zadka 2022
M. Zadka, DevOps in Python, https://doi.org/10.1007/978-1-4842-7996-0_2
Chapter 2 Packaging

The advantage of a virtual environment is that it is cheap to set up and tear down.
Some modern Python tooling takes advantage of that, setting up and tearing down
virtual environments as a normal part of their operation. Setting up and tearing down
virtual environments, being cheap and fast, is also a common part of Python developer
workflow.
A virtual environment copies the minimum necessary out of the real environment to
mislead Python into thinking it has a new root. The precise file structure is less important
than remembering that the command to create a virtual environment is simple and fast.
Here, simple means that all the command does is copy some files and perhaps make
a few symbolic links. Because of that, there are a few failure modes—mostly when file
creation fails because of permission issues or a full disk.
There are two ways to use virtual environments: activated and inactivated. To use
an inactivated virtual environment, which is most common in scripts and automated
procedures, you explicitly call Python from the virtual environment.
This means that a virtual environment in /home/name/venvs/my-special-env
calling /home/name/venvs/my-special-env/bin/python has a Python process that uses
this environment. For example, /home/name/venvs/my-special-env/bin/python -m
pip runs pip but installs in the virtual environment.
Note that entrypoint–based scripts are installed alongside Python, so running
/home/name/venvs/my-special-env/bin/pip also installs packages in the virtual
environment.
The other way to use a virtual environment is to activate it. Activating a virtual
environment in a bash-like shell means sourcing its activated script.

$ source /home/name/venvs/my-special-env/bin/activate

The sourcing sets a few environment variables, only one of which is important. The
important variable is PATH, which gets prefixed by /home/name/venvs/my-special-env/
bin. This means that commands like python or pip are found there first. Two cosmetic
variables are set. $VIRTUAL_ENV points to the root of the environment. This is useful
in management scripts that want to be aware of virtual environments. PS1 is prefixed
with (my-special-env), which is useful for visualizing the virtual environment while
working interactively in the console.
It is generally a good practice to only install third-party packages inside a virtual
environment. Combined with the fact that virtual environments are cheap, if one gets
into a bad state, it is best to remove the whole directory and start from scratch.

8
Chapter 2 Packaging

For example, imagine a bad package install that causes the Python start-up to fail.
Even running pip uninstall is impossible since pip fails on start-up. However, the
cheapness means you can remove the whole virtual environment and re-create it with a
good set of packages.
A modern practice is to move increasingly toward treating virtual environments as
semi-immutable. After creating them, there is a single stage for installing all required
packages. Instead of modifying the virtual environment if an upgrade is required, destroy
the environment, re-create, and reinstall.
The modern way to create virtual environments is to use the venv standard library
module. This only works on Python 3. Since Python 2 has been strongly deprecated since
the beginning of 2020, it is best avoided in any case.
venv is used as a command with python -m venv <directory>, as there is no
dedicated entrypoint. It creates the directory for the environment.
It is best if this directory does not exist before that. A best practice is to remove
it before creating the environment. There are also two options for creating the
environment: which interpreter to use and what initial packages to install.

2.2 pip
The packaging tool for Python is pip. There have been other tools that have mostly been
abandoned by the community and should not be used.
Installations of Python used to not come with pip out of the box. This has changed
in recent versions, but many versions which are still supported do not have it. When
running on such a version, python -m ensurepip installs it.
Some Python installations, especially system ones, disable ensurepip. When
lacking ensurepip, there is a way of manually getting it: get-pip.py. This is a single
downloadable file that, when executed, unpacks pip.
Luckily, pip is the only package that needs these weird gyrations to install. All other
packages can, and should, be installed using pip.
For example, if sample-environment is a virtual environment, installing the glom
package can be done with the following code.

$ ./sample-environment/bin/python -m pip install glom


...
$ ./sample-environment/bin/python -m glom
{}
9
Chapter 2 Packaging

The last command tests that glom has been properly installed. Glom is a package
to handle deeply-nested data, and called with no arguments, outputs an empty Python
dictionary. This makes it handy for quickly testing whether a new virtual environment
can install new packages properly.
Internally, pip is also treated as a third-party package. Upgrading pip itself is done
with pip install --upgrade pip.
Depending on how Python was installed, its real environment might or might not
be modifiable by the user. Many instructions in various README files and blogs might
encourage using sudo pip install. This is almost always the wrong thing to do; it
installs the packages in the global environment.
The pip install command downloads and installs all dependencies. However,
it can fail to downgrade incompatible packages. It is always possible to install explicit
versions: pip install package-name==<version> installs this precise version. This is
also a good way for local testing to get explicitly non-general-availability packages, such
as release candidates, beta, or similar.
If wheel is installed, pip builds, and usually caches, wheels for packages. This is
especially useful when dealing with a high virtual environment churn since installing a
cached wheel is a fast operation. This is also highly useful when dealing with native or
binary packages that need to be compiled with a C compiler. A wheel cache eliminates
the need to build it again.
pip does allow uninstalling with pip uninstall <package>. This command, by
default, requires manual confirmation. Except for exotic circumstances, this command
is not used. If an unintended package has snuck in, the usual response is to destroy the
environment and rebuild it. For similar reasons, pip install --upgrade <package>
is not often needed; the common response is to destroy and re-create the environment.
There is one situation where it is a good idea.
pip install supports a requirements file: pip install --requirements or pip
install -r. The requirements file simply has one package per line. This is no different
from specifying packages on the command line. However, requirement files often specify
strict dependencies. A requirements file can be generated from an environment with
pip freeze.
Like most individual packages or wheels, installing anything that is not strict and
closed under requirements requires pip to decide which dependencies to install. The
general problem of dependency resolution does not have an efficient and complete
solution. Different strategies are possible to approach such a solution.

10
Chapter 2 Packaging

The way pip resolves dependencies is by using backtracking. This means that
it optimistically tries to download the latest possible requirements recursively. If a
dependency conflict is found, it backtracks; try a different option.
As an example, consider three packages.

• top

• middle

• base
There are two base versions: 1.0 and 2.0. The package dependencies are setup.
cfg files.
The following is for the top.

[metadata]
name = top
version = 1.0
[options]
install_requires =
    base
    middle

The following is for the middle.

[metadata]
name = middle
version = 1.0
[options]
install_requires =
    base<2.0

The base package has two versions: 1.0 and 2.0. It does not have any dependencies.
Because top depends directly on base, pre-backtracking versions of pip get the latest
and then have a failed resolution.

$ pip install top


Looking in links: .
Collecting top
Collecting middle (from top)

11
Chapter 2 Packaging

Collecting base (from top)


middle 1.0 has requirement base<2.0, but you'll have base 2.0 which is
incompatible.
Installing collected packages: base, middle, top
Successfully installed base-2.0 middle-1.0 top-1.0

The backtracking algorithm discards the base 2.0 version.

$ pip install top


Looking in links: .
Processing ./top-1.0-py3-none-any.whl
Processing ./base-2.0-py3-none-any.whl
Processing ./middle-1.0-py3-none-any.whl
Processing ./base-1.0-py3-none-any.whl
Installing collected packages: base, middle, top
Successfully installed base-1.0 middle-1.0 top-1.0

This solution has the advantage that it is complete, but it can take unfeasible amounts
of time in certain cases. This is rare, but merely taking a long time is not.
One way to increase the speed is to include >= dependencies in the loose
requirements. This is usually a good idea since packages are better at guaranteeing
backward compatibility than forward compatibility. As a side benefit, this can
dramatically reduce the solution space that pip needs to backtrack in.
In most scenarios, it is better to use strict requirements for day-to-day development
and regenerate the strict requirements from the loose requirements (which can take a
while) on a cadence that balances keeping up to date with churn.

2.3 Setup and Wheels


The term third party (as in third-party packages) refers to someone other than the
Python core developers (first-party) or the local developers (second-party). I have
covered how to install first-party packages in the installation section. You used pip and
virtualenv to install third-party packages. It is time to finally turn your attention to the
missing link: local development and installing local packages or second-party packages.
Note that the word package here means something different from post-installation.
In Python, a package is an importable directory, a way to keep multiple modules

12
Chapter 2 Packaging

together. The pedantic way to call installable things is distribution. A distribution can
correspond to no packages (it can be a top-level single-module distribution) or multiple
packages.
It is good to keep a 1-1-1 relationship when packaging things: a single distribution
corresponding to one package and named the same. Even if there is only one file, put it
as an __init__.py file under a directory.
Packaging is an area that has seen a lot of changes. Copying and pasting from
existing packages is not a good idea; good packages are, for the most part, mature
packages. Following the latest best practices means making changes to an existing
working process.
Starting with setuptools version 61.0.0, it is possible to create a package with only
two files besides the code files.

• pyproject.toml

• README.rst

The README is not strictly necessary. However, most source code management
systems display it rendered, so it is best to break it out into its own file.
Even an empty pyproject.toml generates a package. However, almost all packages
need at least a few more details.
The build-system is the one mandatory section in a non-empty pyproject.toml file.
It is usually the first.

[build-system]
requires = [
    "setuptools"
]
build-backend = "setuptools.build_meta"

Many systems can be used to build valid distributions. The setuptools system,
which used to be the only possibility, is now one of several. However, it is still the most
popular one.
Most of the rest of the data can be found in the project section.

[project]
name = "awesome_package"
version = "0.0.3"
description = "A pretty awesome package"

13
Chapter 2 Packaging

readme = "README.rst"
authors = [{name = "My Name",
            email = "[email protected]"}]
dependencies = ["httpx"]

For most popular code organizations, this is enough for the setuptools systems to
find the code and create a correct package.
There are ways to have setuptools treat the version as dynamic and take it from a
file or an attribute. An alternative is to take advantage of pyproject.toml in a structured
format and manipulate it directly.
For example, the following code uses a CalVer (calendar versioning) scheme of
YEAR.MONTH.release in a month. It uses the built-in zoneinfo module, which requires
Python 3.9 or above, and the tomlkit library, which supports roundtrip-preserving TOML
parsing and serialization.

import tomlkit
import datetime
import os
import pathlib
import zoneinfo

now = datetime.datetime.now(tz=zoneinfo.ZoneInfo("UTC"))
prefix=f"{now.year}.{now.month}."
pyproject = pathlib.Path("pyproject.toml")
data = tomlkit.loads(pyproject.read_text())
current = data["project"].get("version", "")
if current.startswith(prefix):
    serial = int(current.split(".")[-1]) + 1
else:
    serial = 0
version = prefix + str(serial)
data["project"]["version"] = version
pyproject.write_text(tomlkit.dumps(data))

Some utilities keep the version synchronized between several files; for example,
pyproject.toml and example_package/__init__.py. The best way to use these utilities
is by not needing to do it.

14
Chapter 2 Packaging

If example_package/__init__.py wants to expose the version number, the best way


is to calculate it using importlib.metadata.

# example_package/__init__.py
from importlib import metada
__version__ = metadata.distribution("example_package").version
del metadata # Keep top-level namespace clean

This avoids needing to keep more than one place in sync.


The field dependencies in pyproject.toml is present on almost every package. This
is how to mark other distributions that the code needs. It is a good practice to put loose
dependencies in pyproject.toml. This is in contrast to exact dependencies, which
specify a specific version. A loose dependency looks like Twisted>=17.5, specifying
a minimum version but no maximum. Exact dependencies, like Twisted==18.1, are
usually a bad idea in pyproject. toml. They should only be used in rare cases, for
example, when using significant chunks of a private API package.
The pyproject.toml file also allows defining entrypoints. Some frameworks, like
Pyramid, allow using entrypoints to add plugin-like features.
It also allows you to define scripts. These used to be console_scripts
entrypoints but now have their own section.

[project.scripts]
example-command = "example_package.commands:main"

The syntax is package.....module:function. This function is called with no


arguments when the script is being run.
Usually, this includes command-line parsing, but the following is a short example.

# example_package/commands.py
def main():
    print("an example")

In this example, running example-command causes the string to print.

$ example-command
an example

15
Chapter 2 Packaging

You can build a distribution with pyproject.toml, a README.rst, and some Python
code. There are several formats a distribution can take, but the one covered here is
the wheel.
After installing build using pip install build, run

python -m build --wheel

This creates a wheel under dist. If the wheel needs to be in a different directory,
add --outdir <output directory> to the command.
You can do several things with the wheel, but it is important to note that one thing
you can do is pip install <wheel file>. Doing this as part of continuous integration
makes sure the wheel, as built by the current directory, is functional.
It is possible to use python -m build to create a source distribution. This is usually a
good idea to accommodate use cases that prefer to install from source. These use cases
are esoteric, but generating the source distribution is easy enough to be worth it.

$ python -m build --sdist

It is possible to combine the --sdist and --wheel arguments into one run of
python -m build. This is also what python -m build does by default: create both a
source distribution and a wheel.
By default, python -m build installs any packages it needs to build the package in
a fresh virtual environment. When running python -m build in a tight edit-debug loop,
perhaps to debug a setup.cfg, this can get tedious. In those cases, create and activate a
virtual environment, and then run

$ python -m build --no-isolation

This installs its dependencies in the current environment. While this is not a good fit
for production use, this is a faster way to debug packaging issues.

2.4 Binary Wheels
Python is well known and often used as an integration language. One of the ways this
integration happens is by linking to native code.
This is usually done using the C Application Binary Interface (C ABI). The C ABI is
used not only for integrating with C libraries but with other languages, such as C++, Rust,
or Swift, which can generate C ABI-compatible interfaces.

16
Chapter 2 Packaging

There needs to be some glue code bridging the C ABI to Python to integrate Python
with such code. It is possible to write this code by hand.
This is a tedious and error-prone process, so code generators are often used. Cython
is a popular generator that uses a Python-compatible language. Although Cython is often
used to interface to C ABI libraries, it can be used to generate extensions without such
integration. This makes examples slightly simpler, so the following Cython code is used
as a running example.

#cython: language_level=3

def add(x, y):


    return x + y

This code is in the binary_module.pyx file. It is short and does just enough to be
clear if it works correctly.
To build code with native integration, the files that describe the build are slightly
more complicated.
The pyproject.toml file is no longer empty. It now has two lines.

[build-system]
requires = ["setuptools", "cython"]

This makes sure the cython package is installed before trying to build a wheel.
The setup.py is no longer minimal. It contains enough code to integrate
with Cython.

import setuptools
from Cython import Build

setuptools.setup(
    ext_modules=Build.cythonize("binary_module.pyx"),
)

The Cython.Build.cythonize function does two things.

• Creates (or re-creates) binary_module.c from binary_module.pyx.


• Returns an Extension object.

17
Another Random Scribd Document
with Unrelated Content
many cases. Filthy?—yes. Savage or dangerous?—not at all. I
noticed the large number of cheap cloth caps worn by the men and
boys and the large number of dull gray shawls wrapped slatternwise
about the shoulders of the women. This world looked sad enough in
all conscience, inexpressibly so, but because of the individual houses
in many instances, the clean streets and the dark tiny shops, not
unendurable—even homey in instances. I ventured to ask a stalwart
London policeman—they are all stalwart in London—“Where are the
very poor in the East End—the poorest there are?”
“Well, most of these people hereabouts have little enough to live
on,” he observed, looking straight before him with that charming
soldierly air the London policemen have—his black strap under his
chin.
I walked long distances through such streets as Old Montague,
King Edward, Great Carden, Hope, Brick Lane, Salesworthy, Flower,
Dean, Hare, Fuller, Church Row, Cheshire, Hereford,—a long, long
list, too long to give here, coming out finally at St. John’s Catholic
Church at Bethnal Green and taking a car line for streets still farther
out. I had studied shops, doorways, areas, windows, with constant
curiosity. The only variation I saw to a dead level of sameness,
unbroken by trees, green places or handsome buildings of any kind,
were factory chimneys and endless charitable institutions covering,
apparently, every form of human weakness or deficiency, but looking
as if they were much drearier than the thing they were attempting
to cure. One of them I remember was an institution for the orphans
of seamen, and another a hospital for sick Spanish Jews. The
lodging-houses for working-girls and working-boys were so
numerous as to be discouraging and so dreary looking that I
marveled that any boy or girl should endure to live in them. One
could sense all forms of abuse and distress here. It would spring
naturally out of so low a grade of intelligence. Only a Dickens,
guided by the lamp of genius, could get at the inward spirit of these,
and then perhaps it would not avail. Life, in its farthest reaches,
sinks to a sad ugly mess and stays there.
One of the places that I came upon in my perambulations was a
public washhouse, laundry and bath, established by the London
County Council, if I remember rightly, and this interested me greatly.
It was near Winchester Street and looked not unlike a low, one-
story, factory building. Since these things are always fair indications
of neighborhoods, I entered and asked permission to inspect it. I
was directed to the home or apartment of a small martinet of a
director or manager, quite spare and dark and cockney, who frowned
on me quizzically when he opened his door,—a perfect devil of a
cheap superior who was for putting me down with a black look. I
could see that it was one of the natives he was expecting to
encounter.
“I would like to look over the laundry and baths,” I said.
“Where do you come from?” he asked.
“America,” I replied.
“Oh! Have you a card?”
I gave him one. He examined it as though by some chance it
might reveal something concerning me. Then he said if I would go
round to the other side he would admit me. I went and waited a
considerable time before he appeared. When he did, it was to lead
me with a very uncertain air first into the room filled with homely
bath closets, where you were charged a penny more or less—
according to whether you had soap and towel or not—and where the
tubs were dreary affairs with damp-looking wooden tops or flanges,
and thence into the washroom and laundry-room, where at this time
in the afternoon—about four o’clock—perhaps a score of women of
the neighborhood were either washing or ironing.
Dreary! dreary! dreary! Ghastly! In Italy, later, and southern
France, I saw public washing under the sky, beside a stream or near
a fountain—a broken, picturesque, deliciously archaic fountain in one
instance. Here under gray skies, in a gray neighborhood, and in this
prison-like washroom was one of the most doleful pictures of life the
mind of man could imagine. Always when I think of the English, I
want to go off into some long analysis of their character. We have so
much to learn of life, it seems to me, and among the first things is
the chemistry of the human body. I always marvel at the nature of
the fluids which make up some people. Different climates must
produce different kinds, just as they produce strange kinds of trees
and animals. Here in England this damp, gray climate produces a
muggy sort of soul which you find au naturel only when you walk
among the very poor in such a neighborhood as this. Here in this
wash-house I saw the low English au naturel, but no passing
commentary such as this could do them justice. One would have to
write a book in order to present the fine differences. Weakness,
lowness of spirit, a vague comprehension of only the simplest things,
combined with a certain meaty solidarity, gave me the creeps. Here
they were, scrubbing or ironing; strings tied around their
protuberant stomachs to keep their skirts up; clothes the color of
lead or darker, and about as cheerful; hair gray or brownish-black,
thin, unkempt; all of them flabby and weary-looking—about the
atmosphere one would find in an American poorhouse.
They washed here because there were no washing facilities in
their own homes—no stationary tubs, no hot or cold water, no
suitable stoves to boil water on. It was equally true of ironing
facilities, the director told me. They came from blocks away. Some
women washed here for whole vicinities—the more industrious ones.
And yet few came here at that—the more self-respecting stayed
away. I learned this after a long conversation with my guide whose
principal commentary was that they were a worthless lot and that
you had to watch them all the time. “If you don’t,” he said in
cockney English, “they won’t keep things clean. You can’t teach ’em
scarcely how to do things right. Now and then they gets their hands
caught.” He was referring to the washing-drums and the mangles. It
was a long story, but all I got out of it was that this was a dreary
world, that he was sick of his position but compelled to keep it for
financial reasons, that he wanted as little as possible to do with the
kind of cattle which he considered these people to be and that he
would prefer to give it up. There was a touch of socialism in all this
—trying to do for the masses—but I argued that perhaps under
more general socialistic conditions things would be better; certainly,
one would have to secure more considerate feelings on the part of
directors and some public approval which would bring out the better
elements. Perhaps under truer socialism, however, public wash-
houses would not be necessary at all. Anyhow, the cry from here to
Bond Street and the Houses of Parliament and the stately world of
the Lords seemed infinitely far. What can society do with the sad,
shadowy base on which it rests?
I came another day to another section of this world, approaching
the East End via Aldgate and Commercial Road, and cutting through
to Bethnal Green via Stepney. I found the same conditions—clean
streets, low gray buildings, shabby people, a large museum whose
chief distinction was that the floor of its central rotunda had been
laid by women convicts!—and towering chimneys. So little life
existed in the streets, generally speaking, that I confess I was
depressed. London is so far flung. There were a great many Jews of
Russian, Roumanian and Slavic extraction, nearly all bearing the
marks of poverty and ignorance, but looking shrewd enough at that,
and a great many physically deteriorated English. The long-bearded
Jew with trousers sagging about his big feet, his small derby hat
pulled low over his ears, his hands folded tightly across his back,
was as much in evidence here as on the East Side in New York. I
looked in vain for restaurants or show places of any kind (saloons,
moving pictures, etc.). There were scarcely any here. This whole
vicinity seemed to me to be given up to the poorest kind of living—
sad, drab, gray. No wonder the policeman said to me: “Most of these
people hereabouts have little enough to live on.” I’m sure of it.
Finally, after a third visit, I consulted with another writer, a reputed
authority on the East End, who gave me a list of particular
neighborhoods to look at. If anything exceptional was to be detected
from the appearance of the people, beyond what I have noted, I
could not see it. I found no poor East End costers with buttons all
over their clothes, although they once existed here. I found no
evidence of the overcrowded home life, because I could not get into
the houses to see. Children, it seemed to me, were not nearly so
numerous as in similar areas in American cities. Even a police-court
proceeding I saw in Avon Square was too dull to be interesting. I
was told I might expect the most startling crimes. The two hours I
spent in court developed only drunkenness and adultery. But as my
English literary guide informed me, only time and familiarity with a
given neighborhood would develop anything. I believe this. All I felt
was that in such a dull, sordid, poor-bodied world any depth of filth
or crime might be reached, but who cares to know?
CHAPTER XV
ENTER SIR SCORP

D
URING all my stay at Bridgely Level I had been hearing
more or less—an occasional remark—of a certain Sir
Scorp, an Irish knight and art critic, a gentleman who had
some of the finest Manets in the world. He had given
Dublin its only significant collection of modern pictures—in fact,
Ireland should be substituted for Dublin, and for this he was
knighted. He was the art representative of some great museum in
South Africa—at Johannesburg, I think,—and he was generally
looked upon as an authority in the matter of pictures.

Barfleur came one evening to my hotel with the announcement


that Sir Scorp was coming down to Bridgely Level to spend Saturday
and Sunday, that he would bring his car and that together on
Sunday we three would motor to Oxford. Barfleur had an uncle who
was a very learned master of Greek at that University and who, if we
were quite nice and pleasant, might give us luncheon. We were, I
found, to take a little side trip on Saturday afternoon to a place
called Penn, some twenty or twenty-five miles from Bridgely Level, in
Buckinghamshire, whence William Penn had come originally.
Saturday was rainy and gloomy and I doubted whether we
should do anything in such weather, but Barfleur was not easily put
out. I wrote all morning in my alcove, while Barfleur examined
papers, and some time after two Sir Scorp arrived,—a pale, slender,
dark-eyed man of thirty-five or thereabouts, with a keen, bird-like
glance, a poised, nervous, sensitive manner, and that elusive,
subtlety of reference and speech which makes the notable
intellectual wherever you find him. For the ten thousandth time in
my life, where intellectuals are concerned, I noticed that peculiarity
of mind which will not brook equality save under compulsion. Where
are your credentials?—such minds invariably seem to ask. How do
you come to be what you think you are? Is there a flaw in your
intellectual or artistic armor? Let us see. So the duel of ideas and
forms and methods of procedure begins, and you are made or
unmade, in the momentary estimate of the individual, by your ability
to withstand criticism. I liked Sir Scorp as intellectuals go. I liked his
pale face, his trim black beard, his slim hands and his poised,
nervous, elusive manner.
“Oh, yes. So you’re new to England. I envy you your early
impression. I am reserving for the future the extreme pleasure of
reading you.” These little opening civilities always amuse me. We are
all on the stage and we play our parts perforce whether we do so
consciously or not.
It appeared that the chauffeur had to be provided for, Sir Scorp
had to be given a hasty lunch. He seemed to fall in with the idea of
a short run to Penn before dark, even if the day were gloomy, and
so, after feeding him quickly before the grate fire in the drawing-
room, we were off—Sir Scorp, Barfleur, Berenice and Percy—
Barfleur’s son—and myself. Sir Scorp sat with me in the tonneau and
Barfleur and Percy in the front seat.
Sir Scorp made no effort to strike up any quick relationship with
me—remained quite aloof and talked in generalities. I could see that
he took himself very seriously—as well he might, seeing that, as I
understood it, he had begun life with nothing. There were remarks—
familiar ones concerning well-known painters, sculptors, architects,
and the social life of England.
This first afternoon trip was pleasant enough, acquainting me as
it did with the character of the country about Bridgely Level for miles
and miles. Up to this time I had been commiserated on the fact that
it was winter and I was seeing England under the worst possible
conditions, but I am not so sure that it was such a great
disadvantage. To-day as we sped down some damp, slippery hillside
where the river Thames was to be seen far below twisting like a
letter S in the rain, I thought to myself that light and color—summer
light and color—would help but little. The villages that we passed
were all rain-soaked and preternaturally solemn. There were few if
any people abroad. We did not pass a single automobile on the way
to Penn and but a single railroad track. These little English villages
for all the extended English railway system, are practically without
railway communication. You have to drive or walk a number of miles
to obtain suitable railway connection.
I recall the sag-roofed, moss-patterned, vine-festooned cottages
of once red but now brownish-green brick, half hidden behind high
brick walls where curiously clipped trees sometimes stood up in
sentinel order, and vines and bushes seemed in a conspiracy to
smother the doors and windows in an excess of knitted leafage. Until
you see them no words can adequately suggest the subtlety of age
and some old order of comfort, once prevailing, but now obsolete,
which these little towns and separate houses convey. You know, at a
glance, that they are not of this modern work-a-day world. You know
at a glance that no power under the sun can save them. They are of
an older day and an older thought—the thought perhaps that goes
with Gray’s “Elegy” and Goldsmith’s “Traveller” and “Deserted
Village.”
That night at dinner, before and after, we fell into a most stirring
argument. As I recall, it started with Sir Scorp’s insisting that St.
Paul’s of London, which is a product of the skill of Sir Christopher
Wren, as are so many of the smaller churches of London, was
infinitely superior externally to the comparatively new and still
unfinished Roman Catholic Cathedral of Westminster. With that I
could not agree. I have always objected, anyhow, to the ground plan
of the Gothic cathedral, namely, the cross, as being the worst
possible arrangement which could be devised for an interior. It is
excellent as a scheme for three or four interiors—the arms of the
cross being always invisible from the nave—but as one interior, how
can it compare with the straight-lying basilica which gives you one
grand forward sweep, or the solemn Greek temple with its pediment
and glorifying rows of columns. Of all forms of architecture, other
things being equal, I most admire the Greek, though the Gothic
exteriorly, even more than interiorly, has a tremendous appeal. It is
so airy and florate.
However, St. Paul’s is neither Greek, Gothic, nor anything else
very much—a staggering attempt on the part of Sir Christopher
Wren to achieve something new which is to me not very successful.
The dome is pleasing and the interior space is fairly impressive, but
the general effect is botchy, and I think I said as much. Naturally this
was solid ground for an argument and the battle raged to and fro,—
through Greece, Rome, the Byzantine East and the Gothic realms of
Europe and England. We finally came down to the skyscrapers of
New York and Chicago and the railway terminals of various American
cities, but I shall not go into that. What was more important was
that it raised a question concerning the proletariate of England,—the
common people from whom, or because of whom, all things are
made to rise, and this was based on the final conclusion that all
architecture is, or should be, an expression of national temperament,
and this as a fact was partly questioned and partly denied, I think. It
began by my asking whether the little low cottages we had been
seeing that afternoon—the quaint windows, varying gables, pointless
but delicious angles, and the battered, time-worn state of houses
generally—was an expression of the English temperament. Mind you,
I love what these things stand for. I love the simpleness of soul
which somehow is conveyed by Burns and Wordsworth and Hardy,
and I would have none of change if life could be ordered so sweetly
—if it could really stay. Alas, I know it can not. Compared to the
speed and skill which is required to manipulate the modern railway
trains, the express companies, the hotels, the newspapers, all this is
helpless, pathetic.
Sir Scorp’s answer was yes, that they were an expression, but
that, nevertheless, the English mass was a beast of muddy brain. It
did not—could not—quite understand what was being done. Above it
were superimposed intellectual classes, each smaller and more
enthusiastic and aware as you reach the top. At least, it has been so,
he said, but now democracy and the newspapers are beginning to
break up this lovely solidarity of simplicity and ignorance into
something that is not so nice.
“People want to get on now,” he declared. “They want each to
be greater than the other. They must have baths and telephones and
railways and they want to undo this simplicity. The greatness of
England has been due to the fact that the intellectual superior
classes with higher artistic impulses and lovelier tendencies generally
could direct the masses and like sheep they would follow. Hence all
the lovely qualities of England; its ordered households, its beautiful
cathedrals, its charming castles and estates, its good roads, its
delicate homes, and order and precedences. The magnificent princes
of the realm have been able to do so much for art and science
because their great impulses need not be referred back to the mass
—the ignorant, non-understanding mass—for sanction.”
Sir Scorp sprang with ease to Lorenzo, the magnificent, to the
princes of Italy, to Rome and the Cæsars for illustration. He cited
France and Louis. Democracy, he declared, is never going to do for
all what the established princes could do. Democracy is going to be
the death of art. Not so, I thought and said, for democracy can
never alter the unalterable difference between high and low, rich
and poor, little brain and big brain, strength and weakness. It cannot
abolish difference and make a level plane. It simply permits the
several planes to rise higher together. What is happening is that the
human pot is boiling again. Nations are undergoing a transition
period. We are in a maelstrom, which means change and
reconstruction. America is going to flower next and grandly, and
perhaps after that Africa, or Australia. Then, say, South America, and
we come back to Europe by way of India, China, Japan and through
Russia. All in turn and new great things from each again. Let’s hope
so. A pretty speculation, anyhow.
At my suggestion of American supremacy, Sir Scorp, although he
protested, no doubt honestly, that he preferred the American to any
other foreign race, was on me in a minute with vital criticism and I
think some measure of insular solidarity. The English do not love the
Americans—that is sure. They admire their traits—some of them, but
they resent their commercial progress. The wretched Americans will
not listen to the wise British. They will not adhere to their noble and
magnificent traditions. They go and do things quite out of order and
the way in which they should be done, and then they come over to
England and flaunt the fact in the noble Britisher’s face. This is
above all things sad. It is evil, crass, reprehensible, anything you
will, and the Englishman resents it. He even resents it when he is an
Irish Englishman. He dislikes the German much—fears the outcome
of a war from that quarter—but really he dislikes the American more.
I honestly think he considers America far more dangerous than
Germany. What are you going to do with that vast realm which is
“the states”? It is upsetting the whole world by its nasty
progressiveness, and this it should not be permitted to do. England
should really lead. England should have invented all the things which
the Americans have invented. England should be permitted to dictate
to-day and to set the order of forms and procedures, but somehow it
isn’t doing it. And, hang it all! the Americans are. We progressed
through various other things,—an American operatic manager who
was then in London attempting to revise English opera, an American
tobacco company which had made a failure of selling tobacco to the
English, but finally weariness claimed us all, and we retired for the
night, determined to make Oxford on the morrow if the weather
faired in the least.
The next morning I arose, glad that we had had such a forceful
argument. It was worth while, for it brought us all a little closer
together. Barfleur, the children and I ate breakfast together while we
were waiting for Scorp to come down and wondering whether we
should really go, it was so rainy. Barfleur gave me a book on Oxford,
saying that if I was truly interested I should look up beforehand the
things that I was to see. Before a pleasant grate fire I studied this
volume, but my mind was disturbed by the steadily approaching fact
of the trip itself, and I made small progress. Somehow during the
morning the plan that Barfleur had of getting us invited to luncheon
by his uncle at Oxford disappeared and it turned out that we were to
go the whole distance and back in some five or six hours, having
only two or three hours for sightseeing.
At eleven Sir Scorp came down and then it was agreed that the
rain should make no difference. We would go, anyhow.
I think I actually thrilled as we stepped into the car, for
somehow the exquisite flavor and sentiment of Oxford was reaching
me here. I hoped we would go fast so that I should have an
opportunity to see much of it. We did speed swiftly past open fields
where hay cocks were standing drearily in the drizzling rain, and
down dark aisles of bare but vine-hung trees, and through lovely
villages where vines and small oddly placed windows and angles and
green-grown, sunk roofs made me gasp for joy. I imagined how they
would look in April and May with the sun shining, the birds flying, a
soft wind blowing. I think I could smell the odor of roses here in the
wind and rain. We tore through them, it seemed to me, and I said
once to the driver, “Is there no law against speeding in England?”
“Yes,” he replied, “there is, but you can’t pay any attention to
that if you want to get anywhere.”
There were graceful flocks of crows flying here and there. There
were the same gray little moss-grown churches with quaint belfries
and odd vine-covered windows. There were the same tree-protected
borders of fields, some of them most stately where the trees were
tall and dark and sad in the rain. I think an open landscape, such as
this, with green, wet grass or brown stubble and low, sad, heavy,
gray clouds for sky and background, is as delicious as any landscape
that ever was. And it was surely not more than one hour and a half
after we left Bridgely before we began to rush through the narrow,
winding streets where houses, always brick and stone and red walls
with tall gates and vines above them, lined either side of the way. It
was old—you could see that, even much that could be considered
new in England was old according to the American standard. The
plan of the city was odd to me because unlike the American cities,
praise be! there was no plan. Not an east and west street,
anywhere. Not a north and south one. Not a four- or five-story
building anywhere, apparently, and no wood; just wet, gray stone
and reddish-brown brick and vines. When I saw High Street and the
façade of Queens College I leaped for joy. I can think of nothing
lovelier in either marble or bronze than this building line. It is so
gentle, so persuasive of beautiful thought, such an invitation to
reflection and tender romance. It is so obvious that men have
worked lovingly over this. It is so plain there has been great care
and pains and that life has dealt tenderly with all. It has not been
destroyed or revised and revivified, but just allowed to grow old
softly and gracefully.
Owing to our revised plans for luncheon I had several
marmalade sandwiches in my hand, laid in an open white paper
which Barfleur had brought and passed around, the idea being that
we would not have time for lunch if we wished to complete our visit
and get back by dark. Sir Scorp had several meat sandwiches in
another piece of paper equally flamboyant. I was eating vigorously,
for the ride had made me hungry, the while my eyes searched out
the jewel wonders of the delicious prospect before me.
“This will never do,” observed Sir Scorp, folding up his paper
thoughtfully, “invading these sacred precincts in this ribald manner.
They’ll think we’re a lot of American sightseers come to despoil the
place.”
“Such being the case,” I replied, “we’ll disgrace Barfleur for life.
He has relations here. Nothing would give me greater pleasure.”
“Come, Dreiser. Give me those sandwiches.”
It was Barfleur, of course.
I gave over my feast reluctantly. Then we went up the street,
shoulder to shoulder, as it were, Berenice walking with first one and
another. I had thought to bring my little book on Oxford and to my
delight I could see that it was even much better than the book
indicated.
How shall one do justice to so exquisite a thing as Oxford,—
twenty-two colleges and halls, churches, museums and the like, with
all their lovely spires, towers, buttresses, ancient walls, ancient
doors, pinnacles, gardens, courts, angles and nooks which turn and
wind and confront each other and break into broad views and
delicious narrow vistas with a grace and an uncertainty which
delights and surprises the imagination at every turn. I can think of
nothing more exquisite than these wonderful walls, so old that
whatever color they were originally, they now are a fine mottled
black and gray, with uncertain patches of smoky hue, and places
where the stone has crumbled to a dead white. Time has done so
much; tradition has done so much; pageantry and memory; the art
of the architect, the perfect labor of builder, the beauty of the stone
itself, and then nature—leaves and trees and the sky! This day of
rain and lowery clouds—though Sir Scorp insisted it could stand no
comparison with sunshine and spring and the pathos of a delicious
twilight was yet wonderful to me. Grays and blacks and dreary
alterations of storm clouds have a remarkable value when joined
with so delicate and gracious a thing as perfectly arranged stone.
We wandered through alleys and courts and across the quadrangles
of University College, Baliol College, Wadham College, Oriel College,
up High Street, through Park Street, into the Chapel of Queens
College, into the banquet of Baliol and again to the Bodleian Library,
and thence by strange turns and lovely gateways to an inn for tea. It
was raining all the while and I listened to disquisitions by Sir Scorp
on the effect of the personalities, and the theories of both Inigo
Jones and Christopher Wren, not only on these buildings but on the
little residences in the street. Everywhere, Sir Scorp, enthusiast that
he is, found something—a line of windows done in pure Tudor, a
clock tower after the best fashion of Jones, a façade which was
Wren pure and simple. He quarreled delightfully, as the artist always
will, with the atrocity of this restoration or that failure to combine
something after the best manner, but barring the worst errors which
showed quite plainly enough in such things as the Oxford art gallery
and a modern church or two—it was all perfect. Time and tradition
have softened, petted, made lovely even the plainest surfaces.
I learned from Barfleur where Walter Pater and Oscar Wilde
lived, where Shelley’s essay on atheism was burned, and where
afterwards a monument was erected to him, where some English
bishops were burned for refusing to recant their religious beliefs and
where the dukes and princes of the realm were quartered in their
college days. Sir Scorp descanted on the pity of the fact, that some,
who would have loved a world such as this in their youth, could
never afford to come here, while others who were as ignorant as
boors and as dull as swine, were for reasons of wealth and family
allowed to wallow in a world of art which they could not possibly
appreciate. Here as elsewhere I learned that professors were often
cads and pedants—greedy, jealous, narrow, academic. Here as
elsewhere precedence was the great fetish of brain and the silly riot
of the average college student was as common as in the meanest
school. Life is the same, be art great or little, and the fame of even
Oxford cannot gloss over the weakness of a humanity that will
alternately be low and high, shabby and gorgeous, narrow and vast.
The last thing we saw were some very old portions of Christ
College, which had been inhabited by Dominican monks, I believe, in
their day, and this thrilled and delighted me quite as much as
anything. I forgot all about the rain in trying to recall the type of
man and the type of thought that must have passed in and out of
those bolt-riven doors, but it was getting time to leave and my
companions would have none of my lagging delight.
It was blowing rain and as we were leaving Oxford I lost my cap
and had to walk back after it. Later I lost my glove! As we rode my
mind went back over the ancient chambers, the paneled woodwork,
stained glass windows, and high vaulted ceilings I had just seen.
The heavy benches and somber portraits in oil sustained themselves
in my mind clearly. Oxford, I said to myself, was a jewel
architecturally. Another thousand years and it would be as a dream
of the imagination. I feel now as if its day were done; as if so much
gentle beauty can not endure. I had seen myself the invasion of the
electric switch board and the street car in High Street, and of course
other things will come. Already the western world is smiling at a
solemnity and a beauty which are noble and lovely to look upon, but
which cannot keep pace with a new order and a new need.
CHAPTER XVI
A CHRISTMAS CALL

T
HE Christmas holidays were drawing near and Barfleur was
making due preparations for the celebration of that event.
He was a stickler for the proper observance of those things
which have national significance and national or
international feeling behind them. Whatever joy he might get out of
such things, much or little, I am convinced that he was much more
concerned lest some one should fail of an appropriate share of
happiness than he was about anything else. I liked that in Barfleur. It
touched me greatly, and made me feel at times as though I should
like to pat him on the head.

During all my youth in Indiana and elsewhere I had been fed on


that delightful picture, “Christmas in England,” concocted first, I
believe (for American consumption, anyhow), by Washington Irving,
and from him rehashed for magazines and newspaper purposes until
it had come to be romance ad nauseum. The boar’s head carried in
by the butler of Squire Bracebridge, the ancient peacock pie with the
gorgeous tail feathers arranged at one end of the platter and the
crested head at the other, the yule log, the mistletoe berries, and the
Christmas choristers singing outside of windows and doors of
echoing halls, had vaguely stood their ground and as such had
rooted themselves in my mind as something connected with
ancestral England. I did not exactly anticipate anything of this kind
as being a part of present-day England, or of Barfleur’s simple
country residence, but, nevertheless, I was in England, and he was
making Christmas preparations of one kind or another, and my mind
had a perfect right to ramble a little. I think most of all I anticipated
another kind of toy from that to which we are accustomed in
America.
So many things go to make up that very amiable feast of
Christmas when it is successful that I can hardly think now of all that
contributed to this one. There was Sir Scorp, of whom by now I had
grown very fond, and who was coming here to spend the holidays.
There was Gerard Barfleur, a cousin of Barfleur’s, a jolly, roystering
theatrical manager, who was unquestionably—after Barfleur—one of
the most pleasing figures I met in England, a whimsical, comic-
ballad-singing, character-loving soul, who was as great a favorite
with women and children as one would want to find. He knew all
sorts of ladies, apparently, of high and low degree, rich and poor,
beautiful and otherwise, and seemed kindly disposed toward them
all. I could write a splendid human-interest sketch of Gerard Barfleur
alone. There was Mr. T. McT., a pale, thoughtful person, artistic and
poetic to his finger tips, curator of one of the famous museums, a
lover of Mr. Housman’s “A Shropshire Lad,” a lover of ancient glass
and silver, whose hair hung in a sweet mop over his high, pale
forehead, and whose limpid dark eyes shone with a kindly, artistic
light. Then there was Barfleur’s aunt and her daughter, mother and
sister respectively of the highly joyous Gerard Barfleur, and wife and
daughter of a famous litterateur. Then, to cap it all, were the total of
Barfleur’s very interesting household,—housekeeper, governess,
maid, cook, gardener, and—last, but not least, the four charming, I
might almost say adorable, children.
There, too, was Barfleur, a host in himself. For weeks beforehand
he kept saying on occasion as we wandered about London together,
“No, we can’t go there,” or, “You mustn’t accept that, because we
have reserved that Saturday and Sunday for Christmas at my place,”
and so nothing was done which might interfere. Being in his hands I
finally consulted him completely as to Christmas presents, and found
that I was to be limited to very small gifts, mere tokens of good-will,
I being his guest. I did manage to get him a supply of his favorite
cigarettes, however, unknown to himself,—the ones his clever
secretary told me he much preferred,—and had them sent out to the
house with some favorite books for the remaining members of the
household.
But the man was in such high spirits over the whole program he
had laid out for me—winter and spring,—the thought of Paris and
the Riviera,—that he was quite beside himself. More than once he
said to me, beaming through his monocle, “We shall have a
delightful time on the continent soon. I’m looking forward to it, and
to your first impressions.” Every evening he wanted to take my
hastily scribbled notes and read them, and after doing so was
anxious to have me do them all just that way, that is, day by day as
I experienced them. I found that quite impossible, however. Once he
wanted to know if I had any special preference in wines or cordials
and I knew very well why he asked. Another time he overheard me
make the statement that I had always longed to eat rich, odorous
Limburger cheese from Germany.
“Done!” he exclaimed. “We shall have it for Christmas.”
“But, Papa,” piped up Berenice maliciously, “we don’t all have to
have it at the same time, do we?”
“No, my dear,” replied Barfleur solemnly, with that amazingly
patronizing and parental air which always convulsed me, a sort of
gay deviltry always lurking behind it.
“Only Mr. Dreiser need have it. He is German and likes it.”
I assumed as German a look as I might,—profound, Limburgery.
“And I believe you like Mr. Jones’s sausage,” he observed on
another occasion, referring to an American commodity, which he had
heard me say in New York that I liked. “We shall have some of
those.”
“Are American sausage like English sausage?” inquired young
Charles Gerald interestedly.
“Now Heaven only knows,” I replied. “I have never eaten English
sausages. Ask your father.”
Barfleur merely smiled. “I think not,” he replied.
“Christmas is certainly looking up,” I said to him badgeringly. “If
I come out of here alive,—in condition for Paris and the Riviera,—I
shall be grateful.”
He beamed on me reprovingly.
Well, finally, to make a long story short, the day came, or, at
least, the day before. We were all assembled for a joyous Christmas
Eve—T. McT., Sir Scorp, Gerard Barfleur, the dearest aunt and the
charming cousin, extremely intelligent and artistic women both, the
four children, Barfleur’s very clever and appealing secretary, and
myself. There was a delightful dinner spread at seven-thirty, when
we all assembled to discuss the prospects of the morrow. It was on
the program, as I discovered, that I should arise, and accompany
Barfleur, his aunt, his cousin, and the children to a nearby abbey
church, a lovely affair, I was told, on the bank of the Thames hard
by the old English town called Bridgely, while Gerard Barfleur, who
positively refused to have anything to do with religion of any kind,
quality or description, was to go and reconnoiter a certain
neighboring household (of which more anon), and to take young
James Herbert (he of the “bawth”) for a fine and long-anticipated
ride on his motor cycle. Lord Scorp and T. McT. were to remain
behind to discuss art, perhaps, or literature, being late risers. If
there was to be any Santa Claus, which the children doubted, owing
to Barfleur’s rather grave asseveration to the contrary (there having
been a number of reasons why a severely righteous Santa might see
fit to remain away), he was not to make his appearance until rather
late in the afternoon. Meanwhile we had all adjourned to the general
living-room, where a heavy coal fire blazed on the hearth (for once),
and candles were lighted in profusion. The children sang songs of
the north, accompanied by their governess. I can see their quaint
faces now, gathered about the piano. Lord Scorp, McT. and myself
indulged in various artistic discussions and badinage; Mrs. Barfleur,
the aunt, told me the brilliant story of her husband’s life,—a great
naturalistic philosopher and novelist,—and finally after coffee, sherry,
nuts and much music and songs,—some comic ones by Gerard
Barfleur,—we retired for the night.
It is necessary, to prepare the reader properly for the morrow, to
go back a few days or weeks, possibly, and tell of a sentimental
encounter that befell me one day as I was going for a walk in that
green world which encompassed Bridgely Level. It was a most
delightful spectacle. Along the yellowish road before me, with its
border of green grass and green though leafless trees, there was
approaching a most interesting figure of a woman, a chic, dashing
bit of femininity,—at once (the presumption, owing to various
accompanying details was mine) wife, mother, chatelaine,—as
charming a bit of womanhood and English family sweetness as I had
yet seen in England. English women, by and large, let me state here,
are not smart, at least those that I encountered; but here was one
dressed after the French fashion in trig, close-fitting blue, outlining
her form perfectly, a little ermine cap of snowy whiteness set jauntily
over her ear, her smooth black hair parted demurely over her
forehead, a white muff warming her hands, and white spats
emphasizing the trim leather of her foot gear. Her eyes were dark
brown, her cheeks rosy, her gait smart and tense. I could scarcely
believe she was English, the mother of the three-year-old in white
and red wool, a little girl, who was sitting astride a white donkey,
which, in turn, was led by a trim maid or nurse or governess in
somber brown,—but it was quite plain that she was. There was such
a wise, sober look about all this smartness, such a taut, buttressed
conservatism, that I was enchanted. It was such a delightful picture
to encounter of a clear December morning that, in the fashion of the
English, I exclaimed, “My word! This is something like!”
I went back to the house that afternoon determined to make
inquiries. Perhaps she was a neighbor,—a friend of the family!
Of all the individuals who have an appropriate and superior taste
for the smart efforts of the fair sex, commend me to Barfleur. His
interest and enthusiasm neither flags nor fails. Being a widower of
discretion he knows exactly what is smart for a woman as well as a
man, and all you have to do to make him prick up his ears
attentively is to mention trig beauty as existing in some form,
somewhere,—not too distant for his adventuring.
“What’s this?” I can see his eye lighting. “Beauty? A lovely
woman? When? Where?”
This day, finding Wilkins in the garden trimming some bushes, I
had said, “Wilkins, do you know any family hereabouts that keeps a
white donkey?”
Wilkins paused and scratched his ear reflectively. “No, sir! I
cawn’t say has I do, sir. I might harsk, sir, down in the village, hif
you’re very hanxious to know.”
Be it known by all men that I feed Wilkins amply for all services
performed,—hence his interest.
“Never mind for the present, Wilkins,” I replied. “I may want to
know. If so, I’ll ask you.”
I knew he would inquire anyhow.
That night at dinner, the family being all present, Barfleur in his
chair at the head of the table, the wine at his right, I said mildly—
“I saw the most beautiful woman to-day I have yet seen in
England.”
Barfleur was just in the act of elevating a glass of champagne to
his lips, but he paused to fix me with an inquiring eye.
“Where?” he questioned solemnly. “Were you in the city?”
“Not at all. I rarely, if ever, see them in the city. It was very near
here. A most beautiful woman,—very French,—trim figure, small
feet, a gay air. She had a lovely three-year-old child with her riding a
white donkey.”
“A white donkey? Trim, very French, you say? This is most
interesting! I don’t recall any one about here who keeps a white
donkey. Berenice,” he turned to his young daughter. “Do you recall
any one hereabout who keeps a white donkey?”
Berenice, a wizard of the future, merely smiled wisely.
“I do not, Papa.”
“This is very curious, very curious indeed,” continued Barfleur,
returning to me. “For the life of me, I cannot think of any one who
keeps a white donkey. Who can she be? Walking very near here, you
say? I shall have a look into this. She may be the holiday guest of
some family. But the donkey and child and maid—Young, you say?
Percy, you don’t remember whether any one hereabout owns a white
donkey,—any one with a maid and a three-year-old child?”
Percy smiled broadly. “No, I don’t,” he said. Barfleur shook his
head in mock perturbation. “It’s very strange,” he said. “I don’t like
the thought of there being any really striking women hereabout of
whom I know nothing.” He drank his wine.
There was no more of this then, but I knew that in all probability
the subject would come up again. Barfleur inquired, and Wilkins
inquired, and as was natural, the lady was located. She turned out
to be the wife of a tennis, golf, and aeroplane expert or champion, a
man who held records for fast automobiling and the like, and who
was independently settled in the matter of means. Mrs. Barton
Churchill was her name as I recall. It also turned out most
unfortunately that Barfleur did not know her, and could not place
any one who did.
“This is all very trying,” he said when he discovered this much.
“Here you are, a celebrated American author, admiring a very
attractive woman whom you meet on the public highway; and here
am I, a resident of the neighborhood in which she is living, and I do
not even know her. If I did, it would all be very simple. I could take
you over, she would be immensely flattered at the nice things you
have said about her. She would be grateful to me for bringing you.
Presto,—we should be fast friends.”
“Exactly,” I replied sourly. “You and she would be fast friends.
After I am gone in a few days all will be lovely. I shall not be here to
protect my interests. It is always the way. I am the cat’s paw, the
bait, the trap. I won’t stand for it. I saw her first, and she is mine.”
“My dear fellow,” he exclaimed banteringly, “how you go on! I
don’t understand you at all. This is England. The lady is married. A
little neighborly friendship. Hmm.”
“Yes, yes,” I replied. “I know all about the neighborly friendship.
You get me an introduction to the lady and I shall speak for myself.”
“As for that matter,” he added thoughtfully, “it would not be
inappropriate under the circumstances for me to introduce myself in
your behalf. She would be pleased, I’m sure. You are a writer, you
admire her. Why shouldn’t she be pleased?”
“Curses!” I exclaimed. “Always in the way. Always stepping in
just when I fancy I have found something for myself.”
But nothing was done until Gerard Barfleur arrived a day or two
before Christmas. That worthy had traveled all over England with
various theatrical companies. Being the son of an eminent literary
man he had been received in all circles, and knew comfortable and
interesting people in every walk of life apparently, everywhere.
Barfleur, who, at times, I think, resented his social sufficiency, was
nevertheless prone to call on him on occasion for advice. On this
occasion, since Gerard knew this neighborhood almost as well as his
cousin, he consulted him as to our lady of the donkey.
“Mrs. Churchill? Mrs. Barton Churchill?” I can still see his
interested look. “Why, it seems to me that I do know some one of
that name. If I am not mistaken I know her husband’s brother,
Harris Churchill, up in Liverpool. He’s connected with a bank up
there. We’ve motored all over England together, pretty nearly. I’ll
stop in Christmas morning and see if it isn’t the same family. The
description you give suits the lady I know almost exactly.”
Barfleur

I was all agog. The picture she had presented was so smart.
Barfleur was interested though perhaps disappointed, too, that
Gerard knew her when he didn’t.
“This is most fortunate,” he said to me solemnly. “Now if it
should turn out that he does know her, we can call there Christmas
day after dinner. Or perhaps he will take you.”
This came a little regretfully, I think, for Gerard Barfleur
accounted himself an equal master with his cousin in the matter of
the ladies, and was not to be easily set aside. So Christmas eve it
was decided that Gerard should, on the morrow, reconnoiter the
Churchill country house early, and report progress, while we went to
church. Fancy Barfleur and me marching to church Christmas
morning with the children!
Christmas in England! The day broke clear and bright, and there
we all were. It was not cold, and as is usual, there was little if any
wind. I remember looking out of my window down into the valley
toward Bridgely, and admiring the green rime upon the trees, the
clustered chimneys of a group of farmers’ and working-men’s
cottages, the low sagging roofs of red tile or thatch, and the small
window panes that always somehow suggest a homey simplicity that
I can scarcely resist. The English milkmaid of fiction, the simple
cottages, the ordered hierarchy of farmers are, willy nilly, fixtures in
my mind. I cannot get them out.
First then, came a breakfast in our best bibs and tuckers, for
were we not to depart immediately afterwards to hear an English
Christmas service? Imagine Barfleur—the pride of Piccadilly,—
marching solemnly off at the head of his family to an old, gray abbey
church. As the French say, “I smile.” We all sat around and had our
heavy English breakfast,—tea, and, to my comfort and delight, “Mr.
Jones’s sausages.” Barfleur had secured a string of them from
somewhere.
“Think of it,” commented Berenice sardonically. “‘Mr. Jones’s
sausages’ for breakfast. Aren’t they comic! Do you like them?”
“I most assuredly do.”
“And do you eat them every day in A-máy-reeka?” queried
Charles Gerard with a touch of latent jesting in his voice.
“When I can afford them, yes.”
“They’re quite small, aren’t they?” commented five-year-old
James Herbert.
“Precisely,” I replied, unabashed by this fire of inquiry. “That’s
their charm.”
The church that we visited was one of those semi-ancient abbey
affairs, done in good English Gothic, with a touch of Tudor here and
there, and was located outside the village of Bridgely Level two or
three miles from Barfleur’s home. I recall with simple pleasure the
smug, self-righteous, Sunday-go-to-meeting air with which we all set
forth, crossing homey fields via diagonal paths, passing through
stiles and along streams and country roads, by demure little cottages
that left one breathless with delight. I wish truly that England could
be put under glass and retained as a perfect specimen of
unconscious, rural poetry—the south of England. The pots and pans
outside the kitchen doorways! The simple stoop, ornamented with
clambering vines! The reddish-green sagging roofs with their
clustered cylindrical chimneypots! When we came to the top of a hill
we could see the church in the valley below, nestling beside one
bank of the Thames which wound here and there in delightful S’s. A
square tower, as I recall, rose quaintly out of a surrounding square
of trees, grass, grave-stones and box-hedge.
There was much ado in this semi-ancient place as we came up,
for Christmas day, of all days, naturally drew forth a history-loving
English audience. Choir boys were scurrying here and there, some
ladies of solemn demeanor, who looked as if they might be assisting
at the service in some way or another, were dawdling about, and I
even saw the rector in full canonicals hastening up a gravel path
toward a side door, as though matters needed to be expedited
considerably. The interior was dark, heavy-beamed, and by no
means richly ornamented with stained glass, but redolent of by-gone
generations at that. The walls were studded with those customary
slabs and memorial carvings with which the English love to
ornament their church interiors. A fair-sized, and yet for so large an
edifice, meager audience was present, an evidence it seemed to me,
of the validity of the protest against state support for the Established
Church. There was a great storm of protest in England at this time
against the further state support of an institution that was not
answering the religious needs of the people, and there had been
some discussion of the matter at Barfleur’s house. As was natural,
the artistically inclined were in favor of anything which would
sustain, unimpaired, whether they had religious value or not, all the
old cathedrals, abbeys, and neighborhood churches, solely because
of their poetic appearance. On the other hand an immense class,
derisively spoken of as “chapel people,” were heartily in favor of the
ruder disposition of the matter. Barfleur in his best Piccadilly clothing
was for their maintenance.
To be frank, as charming as was this semi-ancient atmosphere,
and possibly suited to the current English neighborhood mood (I
could not say as to that), it did not appeal to me as strongly on this
occasion as did many a similar service in American churches of the
same size. The vestments were pleasing as high church vestments
go; the choir, made of boys and men from the surrounding
countryside no doubt, was not absolutely villainous but it could have
been much better. To tell the truth, it seemed to me that I was
witnessing the last and rather threadbare evidences of an older and
much more prosperous order of things. Beautiful in its way? Yes.
Quaint? Yes. But smacking more of poverty and an ordered system
continued past its day than anything else. I felt a little sorry for the
old church and the thin rector and the goodly citizens, albeit a little
provincial, who clung so fatuously to a time-worn form. They have
their place, no doubt, and it makes that sweet, old lavender
atmosphere which seems to hover over so much that one

You might also like