100% found this document useful (4 votes)
18 views

Research Software Engineering with Python: Building software that makes research possible 1st Edition Damien Irving - The complete ebook set is ready for download today

The document provides information about various eBooks available for download at ebookmeta.com, including titles related to research software engineering, applied mathematics, and self-defense. It highlights the book 'Research Software Engineering with Python' by Damien Irving and others, which focuses on building software for research purposes. Additionally, it mentions the authors' contributions and the donation of royalties to The Carpentries organization.

Uploaded by

zabianrazmi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (4 votes)
18 views

Research Software Engineering with Python: Building software that makes research possible 1st Edition Damien Irving - The complete ebook set is ready for download today

The document provides information about various eBooks available for download at ebookmeta.com, including titles related to research software engineering, applied mathematics, and self-defense. It highlights the book 'Research Software Engineering with Python' by Damien Irving and others, which focuses on building software for research purposes. Additionally, it mentions the authors' contributions and the donation of royalties to The Carpentries organization.

Uploaded by

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

Read Anytime Anywhere Easy Ebook Downloads at ebookmeta.

com

Research Software Engineering with Python:


Building software that makes research possible 1st
Edition Damien Irving

https://ebookmeta.com/product/research-software-engineering-
with-python-building-software-that-makes-research-
possible-1st-edition-damien-irving/

OR CLICK HERE

DOWLOAD EBOOK

Visit and Get More Ebook Downloads Instantly at https://ebookmeta.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Applied Mathematics with Open Source Software Operational


Research Problems with Python and R 1st Edition Vincent
Knight
https://ebookmeta.com/product/applied-mathematics-with-open-source-
software-operational-research-problems-with-python-and-r-1st-edition-
vincent-knight/
ebookmeta.com

Software Engineering Research and Practice 1st Edition


Hamid R Arabnia Leonidas Deligiannidis Fernando G Tinetti

https://ebookmeta.com/product/software-engineering-research-and-
practice-1st-edition-hamid-r-arabnia-leonidas-deligiannidis-fernando-
g-tinetti/
ebookmeta.com

Engineering Software Products: An Introduction to Modern


Software Engineering Ian Sommerville

https://ebookmeta.com/product/engineering-software-products-an-
introduction-to-modern-software-engineering-ian-sommerville/

ebookmeta.com

Famous Obsession Endless Obsession 1st Edition M K Moore

https://ebookmeta.com/product/famous-obsession-endless-obsession-1st-
edition-m-k-moore-2/

ebookmeta.com
Self Defense for Women Fight Back 2nd Edition Loren W
Christensen Lisa Christensen

https://ebookmeta.com/product/self-defense-for-women-fight-back-2nd-
edition-loren-w-christensen-lisa-christensen/

ebookmeta.com

The Authority of Tenderness Dignity and the True Self in


Psychoanalysis 1st Edition Paul Williams

https://ebookmeta.com/product/the-authority-of-tenderness-dignity-and-
the-true-self-in-psychoanalysis-1st-edition-paul-williams/

ebookmeta.com

The Healing Energy of Your Hands Michael Bradford

https://ebookmeta.com/product/the-healing-energy-of-your-hands-
michael-bradford-2/

ebookmeta.com

Expert Python Programming 2nd Edition Michal Jaworski


Tarek Ziadé

https://ebookmeta.com/product/expert-python-programming-2nd-edition-
michal-jaworski-tarek-ziade/

ebookmeta.com

New Screen Media Cinema Art Narrative 1st Edition Martin


Rieser

https://ebookmeta.com/product/new-screen-media-cinema-art-
narrative-1st-edition-martin-rieser/

ebookmeta.com
His Terms 1st Edition Jenika Snow

https://ebookmeta.com/product/his-terms-1st-edition-jenika-snow/

ebookmeta.com
Research Software Engineering
with Python
Research Software Engineering
with Python
Building software that makes research
possible

Damien Irving
Kate Hertweck
Luke Johnston
Joel Ostblom
Charlotte Wickham
Greg Wilson
First edition published 2022
by CRC Press
6000 Broken Sound Parkway NW, Suite 300, Boca Raton, FL 33487-2742

and by CRC Press


2 Park Square, Milton Park, Abingdon, Oxon, OX14 4RN

© 2022 Damien Irving, Kate Hertweck, Luke Johnston, Joel Ostblom, Charlotte Wickham, and
Greg Wilson

CRC Press is an imprint of Taylor & Francis Group, LLC

Reasonable efforts have been made to publish reliable data and information, but the author and
publisher cannot assume responsibility for the validity of all materials or the consequences of their
use. The authors and publishers have attempted to trace the copyright holders of all material
reproduced in this publication and apologize to copyright holders if permission to publish in this
form has not been obtained. If any copyright material has not been acknowledged please write and
let us know so we may rectify in any future reprint.

Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced,
transmitted, or utilized in any form by any electronic, mechanical, or other means, now known or
hereafter invented, including photocopying, microfilming, and recording, or in any information
storage or retrieval system, without written permission from the publishers.

For permission to photocopy or use material electronically from this work, access
www.copyright.com or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive,
Danvers, MA 01923, 978-750-8400. For works that are not available on CCC please contact
[email protected]

Trademark notice: Product or corporate names may be trademarks or registered trademarks and are
used only for identification and explanation without intent to infringe.

Library of Congress Cataloging‑in‑Publication Data


Names: Irving, Damien, author.
Title: Research software engineering with Python : building software that
makes research possible / Damien Irving, Kate Hertweck, Luke William
Johnston, Joel Ostblom, Charlotte Wickham, and Greg Wilson.
Description: First edition. | Boca Raton, FL : CRC Press, 2021. | Includes
bibliographical references and index.
Identifiers: LCCN 2021006032 | ISBN 9780367698348 (hardback) | ISBN
9780367698324 (paperback) | ISBN 9781003143482 (ebook)
Subjects: LCSH: Research--Data processing. | Computer
software--Development. | Python (Computer program language)
Classification: LCC Q180.55.E4 I76 2021 | DDC 001.40285/5133--dc23
LC record available at https://lccn.loc.gov/2021006032

ISBN: 978-0-367-69834-8 (hbk)


ISBN: 978-0-367-69832-4 (pbk)
ISBN: 978-1-003-14348-2 (ebk)

DOI: 10.1201/9781003143482

Publisher's note: This book has been prepared from camera-ready copy provided by the authors.
To David Flanders
who taught me so much about growing and sustaining coding communities.
— Damien

To the UofT Coders Group


who taught us much more than we taught them.
— Luke and Joel

To my parents Judy and John


who taught me to love books and everything I can learn from them.
— Kate

To Joshua.
— Charlotte

To Brent Gorda
without whom none of this would have happened.
— Greg

All royalties from this book are being donated to The Carpentries,
an organization that teaches foundational coding and data science skills
to researchers worldwide.
Contents

Welcome 1
0.1 The Big Picture . . . . . . . . . . . . . . . . . . . . . . . . . 1
0.2 Intended Audience . . . . . . . . . . . . . . . . . . . . . . . 2
0.3 What You Will Learn . . . . . . . . . . . . . . . . . . . . . . 3
0.4 Using this Book . . . . . . . . . . . . . . . . . . . . . . . . . 4
0.5 Contributing and Re-Use . . . . . . . . . . . . . . . . . . . . 4
0.6 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . 5

1 Getting Started 7
1.1 Project Structure . . . . . . . . . . . . . . . . . . . . . . . . 7
1.2 Downloading the Data . . . . . . . . . . . . . . . . . . . . . 9
1.3 Installing the Software . . . . . . . . . . . . . . . . . . . . . 10
1.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.6 Key Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

2 The Basics of the Unix Shell 13


2.1 Exploring Files and Directories . . . . . . . . . . . . . . . . 14
2.2 Moving Around . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.3 Creating New Files and Directories . . . . . . . . . . . . . . 24
2.4 Moving Files and Directories . . . . . . . . . . . . . . . . . . 28
2.5 Copying Files and Directories . . . . . . . . . . . . . . . . . 29
2.6 Deleting Files and Directories . . . . . . . . . . . . . . . . . 31
2.7 Wildcards . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
2.8 Reading the Manual . . . . . . . . . . . . . . . . . . . . . . . 34

iii
iv Contents

2.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.10 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2.11 Key Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

3 Building Tools with the Unix Shell 45


3.1 Combining Commands . . . . . . . . . . . . . . . . . . . . . 45
3.2 How Pipes Work . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.3 Repeating Commands on Many Files . . . . . . . . . . . . . 53
3.4 Variable Names . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.5 Redoing Things . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.6 Creating New Filenames Automatically . . . . . . . . . . . . 59
3.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
3.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
3.9 Key Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

4 Going Further with the Unix Shell 69


4.1 Creating New Commands . . . . . . . . . . . . . . . . . . . . 70
4.2 Making Scripts More Versatile . . . . . . . . . . . . . . . . . 72
4.3 Turning Interactive Work into a Script . . . . . . . . . . . . 74
4.4 Finding Things in Files . . . . . . . . . . . . . . . . . . . . . 75
4.5 Finding Files . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
4.6 Configuring the Shell . . . . . . . . . . . . . . . . . . . . . . 85
4.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
4.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
4.9 Key Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

5 Building Command-Line Tools with Python 95


5.1 Programs and Modules . . . . . . . . . . . . . . . . . . . . . 96
5.2 Handling Command-Line Options . . . . . . . . . . . . . . . 98
5.3 Documentation . . . . . . . . . . . . . . . . . . . . . . . . . 100
5.4 Counting Words . . . . . . . . . . . . . . . . . . . . . . . . . 102
5.5 Pipelining . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Contents v

5.6 Positional and Optional Arguments . . . . . . . . . . . . . . 108


5.7 Collating Results . . . . . . . . . . . . . . . . . . . . . . . . 108
5.8 Writing Our Own Modules . . . . . . . . . . . . . . . . . . . 111
5.9 Plotting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
5.10 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
5.11 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
5.12 Key Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

6 Using Git at the Command Line 121


6.1 Setting Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
6.2 Creating a New Repository . . . . . . . . . . . . . . . . . . . 125
6.3 Adding Existing Work . . . . . . . . . . . . . . . . . . . . . 127
6.4 Describing Commits . . . . . . . . . . . . . . . . . . . . . . . 129
6.5 Saving and Tracking Changes . . . . . . . . . . . . . . . . . 130
6.6 Synchronizing with Other Repositories . . . . . . . . . . . . 138
6.7 Exploring History . . . . . . . . . . . . . . . . . . . . . . . . 143
6.8 Restoring Old Versions of Files . . . . . . . . . . . . . . . . 147
6.9 Ignoring Files . . . . . . . . . . . . . . . . . . . . . . . . . . 150
6.10 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
6.11 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
6.12 Key Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156

7 Going Further with Git 157


7.1 What’s a Branch? . . . . . . . . . . . . . . . . . . . . . . . . 158
7.2 Creating a Branch . . . . . . . . . . . . . . . . . . . . . . . . 160
7.3 What Curve Should We Fit? . . . . . . . . . . . . . . . . . . 161
7.4 Verifying Zipf’s Law . . . . . . . . . . . . . . . . . . . . . . . 164
7.5 Merging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
7.6 Handling Conflicts . . . . . . . . . . . . . . . . . . . . . . . . 174
7.7 A Branch-Based Workflow . . . . . . . . . . . . . . . . . . . 178
7.8 Using Other People’s Work . . . . . . . . . . . . . . . . . . . 180
vi Contents

7.9 Pull Requests . . . . . . . . . . . . . . . . . . . . . . . . . . 184


7.10 Handling Conflicts in Pull Requests . . . . . . . . . . . . . . 193
7.11 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
7.12 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
7.13 Key Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196

8 Working in Teams 199


8.1 What Is a Project? . . . . . . . . . . . . . . . . . . . . . . . 200
8.2 Include Everyone . . . . . . . . . . . . . . . . . . . . . . . . 201
8.3 Establish a Code of Conduct . . . . . . . . . . . . . . . . . . 202
8.4 Include a License . . . . . . . . . . . . . . . . . . . . . . . . 206
8.5 Planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
8.6 Bug Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
8.7 Labeling Issues . . . . . . . . . . . . . . . . . . . . . . . . . 214
8.8 Prioritizing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
8.9 Meetings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
8.10 Making Decisions . . . . . . . . . . . . . . . . . . . . . . . . 221
8.11 Make All This Obvious to Newcomers . . . . . . . . . . . . . 223
8.12 Handling Conflict . . . . . . . . . . . . . . . . . . . . . . . . 223
8.13 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
8.14 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
8.15 Key Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229

9 Automating Analyses with Make 231


9.1 Updating a Single File . . . . . . . . . . . . . . . . . . . . . 233
9.2 Managing Multiple Files . . . . . . . . . . . . . . . . . . . . 235
9.3 Updating Files When Programs Change . . . . . . . . . . . 237
9.4 Reducing Repetition in a Makefile . . . . . . . . . . . . . . . 238
9.5 Automatic Variables . . . . . . . . . . . . . . . . . . . . . . 240
9.6 Generic Rules . . . . . . . . . . . . . . . . . . . . . . . . . . 241
9.7 Defining Sets of Files . . . . . . . . . . . . . . . . . . . . . . 243
Contents vii

9.8 Documenting a Makefile . . . . . . . . . . . . . . . . . . . . 246


9.9 Automating Entire Analyses . . . . . . . . . . . . . . . . . . 248
9.10 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
9.11 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
9.12 Key Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255

10 Configuring Programs 257


10.1 Configuration File Formats . . . . . . . . . . . . . . . . . . . 258
10.2 Matplotlib Configuration . . . . . . . . . . . . . . . . . . . . 259
10.3 The Global Configuration File . . . . . . . . . . . . . . . . . 260
10.4 The User Configuration File . . . . . . . . . . . . . . . . . . 262
10.5 Adding Command-Line Options . . . . . . . . . . . . . . . . 263
10.6 A Job Control File . . . . . . . . . . . . . . . . . . . . . . . 264
10.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
10.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
10.9 Key Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270

11 Testing Software 271


11.1 Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
11.2 Unit Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
11.3 Testing Frameworks . . . . . . . . . . . . . . . . . . . . . . . 276
11.4 Testing Floating-Point Values . . . . . . . . . . . . . . . . . 280
11.5 Integration Testing . . . . . . . . . . . . . . . . . . . . . . . 283
11.6 Regression Testing . . . . . . . . . . . . . . . . . . . . . . . 285
11.7 Test Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . 286
11.8 Continuous Integration . . . . . . . . . . . . . . . . . . . . . 289
11.9 When to Write Tests . . . . . . . . . . . . . . . . . . . . . . 293
11.10 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
11.11 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
11.12 Key Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
viii Contents

12 Handling Errors 299


12.1 Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
12.2 Writing Useful Error Messages . . . . . . . . . . . . . . . . . 307
12.3 Testing Error Handling . . . . . . . . . . . . . . . . . . . . . 309
12.4 Reporting Errors . . . . . . . . . . . . . . . . . . . . . . . . 310
12.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
12.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
12.7 Key Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319

13 Tracking Provenance 321


13.1 Data Provenance . . . . . . . . . . . . . . . . . . . . . . . . 323
13.2 Code Provenance . . . . . . . . . . . . . . . . . . . . . . . . 325
13.3 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
13.4 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
13.5 Key Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333

14 Creating Packages with Python 335


14.1 Creating a Python Package . . . . . . . . . . . . . . . . . . . 336
14.2 Virtual Environments . . . . . . . . . . . . . . . . . . . . . . 339
14.3 Installing a Development Package . . . . . . . . . . . . . . . 342
14.4 What Installation Does . . . . . . . . . . . . . . . . . . . . . 349
14.5 Distributing Packages . . . . . . . . . . . . . . . . . . . . . . 350
14.6 Documenting Packages . . . . . . . . . . . . . . . . . . . . . 355
14.7 Software Journals . . . . . . . . . . . . . . . . . . . . . . . . 365
14.8 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
14.9 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
14.10 Key Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368

15 Finale 369
15.1 Why We Wrote This Book . . . . . . . . . . . . . . . . . . . 370

Appendix 371
Contents ix

A Solutions 371

B Learning Objectives 419


B.1 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . 419
B.2 The Basics of the Unix Shell . . . . . . . . . . . . . . . . . . 419
B.3 Building Tools with the Unix Shell . . . . . . . . . . . . . . 420
B.4 Going Further with the Unix Shell . . . . . . . . . . . . . . . 420
B.5 Building Command-Line Tools with Python . . . . . . . . . 420
B.6 Using Git at the Command Line . . . . . . . . . . . . . . . . 421
B.7 Going Further with Git . . . . . . . . . . . . . . . . . . . . . 421
B.8 Working in Teams . . . . . . . . . . . . . . . . . . . . . . . . 422
B.9 Automating Analyses with Make . . . . . . . . . . . . . . . . 422
B.10 Configuring Programs . . . . . . . . . . . . . . . . . . . . . . 422
B.11 Testing Software . . . . . . . . . . . . . . . . . . . . . . . . . 423
B.12 Handling Errors . . . . . . . . . . . . . . . . . . . . . . . . . 423
B.13 Tracking Provenance . . . . . . . . . . . . . . . . . . . . . . 423
B.14 Creating Packages with Python . . . . . . . . . . . . . . . . 424

C Key Points 425


C.1 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . 425
C.2 The Basics of the Unix Shell . . . . . . . . . . . . . . . . . . 425
C.3 Building Tools with the Unix Shell . . . . . . . . . . . . . . 426
C.4 Going Further with the Unix Shell . . . . . . . . . . . . . . . 427
C.5 Building Command-Line Programs in Python . . . . . . . . 427
C.6 Using Git at the Command Line . . . . . . . . . . . . . . . . 428
C.7 Going Further with Git . . . . . . . . . . . . . . . . . . . . . 428
C.8 Working in Teams . . . . . . . . . . . . . . . . . . . . . . . . 429
C.9 Automating Analyses with Make . . . . . . . . . . . . . . . . 429
C.10 Configuring Programs . . . . . . . . . . . . . . . . . . . . . . 430
C.11 Testing Software . . . . . . . . . . . . . . . . . . . . . . . . . 430
C.12 Handling Errors . . . . . . . . . . . . . . . . . . . . . . . . . 430
C.13 Tracking Provenance . . . . . . . . . . . . . . . . . . . . . . 431
C.14 Creating Packages with Python . . . . . . . . . . . . . . . . 431
x Contents

D Project Tree 433

E Working Remotely 437


E.1 Logging In . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
E.2 Copying Files . . . . . . . . . . . . . . . . . . . . . . . . . . 439
E.3 Running Commands . . . . . . . . . . . . . . . . . . . . . . 441
E.4 Creating Keys . . . . . . . . . . . . . . . . . . . . . . . . . . 441
E.5 Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . 443

F Writing Readable Code 447


F.1 Python Style . . . . . . . . . . . . . . . . . . . . . . . . . . . 447
F.2 Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450
F.3 Checking Style . . . . . . . . . . . . . . . . . . . . . . . . . . 452
F.4 Refactoring . . . . . . . . . . . . . . . . . . . . . . . . . . . 454
F.5 Code Reviews . . . . . . . . . . . . . . . . . . . . . . . . . . 463
F.6 Python Features . . . . . . . . . . . . . . . . . . . . . . . . . 467
F.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472

G Documenting Programs 473


G.1 Writing Good Docstrings . . . . . . . . . . . . . . . . . . . . 473
G.2 Defining Your Audience . . . . . . . . . . . . . . . . . . . . . 476
G.3 Creating an FAQ . . . . . . . . . . . . . . . . . . . . . . . . 478

H YAML 481

I Anaconda 485
I.1 Package Management with conda . . . . . . . . . . . . . . . 485
I.2 Environment Management with conda . . . . . . . . . . . . 487

J Glossary 489

K References 503

Index 511
Welcome

It’s still magic even if you know how it’s done.


— Terry Pratchett

Software is now as essential to research as telescopes, test tubes, and reference


libraries. This means that researchers need to know how to build, check, use,
and share programs. However, most introductions to programming focus on
developing commercial applications, not on exploring problems whose answers
aren’t yet known. Our goal is to show you how to do that, both on your own
and as part of a team.
We believe every researcher should know how to write short programs that
clean and analyze data in a reproducible way and how to use version control
to keep track of what they have done. But just as some astronomers spend
their careers designing telescopes, some researchers focus on building the soft-
ware that makes research possible. People who do this are called research
software engineers; the aim of this book is to get you ready for this role by
helping you go from writing code for yourself to creating tools that help your
entire field advance.

0.1 The Big Picture

Our approach to research software engineering is based on three related con-


cepts:

• Open science: Making data, methods, and results freely available to all
by publishing them under open licenses.

• Reproducible research: Ensuring that anyone with access to the data


and software can feasibly reproduce results, both to check them and to
build on them.
• Sustainable software: The ease with which to maintain and extend it

1
2 0 Welcome

rather than to replace it. Sustainability isn’t just a property of the soft-
ware: it also depends on the skills and culture of its users.

People often conflate these three ideas, but they are distinct. For example, if
you share your data and the programs that analyze it, but don’t document
what steps to take in what order, your work is open but not reproducible.
Conversely, if you completely automate your analysis, but your data is only
available to people in your lab, your work is reproducible but not open. Fi-
nally, if a software package is being maintained by a couple of post-docs who
are being paid a fraction of what they could earn in industry and have no re-
alistic hope of promotion because their field doesn’t value tool building, then
sooner or later it will become abandonware, at which point openness and
reproducibility become less relevant.
Nobody argues that research should be irreproducible or unsustainable, but
“not against it” and actively supporting it are very different things. Academia
doesn’t yet know how to reward people for writing useful software, so while
you may be thanked, the effort you put in may not translate into academic
job security or decent pay.
Some people worry that if they make their data and code publicly available,
someone else will use it and publish a result they could have come up with
themselves. This is almost unheard of in practice, but that doesn’t stop it being
used as a scare tactic. Other people are afraid of looking foolish or incompetent
by sharing code that might contain bugs. This isn’t just impostor syndrome:
members of marginalized groups are frequently judged more harshly than
others, so being wrong in public is much riskier for them.
With this course, we hope to give researchers the tools and knowledge to be
better research software developers, to be more efficient in their work, make
less mistakes, and work more openly and reproducibly. We hope that by having
more researchers with these skills and knowledge, research culture can improve
to address the issues raised above.

0.2 Intended Audience

This book is written for researchers who are already using Python for their
data analysis, but who want to take their coding and software development
to the next level. You don’t have to be highly proficient with Python, but
you should already be comfortable doing things like reading data from files
and writing loops, conditionals, and functions. The following personas are
examples of the types of people that are our target audience.
0.3 What You Will Learn 3

Amira Khan completed a master’s in library science five years ago and has
since worked for a small aid organization. She did some statistics during
her degree, and has learned some R and Python by doing data science
courses online, but has no formal training in programming. Amira would
like to tidy up the scripts, datasets, and reports she has created in order
to share them with her colleagues. These lessons will show her how to do
this.
Jun Hsu completed an Insight Data Science1 fellowship last year after doing
a PhD in geology and now works for a company that does forensic audits.
He uses a variety of machine learning and visualization packages, and
would now like to turn some of his own work into an open source project.
This book will show him how such a project should be organized and how
to encourage people to contribute to it.
Sami Virtanen became a competent programmer during a bachelor’s degree
in applied math and was then hired by the university’s research computing
center. The kinds of applications they are being asked to support have
shifted from fluid dynamics to data analysis; this guide will teach them
how to build and run data pipelines so that they can pass those skills on
to their users.

0.3 What You Will Learn

Rather than simply providing reference material about good coding practices,
the book follows Amira and Sami as they work together to write an actual
software package to address a real research question. The data analysis task
that we focus on relates to a fascinating result in the field of quantitative
linguistics. Zipf’s Law2 states that the second most common word in a body
of text appears half as often as the most common, the third most common
appears a third as often, and so on. To test whether Zipf’s Law holds for a
collection of classic novels that are freely available from Project Gutenberg3 ,
we write a software package that counts and analyzes the word frequency
distribution in any arbitrary body of text.
In the process of writing and publishing a Python package to verify Zipf’s
Law, we will show you how to do the following:

• Organize small and medium-sized data science projects.


• Use the Unix shell to efficiently manage your data and code.
1 https://www.insightdatascience.com/
2 https://en.wikipedia.org/wiki/Zipf%27s_law
3 https://www.gutenberg.org/
4 0 Welcome

• Write Python programs that can be used on the command line.


• Use Git and GitHub to track and share your work.
• Work productively in a small team where everyone is welcome.
• Use Make to automate complex workflows.
• Enable users to configure your software without modifying it directly.
• Test your software and know which parts have not yet been tested.
• Find, handle, and fix errors in your code.
• Publish your code and research in open and reproducible ways.
• Create Python packages that can be installed in standard ways.

0.4 Using this Book

This book was written to be used as the material for a (potentially) semester-
long course at the university level, although it can also be used for independent
self-study. Participatory live-coding is the anticipated style for teaching the
material, rather than lectures simply talking about the code presented (N. C.
C. Brown and Wilson 2018; Wilson 2019a). The chapters and their content
are generally designed to be used in the order given.
Chapters are structured with the introduction at the start, content in the
middle, and exercises at the end. Callout boxes are interspersed throughout
the content to be used as a supplement to the main text, but not a requirement
for the course overall. Early chapters have many small exercises; later chapters
have fewer but larger exercises. In order to break up long periods of live-
coding while teaching, it may be preferable to stop and complete some of
the exercises at key points throughout the chapter, rather than waiting until
the end. Possible exercise solutions are provided (Appendix A), in addition
to learning objectives (Appendix B) and key points (Appendix C) for each
chapter.

0.5 Contributing and Re-Use

The source for the book can be found at the py-rse GitHub repository4
and any corrections, additions, or contributions are very welcome. Everyone
whose work is included will be credited in the acknowledgments. Check out our
4 https://github.com/merely-useful/py-rse
0.6 Acknowledgments 5

contributing guidelines5 as well as our Code of Conduct6 for more information


on how to contribute.
The content and code of this book can be freely re-used as it is licensed7 under
a Creative Commons Attribution 4.0 International License8 (CC-BY 4.0) and
a MIT License9 , so the material can be used, re-used, and modified, as long
as there is attribution to this source.

0.6 Acknowledgments
This book owes its existence to everyone we met through The Carpentries10 .
We are also grateful to Insight Data Science11 for sponsoring the early stages of
this work, to the authors of Noble (2009), Haddock and Dunn (2010), Wilson
et al. (2014), Scopatz and Huff (2015), Taschuk and Wilson (2017), Wilson et
al. (2017), N. C. C. Brown and Wilson (2018), Devenyi et al. (2018), Sholler
et al. (2019), Wilson (2019b) and to everyone who has contributed, including
Madeleine Bonsma-Fisher, Jonathan Dursi, Christina Koch, Sara Mahallati,
Brandeis Marshall, and Elizabeth Wickes.

• Many of the explanations and exercises in Chapters 2–4 have been adapted
from Software Carpentry’s lesson The Unix Shell 12 .
• Many of the explanations and exercises in Chapters 6 and 7 have been
adapted from Software Carpentry’s lesson Version Control with Git 13 and
an adaptation/extension of that lesson14 that is maintained by the Uni-
versity of Wisconsin-Madison Data Science Hub.
• Chapter 9 is based on Software Carpentry’s lesson Automation and Make15
and on Jonathan Dursi’s Introduction to Pattern Rules16 .
• Chapter 14 is based in part on Python 102 17 by Ashwin Srinath.

5 https://github.com/merely-useful/py-rse/blob/book/CONTRIBUTING.md
6 https://github.com/merely-useful/py-rse/blob/book/CONDUCT.md
7 https://github.com/merely-useful/py-rse/blob/book/LICENSE.md
8 https://creativecommons.org/licenses/by/4.0/
9 https://github.com/merely-useful/py-rse/blob/book/LICENSE-MIT.md
10 https://carpentries.org/
11 https://www.insightdatascience.com/
12 http://swcarpentry.github.io/shell-novice/
13 http://swcarpentry.github.io/git-novice/
14 https://uw-madison-datascience.github.io/git-novice-custom/
15 http://swcarpentry.github.io/make-novice/
16 https://github.com/ljdursi/make_pattern_rules
17 https://python-102.readthedocs.io/
1
Getting Started

Everything starts somewhere, though many physicists disagree.


— Terry Pratchett

As with many research projects, the first step in our Zipf’s Law analysis is
to download the research data and install the required software. Before doing
that, it’s worth taking a moment to think about how we are going to organize
everything. We will soon have a number of books from Project Gutenberg1
in the form of a series of text files, plots we’ve produced showing the word
frequency distribution in each book, as well as the code we’ve written to
produce those plots and to document and release our software package. If we
aren’t organized from the start, things could get messy later on.

1.1 Project Structure

Project organization is like a diet: everyone has one, it’s just a question of
whether it’s healthy or not. In the case of a project, “healthy” means that
people can find what they need and do what they want without becoming
frustrated. This depends on how well organized the project is and how familiar
people are with that style of organization.
As with good coding style, small pieces in predictable places with readable
names are easier to find and use than large chunks that vary from project to
project and have names like “stuff.” We can be messy while we are working
and then tidy up later, but experience teaches that we will be more productive
if we make tidiness a habit.
In building the Zipf’s Law project, we’ll follow a widely used template for
organizing small and medium-sized data analysis projects (Noble 2009). The
project will live in a directory called zipf, which will also be a Git repository
1 https://www.gutenberg.org/

7
8 1 Getting Started

stored on GitHub (Chapter 6). The following is an abbreviated version of the


project directory tree as it appears toward the end of the book:

zipf/
.gitignore
CITATION.md
CONDUCT.md
CONTRIBUTING.md
LICENSE.md
README.md
Makefile
bin
book_summary.sh
collate.py
countwords.py
...
data
README.md
dracula.txt
frankenstein.txt
...
docs
...
results
collated.csv
dracula.csv
dracula.png
...
...

The full, final directory tree is documented in Appendix D.

1.1.1 Standard information

Our project will contain a few standard files that should be present in every
research software project, open source or otherwise:

• README includes basic information on our project. We’ll create it in Chap-


ter 7, and extend it in Chapter 14.

• LICENSE is the project’s license. We’ll add it in Section 8.4.


• CONTRIBUTING explains how to contribute to the project. We’ll add it in
Section 8.11.
1.2 Downloading the Data 9

• CONDUCT is the project’s Code of Conduct. We’ll add it in Section 8.3.


• CITATION explains how to cite the software. We’ll add it in Section 14.7.

Some projects also include a CONTRIBUTORS or AUTHORS file that lists everyone
who has contributed to the project, while others include that information in
the README (we do this in Chapter 7) or make it a section in CITATION. These
files are often called boilerplate, meaning they are copied without change
from one use to the next.

1.1.2 Organizing project content

Following Noble (2009), the directories in the repository’s root are organized
according to purpose:

• Runnable programs go in bin/ (an old Unix abbreviation for “bi-


nary,” meaning “not text”). This will include both shell scripts, e.g.,
book_summary.sh developed in Chapter 4, and Python programs, e.g.,
countwords.py, developed in Chapter 5.
• Raw data goes in data/ and is never modified after being stored. You’ll
set up this directory and its contents in Section 1.2.
• Results are put in results/. This includes cleaned-up data, figures, and
everything else created using what’s in bin and data. In this project, we’ll
describe exactly how bin and data are used with Makefile created in
Chapter 9.
• Finally, documentation and manuscripts go in docs/. In this project, docs
will contain automatically generated documentation for the Python pack-
age, created in Section 14.6.2.

This structure works well for many computational research projects and we
encourage its use beyond just this book. We will add some more folders and
files not directly addressed by Noble (2009) when we talk about testing (Chap-
ter 11), provenance (Chapter 13), and packaging (Chapter 14).

1.2 Downloading the Data


The data files used in the book are archived at an online repository called
Figshare (which we discuss in detail in Section 13.1.2) and can be accessed at:
10 1 Getting Started

https://doi.org/10.6084/m9.figshare.13040516
We can download a zip file containing the data files by clicking “download all”
at this URL and then unzipping the contents into a new zipf/data directory
(also called a folder) that follows the project structure described above. Here’s
how things look once we’re done:

zipf/
data
README.md
dracula.txt
frankenstein.txt
jane_eyre.txt
moby_dick.txt
sense_and_sensibility.txt
sherlock_holmes.txt
time_machine.txt

1.3 Installing the Software


In order to conduct our analysis, we need to install the following software:

1. A Bash shell
2. Git version control
3. A text editor
4. Python 32 (via the Anaconda distribution)
5. GNU Make3

Comprehensive software installation instructions for Windows, Mac, and


Linux operating systems (with video tutorials) are maintained by The Car-
pentries4 as part of their workshop website template at:
https://carpentries.github.io/workshop-template/#setup
We can follow those instructions to install the Bash shell, Git, a text editor and
Anaconda. We recommend Anaconda as the method for installing Python, as
it includes Conda as well as many of the packages we’ll use in this book.
You can check if Make is already on your computer by typing make -v into
the Bash shell. If it is not, you can install it as follows:
2 https://www.python.org/
3 https://www.gnu.org/software/make/
4 https://carpentries.org/
1.4 Summary 11

• Linux (Debian/Ubuntu): Install it from the Bash shell using sudo apt-get
install make.
• Mac: Install Xcode5 (via the App Store).
• Windows: Follow the installation instructions6 maintained by the Master of
Data Science program at the University of British Columbia.

conda in the Shell on Windows


If you are using Windows and the conda command isn’t available at the
Bash shell, you’ll need to open the Anaconda Prompt program (via the
Windows start menu) and run the command conda init bash (this
only needs to be done once). After that, your shell will be configured
to use conda going forward.

Software Versions
Throughout the book, we’ll be showing you examples of the output you
can expect to see. This output is derived from running a Mac with:
Git version 2.29.2, Python version 3.7.6, GNU bash version 3.2.57(1)-
release (x86_64-apple-darwin19), GNU Make 3.81, and conda 4.9.2. In
some cases, what you see printed to the screen may differ slightly based
on software version. We’ll help you understand how to interpret the
output so you can keep working and troubleshoot regardless of software
version.

1.4 Summary

Now that our project structure is set up, our data is downloaded, and our
software is installed, we are ready to start our analysis.

5 https://developer.apple.com/xcode/
6 https://ubc-mds.github.io/resources_pages/install_ds_stack_windows/#make
12 1 Getting Started

1.5 Exercises

1.5.1 Getting ready

Make sure you’ve downloaded the required data files (following Section 1.2)
and installed the required software (following Section 1.3) before progressing
to the next chapter.

1.6 Key Points

• Make tidiness a habit, rather than cleaning up your project files later.
• Include a few standard files in all your projects, such as README, LI-
CENSE, CONTRIBUTING, CONDUCT and CITATION.
• Put runnable code in a bin/ directory.
• Put raw/original data in a data/ directory and never modify it.
• Put results in a results/ directory. This includes cleaned-up data and fig-
ures (i.e., everything created using what’s in bin and data).
• Put documentation and manuscripts in a docs/ directory.
• Refer to The Carpentries software installation guide7 if you’re having trou-
ble.

7 https://carpentries.github.io/workshop-template/#setup
2
The Basics of the Unix Shell

Ninety percent of most magic merely consists of knowing one extra fact.
— Terry Pratchett

Computers do four basic things: store data, run programs, talk with each
other, and interact with people. They do the interacting in many different
ways, of which graphical user interfaces (GUIs) are the most widely used.
The computer displays icons to show our files and programs, and we tell it to
copy or run those by clicking with a mouse. GUIs are easy to learn but hard
to automate, and don’t create a record of what we did.
In contrast, when we use a command-line interface (CLI) we communicate
with the computer by typing commands, and the computer responds by dis-
playing text. CLIs existed long before GUIs; they have survived because they
are efficient, easy to automate, and automatically record what we have done.
The heart of every CLI is a read-evaluate-print loop (REPL). When we
type a command and press Return (also called Enter) the CLI reads the
command, evaluates it (i.e., executes it), prints the command’s output, and
loops around to wait for another command. If you have used an interactive
console for Python, you have already used a simple CLI.
This lesson introduces another CLI that lets us interact with our computer’s
operating system. It is called a “command shell,” or just shell for short, and
in essence is a program that runs other programs on our behalf (Figure 2.1).
Those “other programs” can do things as simple as telling us the time or as
complex as modeling global climate change; as long as they obey a few simple
rules, the shell can run them without having to know what language they are
written in or how they do what they do.

13
14 2 The Basics of the Unix Shell

FIGURE 2.1: The Bash shell.

What’s in a Name?
Programmers have written many different shells over the last forty
years, just as they have created many different text editors and plotting
packages. The most popular shell today is called Bash (an acronym of
Bourne Again SHell, and a weak pun on the name of its predecessor,
the Bourne shell). Other shells may differ from Bash in minor ways, but
the core commands and ideas remain the same. In particular, the most
recent versions of MacOS use a shell called the Z Shell or zsh; we will
point out a few differences as we go along.

Please see Section 1.3 for instructions on how to install and launch the shell
on your computer.

2.1 Exploring Files and Directories


Our first shell commands will let us explore our folders and files, and will
also introduce us to several conventions that most Unix tools follow. To start,
when Bash runs it presents us with a prompt to indicate that it is waiting
for us to type something. This prompt is a simple dollar sign by default:

However, different shells may use a different symbol: in particular, the zsh
shell, which is the default on newer versions of MacOS, uses %. As we’ll see in
Section 4.6, we can customize the prompt to give us more information.
2.1 Exploring Files and Directories 15

Don’t Type the Dollar Sign


We show the $ prompt so that it’s clear what you are supposed to type,
particularly when several commands appear in a row, but you should
not type it yourself.

Let’s run a command to find out who the shell thinks we are:

$ whoami

amira

Learn by Doing
Amira is one of the learners described in Section 0.2. For the rest of
the book, we’ll present code and examples from her perspective. You
should follow along on your own computer, though what you see might
deviate in small ways because of differences in operating system (and
because your name probably isn’t Amira).

Now that we know who we are, we can explore where we are and what we
have. The part of the operating system that manages files and directories (also
called folders) is called the filesystem. Some of the most commonly used
commands in the shell create, inspect, rename, and delete files and directories.
Let’s start exploring them by running the command pwd, which stands for
print working directory. The “print” part of its name is straightforward; the
“working directory” part refers to the fact that the shell keeps track of our
current working directory at all times. Most commands read and write
files in the current working directory unless we tell them to do something else,
so knowing where we are before running a command is important.

$ pwd

/Users/amira

Here, the computer’s response is /Users/amira, which tells us that we are


in a directory called amira that is contained in a top-level directory called
Users. This directory is Amira’s home directory; to understand what that
16 2 The Basics of the Unix Shell

bin data tmp Users

amira jun sami

FIGURE 2.2: A sample filesystem.

means, we must first understand how the filesystem is organized. On Amira’s


computer it looks like Figure 2.2.
At the top is the root directory that holds everything else, which we can refer
to using a slash character / on its own. Inside that directory are several other
directories, including bin (where some built-in programs are stored), data
(for miscellaneous data files), tmp (for temporary files that don’t need to be
stored long-term), and Users (where users’ personal directories are located).
We know that /Users is stored inside the root directory / because its name
begins with /, and that our current working directory /Users/amira is stored
inside /Users because /Users is the first part of its name. A name like this is
called a path because it tells us how to get from one place in the filesystem
(e.g., the root directory) to another (e.g., Amira’s home directory).

Slashes
The / character means two different things in a path. At the front of
a path or on its own, it refers to the root directory. When it appears
inside a name, it is a separator. Windows uses backslashes (\\) instead
of forward slashes as separators.

Underneath /Users, we find one directory for each user with an account on
this machine. Jun’s files are stored in /Users/jun, Sami’s in /Users/sami, and
Amira’s in /Users/amira. This is where the name “home directory” comes
from: when we first log in, the shell puts us in the directory that holds our
files.
2.1 Exploring Files and Directories 17

Home Directory Variations


Our home directory will be in different places on different operating
systems. On Linux it may be /home/amira, and on Windows it may be
C:\Documents and Settings\amira or C:\Users\amira (depending
on the version of Windows). Our examples show what we would see on
MacOS.

Now that we know where we are, let’s see what we have using the command
ls (short for “listing”), which prints the names of the files and directories in
the current directory:

$ ls

Applications Downloads Music todo.txt


Desktop Library Pictures zipf
Documents Movies Public

Again, our results may be different depending on our operating system and
what files or directories we have.
We can make the output of ls more informative using the -F option (also
sometimes called a switch or a flag). Options are exactly like arguments to
a function in Python; in this case, -F tells ls to decorate its output to show
what things are. A trailing / indicates a directory, while a trailing * tells us
something is a runnable program. Depending on our setup, the shell might
also use colors to indicate whether each entry is a file or directory.

$ ls -F

Applications/ Downloads/ Music/ todo.txt


Desktop/ Library/ Pictures/ zipf/
Documents/ Movies/ Public/

Here, we can see that almost everything in our home directory is a subdirec-
tory; the only thing that isn’t is a file called todo.txt.
18 2 The Basics of the Unix Shell

Spaces Matter
1+2 and 1 + 2 mean the same thing in mathematics, but ls -F and
ls-F are very different things in the shell. The shell splits whatever
we type into pieces based on spaces, so if we forget to separate ls and
-F with at least one space, the shell will try to find a program called
ls-F and (quite sensibly) give an error message like ls-F: command
not found.

Some options tell a command how to behave, but others tell it what to act on.
For example, if we want to see what’s in the /Users directory, we can type:

$ ls /Users

amira jun sami

We often call the file and directory names that we give to commands argu-
ments to distinguish them from the built-in options. We can combine options
and arguments:

$ ls -F /Users

amira/ jun/ sami/

but we must put the options (like -F) before the names of any files or direc-
tories we want to work on, because once the command encounters something
that isn’t an option it assumes there aren’t any more:

$ ls /Users -F

ls: -F: No such file or directory


amira jun sami
2.2 Moving Around 19

Command Line Differences


Code can sometimes behave in unexpected ways on different computers,
and this applies to the command line as well. For example, the following
code actually does work on some Linux operating systems:

$ ls /Users -F

Some people think this is convenient; others (including us) believe it is


confusing, so it’s best to avoid doing this.

2.2 Moving Around


Let’s run ls again. Without any arguments, it shows us what’s in our current
working directory:

$ ls -F

Applications/ Downloads/ Music/ todo.txt


Desktop/ Library/ Pictures/ zipf/
Documents/ Movies/ Public/

If we want to see what’s in the zipf directory we can ask ls to list its contents:

$ ls -F zipf

data/

Notice that zipf doesn’t have a leading slash before its name. This absence
tells the shell that it is a relative path, i.e., that it identifies something start-
ing from our current working directory. In contrast, a path like /Users/amira
is an absolute path: it is always interpreted from the root directory down, so
it always refers to the same thing. Using a relative path is like telling someone
to go two kilometers north and then half a kilometer east; using an absolute
path is like giving them the latitude and longitude of their destination.
20 2 The Basics of the Unix Shell

We can use whichever kind of path is easiest to type, but if we are going to do
a lot of work with the data in the zipf directory, the easiest thing would be
to change our current working directory so that we don’t have to type zipf
over and over again. The command to do this is cd, which stands for change
directory. This name is a bit misleading because the command doesn’t change
the directory; instead, it changes the shell’s idea of what directory we are in.
Let’s try it out:

$ cd zipf

cd doesn’t print anything. This is normal: many shell commands run silently
unless something goes wrong, on the theory that they should only ask for our
attention when they need it. To confirm that cd has done what we asked, we
can use pwd:

$ pwd

/Users/amira/zipf

$ ls -F

data/
2.2 Moving Around 21

Missing Directories and Unknown Options


If we give a command an option that it doesn’t understand, it will
usually print an error message, and (if we’re lucky) tersely remind us
of what we should have done:

$ cd -j

-bash: cd: -j: invalid option


cd: usage: cd [-L|-P] [dir]

On the other hand, if we get the syntax right but make a mistake in
the name of a file or directory, it will tell us that:

$ cd whoops

-bash: cd: whoops: No such file or directory

We now know how to go down the directory tree, but how do we go up? This
doesn’t work:

$ cd amira

cd: amira: No such file or directory

because amira on its own is a relative path meaning “a file or directory called
amira below our current working directory.” To get back home, we can either
use an absolute path:

$ cd /Users/amira

or a special relative path called .. (two periods in a row with no spaces), which
always means “the directory that contains the current one.” The directory that
contains the one we are in is called the parent directory, and sure enough,
.. gets us there:
22 2 The Basics of the Unix Shell

$ cd ..
$ pwd

/Users/amira

ls usually doesn’t show us this special directory—since it’s always there,


displaying it every time would be a distraction. We can ask ls to include it
using the -a option, which stands for “all.” Remembering that we are now in
/Users/amira:

$ ls -F -a

./ Documents/ Music/ zipf/


../ Downloads/ Pictures/
Applications/ Library/ Public/
Desktop/ Movies/ todo.txt

The output also shows another special directory called . (a single period),
which refers to the current working directory. It may seem redundant to have
a name for it, but we’ll see some uses for it soon.

Combining Options
You’ll occasionally need to use multiple options in the same command.
In most command-line tools, multiple options can be combined with a
single - and no spaces between the options:

$ ls -Fa

This command is synonymous with the previous example. While you


may see commands written like this, we don’t recommend you use this
approach in your own work. This is because some commands take long
options with multi-letter names, and it’s very easy to mistake --no
(meaning “answer ‘no’ to all questions”) with -no (meaning -n -o).

The special names . and .. don’t belong to cd: they mean the same thing to
every program. For example, if we are in /Users/amira/zipf, then ls .. will
display a listing of /Users/amira. When the meanings of the parts are the
2.2 Moving Around 23

same no matter how they’re combined, programmers say they are orthogonal.
Orthogonal systems tend to be easier for people to learn because there are
fewer special cases to remember.

Other Hidden Files


In addition to the hidden directories .. and ., we may also come across
files with names like .jupyter. These usually contain settings or other
data for particular programs; the prefix . is used to prevent ls from
cluttering up the output when we run ls. We can always use the -a
option to display them.

cd is a simple command, but it allows us to explore several new ideas. First,


several .. can be joined by the path separator to move higher than the parent
directory in a single step. For example, cd ../.. will move us up two direc-
tories (e.g., from /Users/amira/zipf to /Users), while cd ../Movies will
move us up from zipf and back down into Movies.
What happens if we type cd on its own without giving a directory?

$ pwd

/Users/amira/Movies

$ cd
$ pwd

/Users/amira

No matter where we are, cd on its own always returns us to our home directory.
We can achieve the same thing using the special directory name ~, which is a
shortcut for our home directory:

$ ls ~

Applications Downloads Music todo.txt


Desktop Library Pictures zipf
Documents Movies Public
24 2 The Basics of the Unix Shell

(ls doesn’t show any trailing slashes here because we haven’t used -F.) We
can use ~ in paths, so that (for example) ~/Downloads always refers to our
download directory.
Finally, cd interprets the shortcut - (a single dash) to mean the last direc-
tory we were in. Using this is usually faster and more reliable than trying to
remember and type the path, but unlike ~, it only works with cd: ls - tries
to print a listing of a directory called - rather than showing us the contents
of our previous directory.

2.3 Creating New Files and Directories


We now know how to explore files and directories, but how do we create them?
To find out, let’s go back to our zipf directory:

$ cd ~/zipf
$ ls -F

data/

To create a new directory, we use the command mkdir (short for make
directory):

$ mkdir docs

Since docs is a relative path (i.e., does not have a leading slash) the new
directory is created below the current working directory:

$ ls -F

data/ docs/

Using the shell to create a directory is no different than using a graphical tool.
If we look at the current directory with our computer’s file browser we will see
the docs directory there too. The shell and the file explorer are two different
ways of interacting with the files; the files and directories themselves are the
same.
2.3 Creating New Files and Directories 25

Naming Files and Directories


Complicated names of files and directories can make our life painful.
Following a few simple rules can save a lot of headaches:

1. Don’t use spaces. Spaces can make a name easier to


read, but since they are used to separate arguments on the
command line, most shell commands interpret a name like
My Thesis as two names My and Thesis. Use - or _ instead,
e.g., My-Thesis or My_Thesis.
2. Don’t begin the name with - (dash) to avoid confu-
sion with command options like -F.
3. Stick with letters, digits, . (period or ‘full stop’),
- (dash) and _ (underscore). Many other characters mean
special things in the shell. We will learn about some of those
special characters during this lesson, but the characters cited
here are always safe.

If we need to refer to files or directories that have spaces or other special


characters in their names, we can surround the name in quotes (""). For
example, ls "My Thesis" will work where ls My Thesis does not.

Since we just created the docs directory, ls doesn’t display anything when
we ask for a listing of its contents:

$ ls -F docs

Let’s change our working directory to docs using cd, then use a very simple
text editor called Nano to create a file called draft.txt (Figure 2.3):

$ cd docs
$ nano draft.txt

When we say “Nano is a text editor” we really do mean “text”: it can only
work with plain character data, not spreadsheets, images, Microsoft Word
files, or anything else invented after 1970. We use it in this lesson because it
runs everywhere, and because it is as simple as something can be and still be
called an editor. However, that last trait means that we shouldn’t use it for
larger tasks like writing a program or a paper.
Random documents with unrelated
content Scribd suggests to you:
those "Contes à Ninon" gave no warning of what was to follow from his pen.
And yet at the very time of writing most of them he was being weaned from
romance and fable and idyl. Not only had he taken considerable interest in
About's "Madelon," but he had been studying Balzac, and particularly
Flaubert's "Madame Bovary," the perusal of which had quite stirred him. A
man had come, axe in hand, into the huge and often tangled forest which
Balzac had left behind him; and the formula of the modern novel now
appeared in a blaze of light. When "Madame Bovary" was issued in 1860, the
average Parisian, the average literary man even, regarded it merely as a
succès de scandale. Many of those who praised the book failed to understand
its real import; and when Flaubert was satirised in the popular theatrical
révue, "Ohé! les petits Agneaux," half Paris, by way of deriding him, hummed
the trivial lines sung by the actress who impersonated "Madame Bovary":
Émile Zola's Home, Impasse Sylvacanne, Aix-in-Provence.—Photo by C.
Martinet

Qu'importe! c'est officiel,


Ou vit quatre éditeurs me suivre:
Oui, Paul, Mathieu, Pierre, et Michel
Voulurent imprimer mon livre!...
Craignant mes excentricités
Mathieu ne vit pas mon mérite;
Paul ne vit pas mes qualités,
Pierre ne vit pas mes beautés,
Mais Michel les vit
Mais Michel les vit[14]
Tout de suite!"
Zola, however, did not laugh or jeer at "Madame Bovary"; he felt that a
literary evolution might be at hand, as is shown by his subsequent
correspondence with Valabrègue. The struggle which was to last all his life,
one between his reason and his imagination, was beginning, if indeed it had
not begun previously; for the oscillation which one observes in his writings
between romanticism and realism—or naturalism as the latter became in its
advanced stage—would indeed seem to be only a continuation of what had
happened in his school days, when, in spite of proficiency in literary subjects,
he had elected to follow a scientific course of study, in the midst of which,
however, his literary bent had still and ever asserted itself. Novalis has said:
"Every person who consists of more than one person is a person of the
second power—or a genius." If that be true, then Zola was certainly a genius;
for there were always two men in him. And, in any case, those who desire to
understand him aright should never lose sight of the duality of his nature.
But at the stage of his career which one has now reached, the realist, the
naturalist, had not fully arisen. We find him appearing in Zola's next book, "La
Confession de Claude," and in sundry newspaper articles, which, like the
"Confession," were issued in 1865. After working ten hours a day at
Hachette's, the young man, on returning to his home—which in the year
mentioned was first at 142, Boulevard Montparnasse, near a shooting gallery
which prevented him from working, and a little later at 10, Rue de Vaugirard,
where he had a balcony overlooking the Luxembourg gardens—at once turned
to the "Confession," or else to the press-work he had secured. Every week he
wrote an article of from one hundred to one hundred and fifty lines for the
"Petit Journal," and often another, running from five to six hundred lines for
the "Salut Public," then the chief organ of the Lyons press. The former
newspaper paid him twenty francs for each article, the latter, from fifty to
sixty francs. Thus he now made an average of two hundred francs a month by
his pen.[15] It was also at this period that he contributed a few short tales,
notably "La Vierge au Cirage," to that somewhat demi-mondain periodical "La
Vie Parisienne," and that he wrote a one-act comedy, "La Laide," which he
sent to the Odéon Theatre, whose manager declined to stage it.
But the articles in the "Salut Public" attracted attention, and Zola afterwards
reprinted some of them in a volume called "Mes Haines." The germ of the
Zola of later times will be found in several of those early papers. The one on
Taine is perhaps the best; and, when one remembers that it was written by a
young man in his twenty-fifth year, the real understanding and critical insight
which it discloses appear all the more creditable. Another notable article was
a bold, disdainful review of Napoleon III's "Histoire de Jules César,"
containing, in the usual veiled language of the times, the first indication that
Zola held Republican opinions. Again, two articles on "Le Supplice d'une
Femme" and the Dumas-Girardin scandal connected with that tragedy are in
their way interesting, while another on the "Germinie Lacerteux" of Edmond
and Jules de Goncourt is particularly noteworthy as showing the progress of
Zola's evolution towards naturalism in literature.
This article was favourable to the book, whose authors it pleased, and some
communications having been exchanged, the young journalist secured a seat
for that famous first performance of "Henriette Maréchal," which ranks as one
of the most uproarious nights in the history of the Comédie Française. The
audience, Zola tells us,[16] began to hiss before the curtain rose; the storm
burst forth at the first words spoken by the actors. The opening scene, laid at
the opera-house on the night of a masked ball, scandalised the old habitués
of the Comédie. Modern masqueraders and slang in the home of Racine and
Corneille! What sacrilege! But the greatest opposition to the piece came from
the young Republicans of the time, who were not influenced by the merits or
faults of the play, but simply by the fact that its performance at the Comédie
was due to the influence of the Emperor's cousin, the Princess Mathilde.
Yet whatever might be the public dislike of that member of the reigning
house, to whom a horrid nickname was currently given, whatever the
notoriety of her liaison with the Count de Nieuwerkerke, the "Superintendent
of Fine Arts," it was somewhat hard for the Goncourts that their play should
be rendered responsible for her lapses. But good came out of evil, as the
saying goes; if "Henriette Maréchal" was hissed off the stage, the fracas made
the Goncourts famous. Two nights of uproar contributed more to popularise
their name and to win readers for their works than years of zealous toil. They
had long been esteemed in literary circles, but hitherto they had remained
unknown to the great public. Their novels, like their historical works, had
secured no large sales, whereas now all was altered, and the change, and the
circumstances which wrought it, produced a deep impression on Émile Zola,
confirmed him in the view which he had already begun to entertain, that fame
in the modern literary world depended largely on a resounding coup-de-
pistolet.
He was fairly well pleased with the result of his volume of "Contes," but prior
to the "Henriette Maréchal" scandal[17] he had already declared that he would
greatly have preferred a severe "slating" to some of the milk-and-water praise
of his reviewers. As he wrote to Valabrègue, however, he lived in the hope
that his next book, "La Confession de Claude," would almost "decide his
reputation." It was published by Lacroix, on November 25, 1865,[18] at the
Librairie Internationale, which he had now established in conjunction with a
Flemish confrère, Verboeckhoven; and this time the arrangement with Zola
was that the latter should receive a royalty of ten per cent, or thirty centimes,
[19] for every copy sold. As, however, only fifteen hundred copies were
printed, the sale of the entire edition represented less than twenty pounds[20]
for the author, and it so happened that the book was not reissued till 1880.
From this it might be inferred that it proved an absolute failure, but such was
hardly the case. Certainly it was not a perfect book. Zola himself afterwards
wrote that the observer occasionally vanished from its pages, allowing the
poet to appear, a poet who had drunk too much milk and eaten too much
sugar. "It was not," said he, "a virile work; it was the cry of a weeping,
rebellious child." But with all its faults it bore the impress of sincerity;
Daudet's "Sapho," though far superior as literature, leaves one cold when one
turns to it after perusing Zola's feverish pages. If the public did not rush to
buy the "Confession," the critics, at all events, paid it considerable attention,
and several assailed it unmercifully. For instance, Barbey d'Aurévilly, writing in
the "Nain Jaune," declared that its "hero" was a toad, and that the author had
simply spun out, over three hundred and twenty pages, what Cambronne,
who commanded the Old Guard at Waterloo, had expressed in a single word.
But what particularly roused Zola's ire was that "le Catholique hystérique," as
he subsequently nicknamed Barbey d'Aurévilly, maliciously referred to the
"Confession" as "Hachette's little book," whereas that firm had nothing to do
with it. Zola therefore addressed a letter of protest to the "Nain Jaune."[21]
But he had already decided to sever his connection with his employers. Since
the death of M. Louis Hachette in the summer of 1864, the young man's
position in the firm had been growing difficult. His superiors looked askance at
his literary efforts, as if they thought that he wrote stories and articles in the
time for which they paid him. Moreover, as they themselves did not deal in
revolutionary literature, they did not care to have one of their clerks
associated with such work. "La Confession de Claude" seemed to them too
outspoken; and a few days after its publication, that is, at the end of
November, 1865, one of the partners said to Zola: "You earn two hundred
francs a month here. It is ridiculous! You have plenty of talent, and would do
better to take up literature altogether. You would find glory and profit in it."
[22]

Zola took the hint (conveyed pleasantly enough) and gave notice to leave at
the end of the following January. And he was the better pleased at having
adopted that course, and having averted, perhaps, a direct dismissal, as a few
weeks after the appearance of "La Confession de Claude" the Procureur
Impérial, otherwise the public prosecutor, influenced by certain reviews of the
book, caused some inquiries to be made at Hachette's with respect to its
author. No prosecution ensued, and "Madame Bovary" having escaped scot
free, it is extremely doubtful if one would have succeeded even in those days
of judicial subserviency to the behests of the authorities, particularly as,
whatever might be the subject-matter of the "Confession," it was instinct
throughout with loathing and censure of the incidents it narrated. In any case,
Zola, on writing to Valabrègue early in January, 1866, with thoughts, perhaps,
of "Henriette Maréchal" and the Goncourts in his mind, was by no means
alarmed or cast down. If, said he, the "Confession" had damaged him in the
opinion of respectable folk, it had also made him known; he was feared and
insulted, classed among the writers whose works were read with horror. For
his part, he did not mean to pander to the likes or the dislikes of the crowd;
he intended to force the public to caress or insult him. Doubtless, indifference
would be loftier, more dignified; but he belonged to an impatient age, and if
he and his fellows did not trample the others under foot, the others would
certainly pass over them, and, personally, he did not desire to be crushed by
fools.
And now, then, having published two volumes, the first fairly well received,
the second virulently attacked, he quitted Hachette's, to give himself up
entirely to journalism and literature.

[1] £2 8s.; or about $12.


[2] Frédéric Lock's "Dictionnaire topographique et historique de l'ancien
Paris," Paris, n. d. but cir. 1856.
[3] Portions of the three poems are printed by Alexis, l. c.
[4] "Le Paris Guide par les principaux Écrivains de la France," Vol. II, Paris,
1867.
[5] "La Confession de Claude," Nouvelle Édition, 1903, p. 141.
[6] See E. A. Vizetelly's Introduction to "The Fat and the Thin" ("Le Ventre
de Paris") London, 1896. The original appeared in "Le Figaro," November
20, 1866; and Zola reprinted portions of it, altered out of regard for his
wife, in "Nouveaux Contes à Ninon," 1874.
[7] "Revue Bleue," March 10, 1883; and "Célébrités contemporaines," Vol.
I, Paris, 1883.
[8] About sixty-four cents, American currency.
[9] Alexis, l. c., p. 56.
[10] See ante, p. 49.
[11] "La Grande Revue," Paris, 1893, Vol. XXVI, pp. 1-19, 241-262.
[12] These lectures were given first in the Rue de la Paix, later in the Rue
Cadet, and later still in the Rue Scribe. They were most interesting and
instructive. The present writer often attended them in the last years of the
Empire to hear Deschanel the elder, J. J. Weiss, Eugène Pelletan,
Laboulaye, Legouvé, St. Marc-Girardin, Henri Martin, Sarcey, Wolowski, and
others.
[13] No date appears on the title of the first edition (18mo, 3 francs),
which bears the imprints of Hetzel and Lacroix, and Poupart-Davyl & Co.,
Printers.
[14] A pun on the name of the publisher, Michel Lévy. It must he admitted
that while the authors of "Ohé! les petits Agneaux" scoffed at Flaubert,
they gave him a splendid advertisement.
[15] Zola to Valabrègue, February 6, 1865.
[16] "Les Romanciers Naturalistes," Paris, 1881, p. 238.
[17] The first performance took place on December 5, 1865.
[18] Though "1866" appears on the title-page, the above is the exact date
of publication and registration at the Ministry of the Interior. Alexis is
therefore in error when he says the book appeared in October. The
question of date has some importance in connection with Zola's departure
from Hachette's and the cause thereof.
[19] About 3d.; or six cents (American).
[20] Say $100.
[21] R. H. Sherard's "Émile Zola: A Biographical and Critical Study."
London, 1895, pp. 52, 53.
[22] Fernand Xau's "Émile Zola." 12mo, 68 pages, Paris, 1880.

IV

IN THE FURNACE OF PARIS

1866-1868

Henri de Villemessant, the Barnum of the Parisian press—His papers,


"L'Événement" and "Le Figaro"—The first interviews in French journalism
—Millaud and Timothée Trimm—Girardin's fresh idea every day—Zola
inaugurates "Literary Gossip"—A glance at French literature in 1866—
Zola, Littré, and Michelet—Zola's first impression of Alphonse Daudet—
The Librairie Nouvelle and the Librairie Internationale—Zola and the
Open-Air School of Art—Léopold Tabar and "L'Œuvre"—Zola's articles on
the Salon of 1866—The great sensation in the art-world—A holiday at
Bennecourt—"Le Vœu d'une Morte"—"Marbres et Plâtres"—"La
Madeleine"—A "definition of the novel"—Hard times—Zola in love—More
writings on art—"Les Mystères de Marseille"—"Thérèse Raquin"—Arsène
Houssaye and his moral tag—Ulbach and "putrid literature"—Ste.-Beuve's
criticism and Zola's reply—"Les Mystères de Marseille" as a play—"La
Honte," otherwise "Madeleine Férat"—First idea of the Rougon
Macquarts.

One of the best-known Parisians of those days was Henri de Villemessant, a


man typical of the period, with something of Barnum and Balzac's "Mercadet"
in his composition. He was the son of one of the first Napoleon's dashing
plebeian colonels by a young woman of noble birth, whose name he had to
take and retain, after engaging in an unsuccessful law-suit to prove the
legitimacy of his birth and thereby secure a right to the name of his father.
Coming to Paris as a young man, in the early days of Louis Philippe's reign,
Villemessant conceived the idea that a fortune might be made by running a
fashions journal on new lines; and, under the patronage of La Taglioni, the
famous ballet dancer, he founded one called "La Sylphide," in which
dressmakers and their creations, hairdressers and their restorers, corsets and
cosmetics, in fact "beautifiers" of every description, were puffed in a skilful
and amusing manner. "La Sylphide" did not make Villemessant a millionaire,
but the money and the experience he acquired in conducting it launched him
into a very successful career. In the days of Charles X. there had been a
newspaper called "Le Figaro," which had died as many newspapers die. The
title having lapsed, anybody could appropriate it, and Villemessant, finding it
to his liking, did so. He started, then, a weekly journal called "Le Figaro,"
which at first was devoted largely to things theatrical, and in particular to the
charms, the wit, and the merits of actresses, not forgetting those of the demi-
monde.
The contents of "Le Figaro," in its early period, were often scurrilous;
unpleasant stories were current respecting the means by which paragraphs of
green-room gossip were inserted or suppressed, but Villemessant, paying no
heed, went his way, prosperous and rejoicing. In course of time, like many
another adventurer, he assumed some semblance of respectability, and
imparted a literary touch to his journal. But, as its questionable days were still
too recent for many folk to take to it, he decided to start, or rather revive for
a time, another derelict newspaper, "L'Événement," which he made a non-
political morning daily.
Villemessant had a remarkable scent for actualité and talent. Almost every
French writer popular from 1864 onward, contributed for a time to
"L'Événement" or to "Le Figaro," which eventually took the other journal's
place. Villemessant liked to capture his contributors young, when they were
beginning to show their mettle, run them for a year or two, then toss them
aside in order to make room for other promising débutants. From special
circumstances a few men remained with him till the last, but the number of
those whose connection with Villemessant's journals proved as brief as
brilliant, was extraordinary. It may be said of him that if he did not originate
he at least accentuated the personal note in French newspaper writing; and,
in conjunction with his collaborateur, Adrien Marx, he was certainly the very
first to introduce the "interview" into European journalism.[1] Later he became
the sponsor of Henri Rochefort, who did so much to demolish the Second
Empire.
It was into the hands of Villemessant that Zola fell on quitting Hachette's. He,
Zola, had already had some dealings with another singular and prominent
newspaper promoter, Millaud, the first to produce a popular halfpenny daily in
Paris, "Le Petit Journal," in whose columns Léo Lespès, a Parisian hairdresser,
achieved journalistic celebrity as "Timothée Trimm." There was as much of a
Barnum in Millaud as there was in Villemessant, but while the former was a
thorough Hebrew Jew, the latter was a Christian one, who, whenever it suited
his purpose, could be a liberal pay-master. And, besides, his manners were
pleasant, even jovial; his greatest vice being an extreme partiality for the
pleasures of the table, in which respect his contemporaries contrasted him
with Dr. Véron, another famous newspaper man of those times, saying,
"Véron is a gourmet, and Villemessant a glutton."
Émile de Girardin, the father of the modern French press, who at the period
one has now reached, 1866, was conducting a paper called "La Liberté,"
which had little influence in Paris, had made himself responsible, in Louis
Philippe's time, for a fresh idea every day—not, it must be said, altogether
successfully, for many of the ideas which he enunciated were mere paradoxes.
Villemessant, who owed much to Girardin, was an equally great believer in
novelty; but being less versatile, and suffering, moreover, from a laborious
digestion, which consumed much of his time, he did not often have ideas of
his own. So he purchased those of others. He had taken a wife while he was
yet in his teens, and had two daughters, one married to his musical critic,
Jouvin, the other to a M. Bourdin, who attended to some of his business
matters, such as advertising and puffery. Bourdin called upon the Paris
publishers, and at Hachette's offices he met Zola. The latter, having decided to
quit the firm, told Bourdin of an idea he had formed; it was communicated to
Villemessant, who at once offered to give Zola a trial.
The matter was very simple, and will even appear trivial to present-day
English and American journalists. Under the title of "Books of To-day and To-
morrow," Zola proposed to contribute a variety of literary gossip to
"L'Événement," after the style of the theatrical gossip, already printed by that
and other newspapers. Though publishers' puffs appeared here and there,
nobody had previously thought of doing for books and writers what many
were already doing for plays, operas, actors, and especially actresses. The
innovation took Villemessant's fancy; and Zola, quitting Hachette's on January
31, 1866, published his first gossip in "L'Événement" two days later. In one
important respect his articles differed from the theatrical gossip of the time.
Much of the latter was paid for by managers or performers; whereas Zola
neither sought nor accepted bribes from authors or publishers, but looked to
"L'Événement" for his entire remuneration. As mentioned previously, he had
been engaged on trial, and thus no actual scale of payment had been
arranged. When at the end of a month he called upon the cashier at
"L'Événement" office he was both amazed and delighted to receive five
hundred francs.[2]
Villemessant, for his part, was well pleased with the contributions. Though the
time was not one of exceptional literary brilliancy, it had its interesting
features, and the activity in the book-world was the greater as the first period
of the Second Empire, that of personal rule, had not yet quite ended, the
second period, that of the so-called "Empire libéral," dating only from the
ensuing year, 1867. The French still possessed few liberties, the Government
kept a strong curb on the political newspapers that were tolerated, and thus
literature at least had a chance of attracting that wide attention of which
politics so often despoil it. But it was also a degenerate time, the time of
Clodoche at the opera-balls, of Offenbach's "Orphée" and "La Belle Hélène."
Only a few months previously (November, 1865), Victorien Sardou had
produced his "Famille Benoîton," one of the very best of his many theatrical
efforts, a stinging but truthful satire of some of the manners of the day, such
as they had become in the atmosphere of the imperial régime.
To the conditions of the time may be largely attributed certain features of its
journalism, and of at least one branch of its literature, fiction. Again and again
the most prominent articles in the majority of the Paris newspapers (only five
or six of which were serious political organs) dealt with such women as Cora
Pearl, Giulia Barucci, Anna Deslions, and Esther Guimond; such men as Worth,
the dressmaker, Markowski, the dancing master, Gramont-Caderousse, the
spendthrift, and Mangin, the charlatan. The average boulevardian novel
beautified vice, set it amid all the glamour of romance. The adulterous woman
was an angel, the courtesan quite a delightful creature, her trade a mere
péché mignon. The lovers, the seducers, were always handsome, high-
minded, exceptionally virile, irresistible; while the deceived husbands were of
every kind,—odious, tragic, pathetic, débonnair, or simply ridiculous. And
every "intrigue" was steeped in an odour of musk and suffused with a cloud of
poudre-de-riz.
At the same time some of the great writers of the July Monarchy were still
living. But if Hugo, the Olympian veteran, showed little sign of decay, either
with his "Chansons des Rues et des Bois," or his "Travailleurs de la Mer,"
Dumas the elder was now at his last stage, and George Sand, bound by an
agreement to the "Revue des Deux Mondes," was deluging its readers with
the mere milk and water of "Laura" and similar productions, though she
treated others—as a result, perhaps, of the vitiated taste of the hour—to such
strong and unsavoury meat as "Elle et Lui," to which Paul de Musset retorted
with his pungent relevé, "Lui et Elle." The recluse of Nohant was to produce
good work yet, but that she herself should publicly flaunt the least excusable
of her many amours was sad and repulsive.
Meantime other great workers, as diligent as she, were steadily pursuing their
life work. Littré, whom Zola knew slightly, for Hachettes were his publishers,
and on whom he called in his modest second-floor rooms in the Rue d'Assas,
was continuing his great dictionary of the French language,[3] and making his
first attempt to enter the Academy, to be foiled, however, by the frantic
bigotry of Bishop Dupanloup, whereas those minor lights, Camille Doucet and
Prévost-Paradol, secured without difficulty the honours of election. Then
Littré's neighbour, Michelet,—another of Hachette's authors—whose quiet
soireés Zola, like other young literary men, occasionally attended, was
completing his History of France. And there was much activity among
historical writers generally, and, in particular, a large output of books throwing
light on phases and personages of the great Revolution.
At that period also a little band of so-called Parnassian poets, inspired, some
by Leconte de Lisle, and others by Baudelaire, but, for the most part, gifted
with little breadth of thought, was imparting to French verse an extreme
literary polish, at times attaining real beauty of expression, and at others
lapsing into a préciosité, which neither sonority of sound nor wealth of
imagery could save from being ridiculous. Meanwhile, in dramatic literature,
Ponsard was producing his version of "Le Lion Amoureux," and Augier his
"Contagion," the latter's success being due, however, more to political reasons
than to any intrinsic merit.[4] Then, in fiction, if Edmond About seemed to
have run to seed prematurely with his interminable novel, "La Vieille Roche,"
Octave Feuillet was writing his best book, "Monsieur de Camors." And if the
historical novel, as Dumas had conceived it, had declined to mere trash, those
well-known literary partners, Erckmann-Chatrian, by transforming it and
dealing exclusively with the period of the Revolution and the First Empire,
were achieving repeated successes, their popularity being the greater among
the Parisians on account of the Republican spirit of their writings. Then the
foibles of the time were vividly illustrated by Taine's amusing "Graindorge,"
and Droz's "Monsieur, Madame, et Bébé," the last as strange a medley of
immorality, wit, and true and honest feeling as ever issued from the press. But
there was no redeeming feature in the nonsensical stories of semi-courtesans
to which the brilliant Arsène Houssaye had declined; no shade of literary merit
in the wild, unending romances with which Ponson du Terrail harrowed the
feelings of every Parisian doorkeeper and apprentice. Perhaps the best serial
writer of the time was Émile Gaboriau, for though his style was devoid of any
literary quality, he was ingenious and plausible, and by the exercise of these
gifts raised the detective novel of commerce from the depths in which he
found it.
But a delightful story-teller was coming to the front in the person of young
Alphonse Daudet, who, since his arrival in Paris some nine years previously,
had made his way sufficiently well to secure the performance of a one-act
comedy, "L'Œillet blanc," at the Comédie Française, and of another, "La
Dernière Idole," at the Odéon. He had also contributed to "Le Petit
Moniteur,"—a one-sou adjunct of the official journal—in whose columns he
signed either "Baptiste" or "Jehan de l'Isle." Further, he had begun his familiar
"Tartarin" under the title of "Le Don Quichotte provençal"; and he gave his
charming "Lettres de mon Moulin" to "L'Événement," at the very time when
Zola was providing that journal with literary gossip. The young men met
occasionally at the offices as well as at Villemessant's country house at Seine-
Port, and Zola was greatly struck by Daudet's handsomeness,—"his abundant
mane of hair, his silky, pointed beard, his large eyes, slender nose, and
amorous mouth, the whole illumined by a ray of light, instinct with a soft
voluptuousness, in such wise that his face beamed with a smile at once witty
and sensual. Something of the French gamin and something of the woman of
the East, were blended in him."[5]
But Daudet and Zola, afterwards such good friends, did not become intimate
at this time. They merely elbowed one another on a few chance occasions,
then followed the different roads they had chosen, roads which seemed likely
to part them for ever, but which ended by bringing them as near one to the
other as their natures allowed.
In those days one of the institutions of literary and boulevardian Paris was the
Librairie Nouvelle, which had been founded in 1853 or 1854, at the corner of
the Boulevard des Italiens and the Rue de Grammont, by a M. Bourdilliat, who
subsequently sold the enterprise to Michel Lévy, the well-known publisher.
This Librairie Nouvelle was both a publishing and a book-selling centre, and
was much patronised by literary men, who made it a kind of lounge, meeting
there of an afternoon, towards the absinthe hour, and again at night when the
theatres closed. You might meet there such men as the two Dumas, the
Goncourts, Paul de Musset, Nestor Roqueplan, Gautier, About, Lambert-
Thiboust, Jules Noriac, a brilliant chroniqueur, who never went to bed till
sunrise, Xavier Aubryet, who combined literature with business, penning prose
as full of sparkle as the champagne he sold, and Dr. Cerise, a fashionable and
eccentric medical man, who shrewdly "physicked" his lady patients with
amusing books. Chatrian also came to the Librairie Nouvelle, with Offenbach,
Clésinger, Auber, Halévy, and Meilhac; and among all these one might
occasionally espy amiable diplomatists like the Chevalier Nigra and the Prince
de Metternich, the husband of "the wittiest woman of the age."
Now, when M. Albert Lacroix, the publisher of Zola's "Contes à Ninon" and
"Confession de Claude," established the Librairie Internationale, in a very
similar position, that is at the corner of the Boulevard Montmartre and the
Rue Vivienne, he wished to make it a literary centre of the same description
as the Librairie Nouvelle. And he largely succeeded in his endeavour,
attracting many patrons of the older establishment, and drawing numerous
others around him. Indeed, the Librairie Internationale became almost a
revolutionary centre; for besides issuing many translations of foreign works,
such as those of Grote, Buckle, Dean Merivale, Bancroft, Motley, Prescott,
Gervinus, Duncker, and Herder, it published many of the writings of Hugo and
Michelet, Eugène Pelletan and Edgar Quinet, Lamartine and Laveleye, Jules
Simon, Ernest Hamel, and Proudhon,—briefly of men whose principles were
opposed to those of the Second Empire.[6] Occasionally M. Lacroix was led
into hot water by his democratic tendencies, as, for instance, when he
incurred fine and imprisonment for issuing Proudhon's annotated edition of
the Gospels, whereupon he became so alarmed that for some time he would
not continue the publication of Hamel's whitewashing of Robespierre, of which
he had already issued the first volume. In fiction he was often venturesome;
for he not only produced "Manette Salomon" and "Madame Gervaisais" for the
Goncourts, but he issued "Le Maudit" and other notorious volumes by the
Abbé ***,—really the Abbé Michon,—an author whom Zola did not hesitate to
"slate" in a provincial newspaper, though Lacroix was his own publisher.
"Disgust," he wrote, "rises to the lips when one reads these novels[7]
floundering through filth, as vulgar in form as they are in thought, and
pandering to the gross appetites of the multitude. One must assume that all
this vileness and vulgarity is intentional on the author's part: he has written
for a certain public and has served it the spicy and evil-smelling ragoûts which
he knows will please it."
On the other hand, calling now and again at the Librairie Internationale, Zola
there acquired no little information which became useful for his contributions
to "L'Événement," besides making the acquaintance of various literary men.
But his old friends remained his favourite ones, and Cézanne, the painter,
ranked foremost among them. He, Cézanne, had become a fervent partisan of
the new school of art, the school which Zola called that of the Open Air, and
which led to Impressionism. Zola himself had strong artistic leanings and
sympathies; he spent hours in the studio of his friend, who introduced him to
several other young painters, first Guillemet, then Édouard Béliard, Pissarro,
Claude Monet, Degas, Renoir, Fantin-Latour,—as well as Théodore Duret, art
critic and subsequently historian—with all whom he often discussed art at the
famous Café Guerbois at Batignolles. A little later, Guillemet and Duranty the
novelist,[8] with whom Zola had kept up an intercourse since leaving
Hachette's, introduced him to Édouard Manet, the recognised leader of the
new school; and in all likelihood Zola, about the same time, came across the
unlucky Léopold Tabar, a born colourist, whom Delacroix had favoured and
helped.
Tabar produced one striking and almost perfect painting, a "Saint Sebastian,"
but the rest of his life was consumed in ineffectual efforts. His sketches were
admirable, but he could never finish a picture, and his failures were
accentuated by his constant ambition to produce something huge, something
colossal. Yet for years he was regarded as a coming great man. He had failed
with his last picture, no doubt, but his next would be a masterpiece. He died
at last in misery. And so much of his story corresponds with that of Zola's
novel, "L'Œuvre," that it seems certain the author must have met the
unfortunate painter, and have blended his life with that of Cézanne and others
when preparing his study on the art-world of Paris.[9]
It was undoubtedly because Zola found himself thrown so much among the
young painters of the new school that he asked Villemessant to let him write
some critical articles on the Salon of 1866, a request which the editor of
"L'Événement" seems to have granted readily enough. It is a curious
circumstance that scores of prominent French authors, including famous
poets, historians, novelists, and playwrights, have written on one or another
Salon at some period of their careers. It used to be said in Paris, half in jest,
half in earnest, that nobody could aspire to literary fame of any kind without
having criticised at least one of the annual fine-art shows in the Champs
Élysées. In any case the admission of "non-professionals," so to say, among
the critics, has been beneficial with respect both to the quality of art and the
diffusion of artistic perception in France. It has more than once led painting
out of the beaten track, checked the pontiffs of narrow formulas, encouraged
the young, helped on the new schools. At times the professional art critic has
found his harsh dogmas and slavish traditions shattered by the common sense
of his non-professional rival. In England it happens far too often that the
same men write on art in the same jargon and in the same newspapers and
periodicals for years and years. In the long run, they fail to interest their
readers: they are for ever repeating the same things. They cannot appreciate
any novelty: their vision has become too prejudiced. And they exercise no
healthy, educating, vivifying influence. It is no wonder, then, that the diffusion
of artistic culture in England should proceed very slowly.
Of course, even in France, the partisans of old and recognised schools do not
immediately welcome a new one. For the most part they defend their
acquired position with all the vigour they possess. And the battle may go on
for some years before a new formula triumphs, soon to find, perhaps, yet
another one preparing to challenge its hard-earned victory. When Zola, whose
eyes treasured memories of the bright sunlight of Provence, who could recall
the limpid atmosphere of the hillsides that girdled Aix, entered the lists to do
battle for the new realists of that time he encountered a terrific opposition. It
had been arranged with Villemessant that he should write from sixteen to
eighteen articles, passing the entire Salon in review; but he penned and
published seven only—the first two, which dealt with the exhibition jury and
its system of admitting and excluding pictures, being written prior to May 1,
the opening day. These articles, which accused the jury of manifest injustice
in excluding Édouard Manet, and almost every artist who shared his
tendencies, created quite an uproar in the Parisian art-world, which increased
when a third article denounced the absolute mediocrity of some eighteen
hundred and ninety of the two thousand pictures which had been "hung." A
fourth article, in vindication of Manet and his methods, and a fifth praising
Claude Monet's "Camille," and attacking Vollon, Ribot, Bonvin, and Roybet as
spurious realists, brought matters to a climax. Villemessant and Zola himself
were assailed with letters of complaint, some hundreds of readers (inspired
for the most part by the artistic enemies of the "Open-Air" school) demanding
the critic's immediate dismissal or withdrawal. Zola's articles, it may be said,
were signed with the nom de plume of "Claude,"—in memory, no doubt, of
"Claude's Confession," and in anticipation of the "Claude Lantier" of
"L'Œuvre,"—nevertheless, his identity having been divulged, he was freely
abused by the critics of rival newspapers, and was even threatened with a
duel.
At that time, it should be mentioned, Édouard Manet, whose high talent needs
no praise nowadays, was generally regarded as a mystifier, an impudent
scamp who delighted to play jokes with the public, and it followed that this
man Zola, who defended him, must be either another mystifier or else a mere
ignorant jackass. Villemessant, however, less alarmed than amused by the
storm which had been raised, was unwilling to dismiss him. In lieu thereof he
decided to run a second series of articles on the Salon, one of the orthodox
type, by Théodore Pelloquet, which it was thought would counterbalance the
revolutionary utterances emanating from Zola. But this decision, although
almost worthy of Solomon, did not satisfy the readers of "L'Événement." They
would not have Zola as art critic at any price, and so he brought his campaign
to an end after two more strongly written articles. In the first, truthfully
enough, and in a regretful spirit, he pointed out the decline of Courbet, Millet,
and particularly Théodore Rousseau, whose pictures that year were of an
inferior quality, while, in the second, after attacking Fromentin for painting
Oriental scenes with plenty of colour, but with an absolute lack of light, he
turned the now-forgotten Nazon's sunsets into ridicule, and dismissed Gérome
and Dubuffe with a few stinging words. On the other hand, he praised
Daubigny, Pissarro (then a newcomer among the realists), and Corot,
observing of the last, however, that he would like his work far better if he
would only slaughter the nymphs with which he peopled his woods, and set
real peasants in their places. And he wound up as follows, in words which,
applied to much of his after-life, were almost prophetic:——

"In these articles I have defended M. Manet as, throughout my life, I


shall always defend every frank personality that may be assailed. I shall
always be on the side of the vanquished. There is always a contest
between men of unconquerable temperaments and the herd. I am on the
side of the temperaments, and I attack the herd. Thus my case is judged,
and I am condemned. I have been guilty of such enormity as to fail to
admire M. Dubuffe, after admiring Courbet—the enormity of complying
with inexorable logic. Such has been my guilt and simplicity that I have
been unable to swallow without disgust the fadeurs of the period, and
have demanded power and originality in artistic work. I have blasphemed
in declaring that the history of art proves that only temperaments
dominate the ages, and that the paintings we treasure are those which
have been lived and felt. I have committed such horrible sacrilege as to
speak with scant respect of the petty reputations of the day and to
predict their approaching demise, their passage into eternal nothingness.
I have behaved as a heretic in demolishing the paltry religions of coteries
and firmly setting forth the great religion of art, that which says to every
painter: 'Open your eyes, behold nature. Open your heart, behold life.' I
have also displayed crass ignorance because I have not shared the
opinions of the patented critics, and have neglected to speak of the
foreshortening of a torso, the modelling of a belly, draughtsmanship and
colour, schools and precepts. I have behaved, too, like a ruffian in
marching straight towards my goal without thinking of the poor devils
whom I might crush on the way. I sought Truth and I acted so badly as
to hurt people while trying to reach it. In a word, I have shown cruelty,
foolishness, and ignorance, I have been guilty of sacrilege and heresy,
because, weary of falsehood and mediocrity, I looked for men in a crowd
of eunuchs. And that is why I am condemned."

Such writing as this was bound to ruffle many dovecotes. There had
previously been various efforts on behalf of the new school of painting, the
complaints of injustice having led one year to the granting of a Salon des
Réfusés, but never had any writer hit out so vigorously, with such disregard
for the pretentious vanity of the artistic demigods of the hour. If, however,
Zola was banished from "L'Événement" as an art critic, he was not silenced,
for he republished his articles in pamphlet form,[10] with a dedicatory preface
addressed to Paul Cézanne, in which he said: "I have faith in the views I
profess; I know that in a few years everybody will hold me to be right. So I
have no fear that they may be cast in my face hereafter." In this again he was
fairly accurate: at least several of the views then held to be not merely
revolutionary but ridiculous have become commonplaces of criticism.
Though this campaign did not improve Zola's material position, it brought him
into notoriety among the public, and gave him quite a position among the
young men of the French art-world. At this time he still had his home in the
Rue de Vaugirard, overlooking the Luxembourg gardens, but in the summer of
1866 he was able to spend several weeks at Bennecourt, a little village on the
right bank of the Seine, near Bonnières, and—as the crow flies—about half-
way between Paris and Rouen. Here he was joined at intervals by some of his
Provençal friends, Baille, Cézanne, Marius Roux, and Numa Coste;[11] and
they roamed and boated, rested on the pleasant river islets and formed the
grandest plans for the future, while Paris became all excitement about the war
which had broken out between Prussia and Austria. The crash of Kœnigsgratz
echoed but faintly in that pleasant valley of the Seine, among those young
men whose minds were intent on art and literature. But politically the year
was an important one for France, for, from that time, the Franco-German War
became inevitable. The Napoleonic prestige was departing. The recall of the
expeditionary force from Mexico had become imperative. In vain did the
unhappy Empress Charlotte hasten to Paris and beg and pray and weep;
Napoleon III, who had placed her husband Maximilian in his dangerous
position, would give him no further help, and she, poor woman, was soon to
lose her reason and sink into living death.
The year which had opened so brightly for Zola was to end badly for him also.
After shocking the readers of "L'Événement" as an art critic, he imagined he
might be more successful with them as a story writer. So he proposed a serial
to Villemessant, who after examining a synopsis of the suggested narrative,
accepted the offer. The story which Zola then wrote was called "Le Vœu d'une
Morte," but it met with no more success than the art criticisms, and after
issuing the first part, Villemessant stopped the publication. The second part
was never written; yet the abortion—for it was nothing else—was issued in
volume form,[12] and of recent years has even been translated into English,
[13] and reviewed approvingly by English critics! Zola himself always regarded
it as the very worst of his productions. "What a wretched thing, my friend!" he
remarked in a letter to M. George Charpentier twenty years after this story's
first appearance. "Nowadays young men of eighteen turn out work ten times
superior in craftsmanship to what we produced when we were five and
twenty."
This second failure to catch the public fancy injured Zola considerably in the
opinion of Villemessant, but the latter continued to take various articles from
him, such as a series of literary character-sketches, entitled "Marbres et
Plâtres," in which figured such men as Flaubert, Janin, Taine, Paradol, and
About. These articles were merely signed "Simplice,"—Zola's name having
become odious to the readers of "L'Événement,"—and portions were worked
by the author into later studies on French literary men.
About this time Villemessant found himself in serious difficulties with the
authorities, through having sailed too near to politics in a journal only
authorised for literature and news. "L'Événement" was suppressed, but its
editor turned "Le Figaro" into a daily organ, and Zola's services were
transferred to the latter journal. He contributed to it a number of Parisian and
other sketches, portions of which will be found under the title "Souvenirs," in
a second volume of "Contes à Ninon," published in 1874.
In the latter part of 1866 his pecuniary position was a declining one. As he
wrote to his friend, Antony Valabrègue, he found himself in a period of
transition. He had penned a pretty and pathetic nouvelle, "Les Quatre
Journées de Jean Gourdon," for "L'Illustration,"[14] but he was chiefly turning
his thoughts to dramatic art, going, he said, as often as possible to the
theatre—with the idea, undoubtedly, that, as he had failed to conquer Paris as
an art critic and a novelist, he might yet do so as a playwright. The young
man was certainly indomitable; after each repulse he came up, smiling, to try
the effect of another attack. Already in 1865, although his comedy, "La Laide,"
had been declined by the Odéon Theatre, he had started on a three-act
drama, called "La Madeleine," and this now being finished he sent it to
Montigny, the director of the Gymnase Theatre, who replied, however, that
the play was "impossible, mad, and would bring down the very chandeliers if
an attempt were made to perform it." Harmant of the Vaudeville also declined
"La Madeleine," but on the ground that the piece was "too colourless," from
which, as Alexis points out, one may surmise that he had not troubled to read
it.
After this experience Zola slipped his manuscript into a drawer and turned to
other matters. In December, 1866, he is found informing Valabrègue that he
has received a very flattering invitation to the Scientific Congress of France,
[15] and asking him, as he cannot attend personally, to read on his behalf a
paper he has written for it. This was a "definition of the novel," prepared, said
Zola, according to the methods of Taine,[16] and it embodied at least the
germs of the theories which he afterwards applied to his own work. When
writing to Valabrègue on the subject he was in a somewhat despondent
mood, for his position on "Le Figaro" had now become very precarious. He
wished to undertake some serious work, he said, but it was imperative that he
should raise money, and he was "very unskilful in such matters." Indeed, in
spite of every effort, he did not earn more than an average of three hundred
francs a month. Nevertheless, he still received his friends every Thursday,
when Pissarro, Baille, Solari, and others went "to complain with him about the
hardness of the times."[17] And he at least had a ray of comfort amid his
difficulties, for he was now in love, was loved in return, and hoped to marry at
the first favourable opportunity. The young person was tall, dark haired, very
charming, very intelligent, with a gift, too, of that prudent thrift which makes
so many Frenchwomen the most desirable of companions for the men who
have to fight for position and fame. Her name was Alexandrine Gabrielle
Mesley; before very long she became Madame Zola.
In 1867 Zola put forth a large quantity of work. Early in the year he quitted
"Le Figaro," and bade good-bye to the Quartier Latin, removing to Batignolles,
quite at the other end of Paris; his new address being 1, Rue Moncey, at the
corner of the Avenue de Clichy. He was now near his artistic friends of
Montmartre, and complained to Valabrègue of having only painters around
him, without a single literary chum to join him in his battle. His association
with artists led, however, to the production of a fresh study on Manet,[18] and
to another abortive effort to write a "Salon," this time in a newspaper called
"La Situation," which the blind, despoiled King of Hanover had started in Paris
for the purpose of inciting the French against the Prussians. This journal was
edited by Édouard Grénier, a publiciste and minor poet of the time, who was
well disposed towards Zola, but the latter's articles again called forth so many
protests, that Grénier, fearing the newspaper would be wrecked when it was
barely launched, cast his contributor overboard.
Zola fortunately had other work in hand, having arranged with the director of
a Marseillese newspaper, "Le Messager de Provence," to supply him with a
serial story, based (so Zola wrote to Valabrègue), on certain criminal trials,
respecting which he had received such an infinity of documents that he hardly
knew how to reduce so much chaos to order and invest it with life. He hoped,
however, that the story, which he called "Les Mystères de Marseille," might
give him a reputation in the south of France, even if from a pecuniary
standpoint it provided little beyond bread and cheese, the remuneration being
fixed at no more than two sous a line. That, perhaps, was full value for such
matter, at all events the London Sunday papers and halfpenny evening
journals often pay no more, if indeed as much, for the serials they issue
nowadays, the majority of which are no whit better than was Zola's tale. It
was not literature certainly, but it was clearly and concisely written, and
generally good as narrative, in spite of some sentimental mawkishness and
sensational absurdity. As often happens with hack work of this description the
tale opens better than it ends. Long, indeed, before it was finished, the writer
had grown heartily tired of it, as many of its readers must have perceived. At
the same time it was not a work to be ashamed of, particularly in the case of
an author fighting for his daily bread, and Zola, when at the height of his
reputation, showed that he was not ashamed of it, for on his adversaries
casting this forgotten "pot boiler" in his face, he caused it to be reprinted,
with a vigorous preface, in which he recounted under what circumstances the
story had been written.[19]
The money paid for it had been very acceptable to him, for it had meant an
income of two hundred francs a month for nine months in succession; and it
had enabled him to give time to some real literary work, the writing of his first
notable novel, "Thérèse Raquin." This he had begun in 1866; the idea of it
then being suggested to him by Adolphe Belot and Ernest Daudet's "Vénus de
Gordes," in which a husband is killed by the wife's lover, who, with his
mistress, is sent to the Assizes. Zola, for his part, pictured a similar crime in
which the paramours escaped detection, but suffered all the torment of
remorse, and ended by punishing each other. An article, a kind of nouvelle
which he contributed to "Le Figaro" on the subject, led him to develop this
theme in the form of a novel. In parts, "Thérèse Raquin," as the author
afterwards remarked, was neither more nor less than a study of the animality
existing in human nature. It was, therefore, bound to be repulsive to many
folk. But if one accept the subject, the book will be found to possess
considerable literary merit, a quality which cannot be claimed for Émile
Gaboriau's "Crime d'Orcival," with which it has been compared by Mr. Andrew
Lang. Gaboriau was a clever man in his way, but he wrote in commonplace
language for the folk of little education who patronised the feuilletons of "Le
Petit Journal." No French critic, except, perhaps, the ineffable M. de
Brunetière, who has declared the illiterate Ponson du Terrail to be infinitely
superior to the Goncourts, would think of associating Gaboriau's name with
that of Émile Zola.
Under the title of "Un Mariage d'Amour," "Thérèse Raquin" was published
during the summer and autumn of 1867, in Arsène Houssaye's review,
"L'Artiste," which paid Zola the sum of six hundred francs[20] for the serial
rights. There was some delay and difficulty in the matter. Houssaye, who was
bien en cour, as the French say, and desirous of doing nothing that might
interfere with his admission to the Tuileries, informed Zola that the Empress
Eugénie read the review, and on that ground obtained his assent to the
omission of certain strongly worded passages from the serial issue. But the
author rebelled indignantly when he found that Houssaye, not content with
this expurgation, had written a fine moral tag at the end of the last sheet of
proofs. Zola would have none of it, and he was right; yet for years the great
quarrel between him and his critics arose less from the outspokenness with
which he treated certain subjects than from his refusal to interlard his
references to evil with pious ejaculations and moral precepts. But for all
intelligent folk the statement of fact should carry its own moral, and books are
usually written for intelligent folk, not for idiots. In the case in point the
spectacle of Arsène Houssaye, a curled, dyed, perfumed ex-lady killer,
tendering moral reflections to the author of "Thérèse Raquin," was extremely
amusing. Here was a man who for years had pandered to vice, adorned,
beautified, and worshipped it, not only in a score of novels, but also in
numerous semi-historical sketches. For him it was all "roses and rapture,"
whereas under Zola's pen it appeared absolutely vile. In the end Houssaye
had to give way, and the moral tag was deleted.
Zola took his story to M. Albert Lacroix, who in the autumn of 1867 published
it as a volume. Naturally it was attacked; and notably by Louis Ulbach, a
writer with whom Zola frequently came in contact, for Ulbach did a large
amount of work for Lacroix, and was often to be met at the afternoon
gatherings at the Librairie Internationale. It was he who had initiated the
most popular book of that year: Lacroix's famous "Paris Guide by the principal
authors and artists of France"; but at the same time he did not neglect
journalism, and just then he was one of the principal contributors to "Le
Figaro," for which he wrote under the pseudonym of "Ferragus." In an article
printed by that journal he frankly denounced "Thérèse Raquin" as "putrid
literature," and Zola, with Villemessant's sanction, issued a slashing reply. This
certainly attracted attention to the book, with the result that a second edition
was called for at the end of the year, which had not been a remunerative one
for the book-selling world, for it was that of the great Exhibition when Paris,
receiving visits from almost every ruler and prince of Europe, gave nearly all
its attention to sight-seeing and festivity.[21]
Zola had sent a copy of his book to Ste.-Beuve, for whom, as for Taine, he
always professed considerable deference, though he reproached him
somewhat sharply for having failed to understand Balzac, Flaubert, and
others. Ste.-Beuve, having read "Thérèse Raquin," pronounced it to be a
"remarkable and conscientious" work, but objected to certain of its features.
Some years afterwards Zola had occasion to refer to this subject, and the
remarks he then penned[22] may be quoted with the more advantage as they
embody his own criticism of his book:——

"I had sent 'Thérèse Raquin' to Ste.-Beuve, and he replied to me with a


critical letter, in which I find that desire for average truth, of which I have
just spoken. Nothing could be fairer than that criticism. For instance, he
remarked of my description of the Passage du Pont Neuf [the chief scene
of the novel]: 'It is not accurate, it is a fantastic description, like Balzac's
of the Rue Soli. The passage is bald, commonplace, ugly, and, in
particular, narrow, but it has not the dense blackness, the shades à la
Rembrandt which you impute to it. This also is a way of being unfaithful
[to the truth].' He was right; only it must be admitted that places merely
have such mournfulness or gaiety of aspect as we may attribute to them.
One passes with a shudder before the house where a murder has just
been committed, and which seemed quite commonplace only the
previous day. None the less, Ste.-Beuve's criticism holds good. It is
certain that things are carried to the point of nightmare in 'Thérèse
Raquin,' and that the strict truth falls short of so many horrors. In making
this admission I wish to show that I perfectly understand and even accept
Ste.-Beuve's standpoint of average truth. He is also right when he
expresses his astonishment that Thérèse and Laurent [the wife and lover]
do not content their passion immediately after the murder of Camille [the
husband]; the case is open to argument, but in the ordinary course of
things they would live in each other's arms before being maddened by
remorse. It will be seen then that, in spite of my own books, I share this
respect for logic and truth, and do not try to defend myself against
criticism which seems quite just. Yes, certainly, it is a bad thing to forsake
the substantial ground of reality to plunge into exaggerations of
draughtsmanship and colouring."

About the time of the publication of "Thérèse Raquin" Zola at last obtained
the coveted honours of the footlights. In conjunction with his friend Marius
Roux he wrote a drama based on his "Mystères de Marseille," and the director
of the Marseillese Gymnase consented to stage it. It is possible that this
arrangement was effected during a visit which the director made to Paris, for,
according to some accounts, a trial performance of the play took place in the
capital.[23] Zola and Roux, being anxious to witness its production at
Marseilles, afterwards repaired thither, and superintended the last rehearsals;
but their hopes were scarcely fulfilled, for although, as Alexis points out rather
naïvely, the first performance[24] "proceeded fairly well, enlivened by only a
little hissing," no more than two others were ever given. And while it is true
that a "run" could hardly be expected in a provincial city, particularly in those
days, three solitary performances, followed by no revival, could not be
interpreted as signifying success.
Perhaps it was the failure of this effort that caused Zola to abandon for some
years all hope of making his way as a dramatic author. Judging by the
comparative success of "Thérèse Raquin," novel writing seemed the safer
course for him. Accordingly, he transformed his rejected play, "La Madeleine,"
into a novel, which he entitled "La Honte," and offered as a serial to a certain
M. Bauer, who had established a new "Evénement." Bauer accepted it, but its
minute descriptions of the working of sensual passion in a woman shocked his
readers, and the publication ceased abruptly. On the whole, this story, written
in a large degree on the same lines as "Thérèse Raquin," was not a good
piece of work. When Lacroix published it, however, in volume form, under the
title of "Madeleine Férat," it soon went into a second edition.[25]
This was the chief literary work accomplished by Zola in 1868, when he also
published a variety of articles in different Paris newspapers. And as his books
were now selling fairly well, he began to think of giving some fulfilment to an
old and once vague project, to which the example of Balzac's works had at
last imparted shape. Writing in May, 1867, to his friend Valabrègue, he had
then said: "By the way, have you read all Balzac? What a man he was! I am
reperusing him at this moment. To my mind, Victor Hugo and the others
dwindle away beside him, I am thinking of a book on Balzac, a great study, a
kind of real romance."
That book was never written, but the perusal of "La Comédie Humaine" and
its haunting influence at least largely inspired "Les Rougon-Macquart."

[1] This was in the early sixties. Marx, who "interviewed" the boyish Prince
Imperial, Baron James de Rothschild, M. de Lesseps, and many others,
collected his articles in a volume entitled, "Indiscrétions Parisiennes."
[2] Alexis, l. c., p. 67.
[3] The first volume had appeared in 1863.
[4] Napoleon III. and his wife attended the first performance at the Odéon
(March, 1866), and when Got, one of the performers, had occasion to
exclaim, "England, the land of liberty!" nearly the entire audience,
composed of the intellectual leaders of Paris, rose and applauded
tumultuously, in spite of the Emperor's presence. He was deeply impressed
by this demonstration.
[5] Zola's "Les Romanciers Naturalistes," Paris, Charpentier, 1881 et seq.
[6] The present writer can speak of these matters from personal
knowledge; he well knew M. Bourdilliat, the founder of the Librairie
Nouvelle, and afterwards connected for many years with "Le Monde
Illustré," which Frank Vizetelly helped to establish, and of which he was
the first editor. As for the Librairie Internationale, it became the
commercial agency of the "Illustrated London News," which Henry Vizetelly
(the writer's father) represented in Paris for several years.
[7] "Le Maudit" was followed by "La Réligieuse," "Le Jésuite," "Le Moine,"
etc., all of these books having very large sales in Paris.
[8] See ante. p. 66.
[9] The above passage corrects and supplements the particulars given by
the writer in the preface to the English translation of "L'Œuvre," edited by
him. "His Masterpiece," by É. Zola, London, Chatto and Windus, 1902.
[10] "Mon Salon," Paris, Librairie Centrale, 1866, 12mo, 99 pages. The
articles are also given in the volume entitled "Mes Haines" (Charpentier
and Fasquelle).
[11] M. Coste, who is well known as a publiciste in France, should have
been mentioned earlier in this work. Though not so intimate with Zola as
Baille and Cézanne, he knew him in his school days. He largely helped Paul
Alexis in the preparation of the latter's biographical work on Zola.
[12] "Le Vœu d'une Morte," Paris, Faure, 1866, 18mo. Reissued by
Charpentier, 1889 and 1891.
[13] "A Dead Woman's Wish," translated by Count C. S. de Soissons,
London, 1902.
[14] "L'Illustration," December 15, 1866, to February 16, 1867. The story is
included in the "Nouveaux Contes à Ninon," 1874.
[15] It must have been held, we think, at Marseilles or Aix.
[16] The substance of the paper was worked into the articles which Zola
collected in the volume entitled "Le Roman Expérimental," Paris, 1880 et
seq.
[17] "La Grande Revue," May, 1903, p. 254.
[18] First issued in the "Revue du XIXe Siècle"; afterwards in pamphlet
form by Dentu, with a portrait of Manet by Bracquemond, and an etching
of Manet's "Olympia" by the painter himself. The text was reprinted in the
volume, "Mes Haines."
[19] Besides appearing serially in "Le Messager de Provence," "Les
Mystères de Marseille" was issued in parts (16mo) by Mengelle of
Marseilles, 1867-1868; and in volume form (with preface) by Charpentier,
Paris, 1884. Both "La Lanterne" and "Le Corsaire," of Paris, published the
story serially after the Franco-German War. In the latter journal it was
called "Un Duel Social," by "Agrippa," under which title it was again issued
in parts (12mo) for popular consumption. There is an English translation:
"The Mysteries of Marseilles," translated by Edward Vizetelly. London,
Hutchinson & Co., 1895 et seq.
[20] £24 or about $120. Houssaye had previously paid Zola a third of that
amount for his study on Manet (see ante, p. 101), and the money had
reached the young author just in time to enable him to save his furniture
from being seized and sold by a creditor.
[21] "Thérèse Raquin," Paris, Librairie Internationale: 1st edition, 1867; 2d,
1868; 3d, 1872; 4th and 5th, 1876; 6th, 7th, etc., Charpentier, 1880, 1882,
etc. Illustrated editions: Marpon, 8vo, 1883; Charpentier, 32mo, 1884.
Popular edition at 60 centimes: Marpon, 16mo, 1887. English translations:
(1) anonymous, Vizetelly & Co., cir. 1886-1889; (2) by Edward Vizetelly,
London, Grant Richards, 1902.
[22] "Le Voltaire," August 10-14, 1880. See also "Documents Littéraires,"
by É. Zola, Paris, Charpentier (and Fasquelle), 1881 et seq.

You might also like