DevOps in Python: Infrastructure as Python 2nd Edition Moshe Zadka instant download
DevOps in Python: Infrastructure as Python 2nd Edition Moshe Zadka instant download
https://ebookmeta.com/product/devops-in-python-infrastructure-as-
python-2nd-edition-moshe-zadka-2/
https://ebookmeta.com/product/devops-in-python-infrastructure-as-
python-2nd-edition-moshe-zadka-2/
https://ebookmeta.com/product/patterns-and-practices-for-
infrastructure-as-code-with-examples-in-python-and-terraform-
meap-v08-rosemary-wang/
https://ebookmeta.com/product/mastering-python-networking-your-
one-stop-solution-to-using-python-for-network-automation-
programmability-and-devops-3rd-edition-eric-chou/
https://ebookmeta.com/product/patches-the-cat-lisa-mullarkey/
You Shall Not Kill The Prohibition of Killing in
Ancient Religions and Cultures Journal of Ancient
Judaism Supplements 27 J. Cornelis De Vos (Editor)
https://ebookmeta.com/product/you-shall-not-kill-the-prohibition-
of-killing-in-ancient-religions-and-cultures-journal-of-ancient-
judaism-supplements-27-j-cornelis-de-vos-editor/
https://ebookmeta.com/product/hodder-gcse-9-1-history-for-
pearson-edexcel-foundation-edition-medicine-through-
time-c-1250-present-slater/
https://ebookmeta.com/product/saved-by-the-mountain-man-steamy-
bbw-instalove-romance-mountain-men-love-curves-1st-edition-
kelsie-calloway/
https://ebookmeta.com/product/when-good-government-meant-big-
government-the-quest-to-expand-federal-power-1913-1933-jesse-
tarbert/
https://ebookmeta.com/product/injunctions-in-patent-law-trans-
atlantic-dialogues-on-flexibility-and-tailoring-1st-edition-
jorge-l-contreras/
Data-Driven SEO with Python: Solve SEO Challenges with
Data Science Using Python 1st Edition Andreas Voniatis
https://ebookmeta.com/product/data-driven-seo-with-python-solve-
seo-challenges-with-data-science-using-python-1st-edition-
andreas-voniatis/
Moshe Zadka
DevOps in Python
Infrastructure as Python
2nd ed.
Moshe Zadka
Belmont, CA, USA
Apress Standard
The publisher, the authors and the editors are safe to assume that the
advice and information in this book are believed to be true and accurate
at the date of publication. Neither the publisher nor the authors or the
editors give a warranty, expressed or implied, with respect to the
material contained herein or for any errors or omissions that may have
been made. The publisher remains neutral with regard to jurisdictional
claims in published maps and institutional affiliations.
Before you can use Python, you need to install it. Some operating
systems, such as macOS and some Linux variants, have Python
preinstalled. Those versions of Python, colloquially called system
Python, often make poor defaults for people who want to develop in
Python.
The version of Python installed is often behind the latest practices.
System integrators often patch Python in ways that can lead to
surprises. For example, Debian-based Python is often missing modules
like venv and ensurepip. macOS Python links against a Mac shim
around its native SSL library. Those things mean, especially when
starting and consuming FAQs and web resources, it is better to install
Python from scratch.
This chapter covers a few ways to do so and the pros and cons of
each.
1.1 OS Packages
Volunteers have built ready-to-install packages for some of the more
popular operating systems.
The most famous is the deadsnakes PPA (Personal Package
Archives). The dead in the name refers to the fact that those packages
are already built—with the metaphor that sources are “alive.” Those
packages are built for Ubuntu and usually support all the versions of
Ubuntu that are still supported upstream. Getting those packages is
done with a simple
$ PROJECT=https://github.com/pyenv/pyenv-installer
\
PATH=raw/master/bin/pyenv-installer \
curl -L $PROJECT/PATH | bash
Of course, this comes with its own security issues and could be
replaced with a two-step process where you can inspect the shell script
before running or even use git-checkout to pin to a specific revision.
export PATH="~/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
This allows pyenv to properly intercept all the necessary
commands.
pyenv separates the notion of installed interpreters from available
interpreters. Enter the following to install a version.
or locally by using
env PYTHON_CONFIGURE_OPTS="--enable-shared
--enable-optimizations
--with-computed-gotos
--with-lto
--enable-ipv6" pyenv
install
Let’s build a version that is pretty similar to binary versions from
python.org.
1.3 Building Python from Source
The main challenge in building Python from source is that, in some
sense, it is too forgiving. It is all too easy to build it with one of the built-
in modules disabled because its dependency was not detected. This is
why it is important to know which dependencies are fragile and how to
make sure a local installation is good.
The first fragile dependency is SSL. It is disabled by default and
must be enabled in Modules/Setup.dist. Carefully follow the
instructions there about the location of the OpenSSL library. If you have
installed OpenSSL via system packages, it is usually in /usr/. If you
have installed it from source, it is usually in /usr/local.
The most important thing is to know how to test for it. When
Python is done building, run ./python.exe -c 'import _ssl'.
That .exe is not a mistake; this is how the build process calls the newly
built executable, which is renamed to Python during installation. If this
succeeds, the SSL module was built correctly.
Another extension that can fail to build is SQLite. Since it is a built-
in, many third-party packages depend on it, even if you are not using it
yourself. This means a Python installation without the SQLite module is
pretty broken. Test it by running ./python.exe -c 'import
sqlite3'.
In a Debian-based system (such as Ubuntu), libsqlite3-dev is
required for this to succeed. In a Red Hat-based system (such as Fedora
or CentOS), libsqlite3-dev is required for this to succeed.
Next, check for _ctypes with ./python.exe -c 'import
_ctypes'. If this fails, likely, the libffi headers are not installed.
Finally, remember to run the built-in regression test suite after
building from source. This ensures that there have been no silly
mistakes while building the package.
1.4 PyPy
The usual implementation of Python is sometimes known as CPython to
distinguish it from the language proper. The most popular alternative
implementation is PyPy, a Python-based JIT implementation of Python
in Python. Because it has a dynamic JIT (just-in-time) compilation to
assembly, it can sometimes achieve phenomenal speed-ups (three times
or even ten times) over regular Python.
There are sometimes challenges in using PyPy. Many tools and
packages are tested only with CPython. However, sometimes spending
the effort to check if PyPy is compatible with the environment is worth
it if performance matters.
There are a few subtleties in installing Python from source. While it
is theoretically possible to translate using CPython, in practice, the
optimizations in PyPy mean that translating using PyPy works on more
reasonable machines. Even when installing from source, it is better to
first install a binary version to bootstrap.
The bootstrapping version should be PyPy, not PyPy3. PyPy is
written in the Python 2 dialect, which is one of the only cases where
worrying about the deprecation is irrelevant since PyPy is a Python 2
dialect interpreter. PyPy3 is the Python 3 dialect implementation,
which is usually better in production as most packages are slowly
dropping support for Python 2.
The latest PyPy3 supports 3.5 features of Python, as well as f-
strings. However, the latest async features, added in Python 3.6, do not
work.
1.5 Anaconda
The closest to a system Python that is still reasonable for use as a
development platform is Anaconda, a metadistribution. It is, in essence,
an operating system on top of the operating system. Anaconda has its
grounding in the scientific computing community, and so its Python
comes with easy-to-install modules for many scientific applications.
Many of these modules are non-trivial to install from PyPI, requiring a
complicated build environment.
It is possible to install multiple Anaconda environments on the
same machine. This is handy when needing different Python versions
or different versions of PyPI modules.
To bootstrap Anaconda, you can use the bash installer available at
https://conda.io/miniconda.html. The installer also modifies
~/.bash_profile to add the path to conda, the installer.
conda environments are created using conda create --name
<name> and activated using source conda activate <name>.
There is no easy way to use inactivated environments. It is possible to
create a conda environment while installing packages: conda create
--name some-name python. You can specify the version using = –
conda create --name some-name python=3.5. It is also
possible to install more packages into a conda environment, using
conda install package[=version], after the environment has
been activated. Anaconda has a lot of prebuilt Python packages,
especially ones that are non-trivial to build locally. This makes it a good
choice if those packages are important to your use case.
1.6 Summary
Running a Python program requires an interpreter installed on the
system. Depending on the operating system and the versions, there are
several different ways to install Python. Using the system Python is a
problematic option. On macOS and Unix systems, using pyenv is almost
always the preferred option. On Windows, using the prepackaged
installers from Python.org is often a good idea.
© The Author(s), under exclusive license to APress Media, LLC, part of Springer
Nature 2022
M. Zadka, DevOps in Python
https://doi.org/10.1007/978-1-4842-7996-0_2
2. Packaging
Moshe Zadka1
(1) Belmont, CA, USA
$ source /home/name/venvs/my-special-env/bin/activate
The last command tests that glom has been properly installed. Glom is
a package to handle deeply-nested data, and called with no arguments,
outputs an empty Python dictionary. This makes it handy for quickly
testing whether a new virtual environment can install new packages
properly.
Internally, pip is also treated as a third-party package. Upgrading pip
itself is done with pip install --upgrade pip.
Depending on how Python was installed, its real environment might or
might not be modifiable by the user. Many instructions in various README
files and blogs might encourage using sudo pip install. This is
almost always the wrong thing to do; it installs the packages in the global
environment.
The pip install command downloads and installs all dependencies.
However, it can fail to downgrade incompatible packages. It is always
possible to install explicit versions: pip install package-name==
<version> installs this precise version. This is also a good way for local
testing to get explicitly non-general-availability packages, such as release
candidates, beta, or similar.
If wheel is installed, pip builds, and usually caches, wheels for
packages. This is especially useful when dealing with a high virtual
environment churn since installing a cached wheel is a fast operation. This
is also highly useful when dealing with native or binary packages that need
to be compiled with a C compiler. A wheel cache eliminates the need to
build it again.
pip does allow uninstalling with pip uninstall <package>. This
command, by default, requires manual confirmation. Except for exotic
circumstances, this command is not used. If an unintended package has
snuck in, the usual response is to destroy the environment and rebuild it.
For similar reasons, pip install --upgrade <package> is not
often needed; the common response is to destroy and re-create the
environment. There is one situation where it is a good idea.
pip install supports a requirements file: pip install --
requirements or pip install -r. The requirements file simply has
one package per line. This is no different from specifying packages on the
command line. However, requirement files often specify strict
dependencies. A requirements file can be generated from an environment
with pip freeze.
Like most individual packages or wheels, installing anything that is not
strict and closed under requirements requires pip to decide which
dependencies to install. The general problem of dependency resolution
does not have an efficient and complete solution. Different strategies are
possible to approach such a solution.
The way pip resolves dependencies is by using backtracking. This
means that it optimistically tries to download the latest possible
requirements recursively. If a dependency conflict is found, it backtracks;
try a different option.
As an example, consider three packages.
top
middle
base
There are two base versions: 1.0 and 2.0. The package dependencies
are setup.cfg files.
The following is for the top.
[metadata]
name = top
version = 1.0
[options]
install_requires =
base
middle
[metadata]
name = middle
version = 1.0
[options]
install_requires =
base<2.0
The base package has two versions: 1.0 and 2.0. It does not have any
dependencies.
Because top depends directly on base, pre-backtracking versions of
pip get the latest and then have a failed resolution.
[build-system]
requires = [
"setuptools"
]
build-backend = "setuptools.build_meta"
Many systems can be used to build valid distributions. The
setuptools system, which used to be the only possibility, is now one of
several. However, it is still the most popular one.
Most of the rest of the data can be found in the project section.
[project]
name = "awesome_package"
version = "0.0.3"
description = "A pretty awesome package"
readme = "README.rst"
authors = [{name = "My Name",
email = "[email protected]"}]
dependencies = ["httpx"]
import tomlkit
import datetime
import os
import pathlib
import zoneinfo
now =
datetime.datetime.now(tz=zoneinfo.ZoneInfo("UTC"))
prefix=f"{now.year}.{now.month}."
pyproject = pathlib.Path("pyproject.toml")
data = tomlkit.loads(pyproject.read_text())
current = data["project"].get("version", "")
if current.startswith(prefix):
serial = int(current.split(".")[-1]) + 1
else:
serial = 0
version = prefix + str(serial)
data["project"]["version"] = version
pyproject.write_text(tomlkit.dumps(data))
Some utilities keep the version synchronized between several files; for
example, pyproject.toml and example_package/__init__.py.
The best way to use these utilities is by not needing to do it.
If example_package/__init__.py wants to expose the version
number, the best way is to calculate it using importlib.metadata.
# example_package/__init__.py
from importlib import metada
__version__ =
metadata.distribution("example_package").version
del metadata # Keep top-level namespace clean
[project.scripts]
example-command = "example_package.commands:main"
# example_package/commands.py
def main():
print("an example")
$ example-command
an example
#cython: language_level=3
[build-system]
requires = ["setuptools", "cython"]
This makes sure the cython package is installed before trying to build
a wheel.
The setup.py is no longer minimal. It contains enough code to
integrate with Cython.
import setuptools
from Cython import Build
setuptools.setup(
ext_modules=Build.cythonize("binary_module.pyx"),
)
The Cython.Build.cythonize function does two things.
Creates (or re-creates) binary_module.c from
binary_module.pyx.
Returns an Extension object.
Since *.pyx files are not included by default, it needs to be enabled
explicitly in the MANIFEST.in file.
include *.pyx
[metadata]
name = binary_example
version = 1.0
The buffalo, more properly called the bison, is the great object of
Indian hunting in the west. These animals abound in the prairies;
and they are often seen coursing over the plains in immense herds.
Thousands of them appear under the direction of one of their
number, who acts as leader. This propensity to follow a leader
affords a ready means to the Indians of destroying them. The
manner in which this is accomplished is graphically described in the
following extract from the account of a late writer. It affords a wild
picture of the scenes which present themselves to the notice of the
traveller as he passes through the great prairies of the west.
We passed a precipice of about one hundred and twenty feet high,
under which lay scattered the fragments of at least one hundred
carcases of buffaloes, although the water, which had washed away
the lower part of the hill, must have carried off many of the dead.
These buffaloes had been chased down the precipice, in a way very
common on the Missouri, and by which vast herds are destroyed in a
moment. The mode of hunting is, to select one of the most active
and fleet young men, who is disguised, by a buffalo skin around his
body, the skin of the head, with the ears and the horns, fastened on
his own head, in such a way as to deceive the buffalo. Thus dressed,
he fixes himself at a convenient distance, between a herd of
buffaloes and any of the river precipices, which sometimes extend
for some miles. His companions, in the meantime, get into the rear,
and on the side of the herd, and, at a given signal, show
themselves, and advance towards the buffalo: they instantly take the
alarm; and, finding the hunters beside them, they run towards the
disguised Indian or decoy, who leads them on at full speed toward
the river, when, suddenly securing himself in some crevice of the cliff
which he had previously fixed on, the herd is left on the brink of the
precipice. It is then in vain for the foremost to retreat, or even to
stop—they are pressed on by the hindmost rank, who, seeing no
danger, but from the hunters, goad on those before them, till the
whole are precipitated, and the shore is strewed with their dead
bodies. Sometimes, in this perilous seduction, the Indian is himself
either trodden under foot, by the rapid movements of the buffaloes
or missing his footing in the cliff, is urged down the precipice along
with the falling herd.
The Indians now select as much meat as they choose, and the rest
is abandoned to the wolves, and creates a most dreadful stench.
The wolves who had been feasting on these carcases were very fat,
and so gentle, that one of them was killed with an espontoon.
religion of the indians.
The earliest visiters of the New World, on seeing among the Indians
neither priests, temples, idols, nor sacrifices, represented them as a
people wholly destitute of religious opinions. Closer inquiry, however,
showed that a belief in the spiritual world, however imperfect, had a
commanding influence over almost all their actions. Their creed
includes even some lofty and pure conceptions. Under the title of the
Great Spirit, the Master of Life, the Maker of heaven and earth, they
distinctly recognise a supreme ruler of the universe and an arbiter of
their destiny. A party of them, when informed by the missionaries of
the existence of a being of infinite power, who had created the
heavens and the earth, with one consent exclaimed, “Atahocan!
Atahocan!” that being the name of their principal deity. According to
Long, the Indians among whom he resided ascribe every event,
propitious or unfortunate, to the favour or anger of the Master of
Life. They address him for their daily subsistence; they believe him
to convey to them presence of mind in battle; and amid tortures
they thank him for inspiring them with courage. Yet though this one
elevated and just conception is deeply graven on their minds, it is
combined with others which show all the imperfection of unassisted
reason in attempting to think rightly on this great subject. It may
even be observed, that the term, rendered into our language “great
spirit,” does not really convey the idea of an immaterial nature. It
imports with them merely some being possessed of lofty and
mysterious powers, and in this sense is applied to men, and even to
animals. The brute creation, which occupies a prominent place in all
their ideas, is often viewed by them as invested, to a great extent,
with supernatural powers; an extreme absurdity, which, however,
they share with the civilized creeds of Egypt and India.
When the missionaries, on their first arrival, attempted to form an
idea of the Indian mythology, it appeared to them extremely
complicated, more especially because those who attempted to
explain it had no fixed opinions. Each man differed from his
neighbour, and at another time from himself; and when the
discrepancies were pointed out, no attempt was made to reconcile
them. The southern tribes, who had a more settled faith, are
described by Adair as intoxicated with spiritual pride, and
denouncing even their European allies as “the accursed people.” The
native Canadian, on the contrary, is said to have been so little
tenacious, that he would at any time renounce all his theological
errors for a pipe of tobacco, though, as soon as it was smoked, he
immediately relapsed. An idea was found prevalent respecting a
certain mystical animal, called Mesou or Messessagen, who, when
the earth was buried in water, had drawn it up and restored it.
Others spoke of a contest between the hare, the fox, the beaver,
and the seal, for the empire of the world. Among the principal
nations of Canada, the hare is thought to have attained a decided
preeminence; and hence the Great Spirit and the Great Hare are
sometimes used as synonymous terms. What should have raised this
creature to such distinction seems rather unaccountable; unless it
were that its extreme swiftness might appear something
supernatural. Among the Ottowas alone the heavenly bodies become
an object of veneration; the sun appears to rank as their supreme
deity.
To dive into the abyss of futurity has always been a favourite object
of superstition. It has been attempted by various means; but the
Indian seeks it chiefly through his dreams, which always bear with
him a sacred character. Before engaging in any high undertaking,
especially in hunting or war, the dreams of the principal chiefs are
carefully watched and studiously examined; and according to the
interpretation their conduct is guided. A whole nation has been set
in motion by the sleeping fancies of a single man. Sometimes a
person imagines in his sleep that he has been presented with an
article of value by another, who then cannot, without impropriety,
leave the omen unfulfilled. When Sir William Johnson, during the
American war, was negotiating an alliance with a friendly tribe, the
chief confidentially disclosed that, during his slumbers, he had been
favoured with a vision of Sir William bestowing upon him the rich
laced coat which formed his full dress. The fulfilment of this
revelation was very inconvenient; yet, on being assured that it
positively occurred, the English commander found it advisable to
resign his uniform. Soon after, however, he unfolded to the Indian a
dream with which he had himself been favored, and in which the
former was seen presenting him with a large tract of fertile land
most commodiously situated. The native ruler admitted that, since
the vision had been vouchsafed, it must be realized, yet earnestly
proposed to cease this mutual dreaming, which he found had turned
much to his own disadvantage.
The manitou is an object of peculiar veneration; and the fixing upon
this guardian power is not only the most important event in the
history of a youth, but even constitutes his initiation into active life.
As a preliminary, his face is painted black, and he undergoes a
severe fast, which is, if possible, prolonged for eight days. This is
preparatory to the dream in which he is to behold the idol destined
ever after to afford him aid and protection. In this state of excited
expectation, and while every nocturnal vision is carefully watched,
there seldom fails to occur to his mind something which, as it makes
a deep impression, is pronounced his manitou. Most commonly it is a
trifling and even fantastic article; the head, beak, or claw of a bird,
the hoof of a cow, or even a piece of wood. However, having
undergone a thorough perspiration in one of their vapour-baths, he
is laid on his back, and a picture of it is drawn upon his breast by
needles of fish-bone dipped in vermilion. A good specimen of the
original being procured, it is carefully treasured up; and to it he
applies in every emergency, hoping that it will inspire his dreams,
and secure to him every kind of good fortune. When, however,
notwithstanding every means of propitiating its favour, misfortunes
befall him, the manitou is considered as having exposed itself to just
and serious reproach. He begins with remonstrances, representing
all that has been done for it, the disgrace it incurs by not protecting
its votary, and, finally, the danger that, in case of repeated neglect,
it may be discarded for another. Nor is this considered merely as an
empty threat; for if the manitou is judged incorrigible, it is thrown
away; and by means of a fresh course of fasting, dreaming,
sweating, and painting, another is installed, from whom better
success may be hoped.
The absence of temples, worship, sacrifices, and all the observances
to which superstition prompts the untutored mind, is a remarkable
circumstance, and, as we have already remarked, led the early
visiters to believe that the Indians were strangers to all religious
ideas. Yet the missionaries found room to suspect that some of their
great feasts, in which every thing presented must be eaten, bore an
idolatrous character, and were held in honour of the Great Hare. The
Ottawas, whose mythological system seems to have been the most
complicated, were wont to keep a regular festival to celebrate the
beneficence of the sun; on which occasion the luminary was told
that this service was in return for the good hunting he had procured
for his people, and as an encouragement to persevere in his friendly
cares. They were also observed to erect an idol in the middle of their
town, and sacrifice to it; but such ceremonies were by no means
general. On first witnessing Christian worship, the only idea
suggested by it was that of their asking some temporal good, which
was either granted or refused. The missionaries mention two
Hurons, who arrived from the woods soon after the congregation
had assembled. Standing without, they began to speculate what it
was the white men were asking, and then whether they were getting
it. As the service continued beyond expectation, it was concluded
they were not getting it; and as the devotional duties still proceeded,
they admired the perseverance with which this rejected suit was
urged. At length, when the vesper hymn began, one of the savages
observed to the other: “Listen to them now in despair, crying with all
their might.”
The grand doctrine of a life beyond the grave was, among all the
tribes of America, most deeply cherished and most sincerely
believed. They had even formed a distinct idea of the region whither
they hoped to be transported, and of the new and happier mode of
existence, free from those wars, tortures, and cruelties which throw
so dark a shade over their lot upon earth. Yet their conceptions on
this subject were by no means either exalted or spiritualized. They
expected simply a prolongation of their present life and enjoyments,
under more favourable circumstances, and with the same objects
furnished in greater choice and abundance. In that brighter land the
sun ever shines unclouded, the forests abound with deer, the lakes
and rivers with fish; benefits which are farther enhanced in their
imagination by a faithful wife and dutiful children. They do not reach
it, however, till after a journey of several months, and encountering
various obstacles; a broad river, a chain of lofty mountains, and the
attack of a furious dog. This favoured country lies far in the west, at
the remotest boundary of the earth, which is supposed to terminate
in a steep precipice, with the ocean rolling beneath. Sometimes, in
the too eager pursuit of game, the spirits fall over, and are converted
into fishes. The local position of their paradise appears connected
with certain obscure intimations received from their wandering
neighbours of the Mississippi, the Rocky Mountains, and the distant
shores of the Pacific. This system of belief labours under a great
defect, inasmuch as it scarcely connects felicity in the future world
with virtuous conduct in the present. The one is held to be simply a
continuation of the other; and under this impression, the arms,
ornaments, and everything that had contributed to the welfare of
the deceased, are interred along with him. This supposed assurance
of a future life, so conformable to their gross habits and conceptions,
was found by the missionaries a serious obstacle when they
attempted to allure them by the hope of a destiny, purer and higher
indeed, but less accordant with their untutored conceptions. Upon
being told that in the promised world they would neither hunt, eat,
drink, nor marry, many of them declared that, far from endeavouring
to reach such an abode, they would consider their arrival there as
the greatest calamity. Mention is made of a Huron girl whom one of
the Christian ministers was endeavouring to instruct, and whose first
question was what she would find to eat. The answer being
“Nothing,” she then asked what she would see; and being informed
that she would see the Maker of heaven and earth, she expressed
herself much at a loss how she should address him.
indian funerals.
There are games to which the Indians are fondly attached, which,
though they be only ranked under the head of amusement, are yet
constructed in the same serious manner as their other transactions.
Their great parties are said to be collected by supernatural authority,
communicated by the jugglers; and they are preceded, like their
wars and hunts, by a course of fasting, dreaming, and other means
of propitiating fortune. The favourite game is that of the bone, in
which small pieces of that substance, resembling dice, and painted
of different colours, are thrown in the air, and according to the
manner in which they fall, the game is decided. Only two persons
can play; but a numerous party, and sometimes whole villages,
embrace one side or the other, and look on with intense interest. At
each throw, especially if it be decisive, tremendous shouts are
raised; the players and spectators equally resemble persons
possessed; the air rings with invocations to the bones and to the
manitous. Their eagerness sometimes leads to quarreling and even
fighting, which on no other occasion ever disturb the interior of
these societies. To such a pitch are they occasionally worked up, that
they stake successively all they possess, and even their personal
liberty; but this description must apply only to the more southern
nations, as slavery was unknown among the Canadian Indians.
A temporary interval of wild license, of emancipation from all the
restraints of dignity and decorum, seems to afford an enjoyment
highly prized in all rude societies. Corresponding with the saturnalia
and bacchanals of antiquity, the Indians have their festivals of
dreams, which, during fifteen days, enlivens the inaction of the
coldest season. Laying aside all their usual order and gravity, they
run about, frightfully disguised, and committing every imaginable
extravagance. He who meets another demands an explanation of his
visions, and if not satisfied, imposes some fantastic penalty. He
throws upon him cold water, hot ashes, or filth; sometimes, rushing
into his cabin, he breaks and destroys the furniture. Although
everything appears wild and unpremeditated, it is alleged that
opportunities are often taken to give vent to old and secret
resentments. The period having elapsed, a feast is given, order is
restored, and the damages done are carefully repaired.
beautiful trait of character.
Some of the Indians believe, that the “Evil Spirit” is the maker of
spirituous liquors, from which, notwithstanding, hardly one of them
can refrain. An Indian near the Delaware Water Gap, told Mr.
Heckewelder, a missionary, that he had once, when under the
influence of strong liquor, killed the best Indian friend he had,
fancying him to be his worst avowed enemy. He said that the
deception was complete; and that while intoxicated, the face of his
friend presented to his eyes all the features of the man with whom
he was in a state of hostility. It is impossible to express the horror
which struck him, when he awoke from that delusion. He was so
shocked, that from that moment, he resolved never more to taste of
the maddening potion, of which he was convinced the devil was the
inventor; for that it could only be the “Evil Spirit” who made him see
his enemy when his friend was before him, and produced so strong
a delusion on his bewildered senses, that he actually killed him.
From that time until his death, which happened thirty years
afterwards, he never drank a drop of ardent spirits, which he always
called “the devil’s blood;” and was firmly persuaded that the devil, or
some of his infernal spirits, had a hand in preparing it.
fidelity.
Among the North American Indians, one of the first lessons they
inculcate on their children, is duty to their parents, and respect for
old age; and there is not among the most civilized nations, any
people who more strictly observe the duty of filial obedience. A
father need only to say, in the presence of his children, “I want such
a thing done”—“I want one of my children to go upon such an
errand”—“Let me see who is the good child that will do it.” The word
good operates as it were by magic, and the children immediately vie
with each other to comply with the parent’s wishes. If a father sees
an old decrepid man or woman pass by, led along by a child, he will
draw the attention of his own children to the object, by saying,
“What a good child that must be, which pays such attention to the
aged! That child, indeed, looks forward to the time when it will
likewise be old, and need its children’s help.” Or he will say, “May the
Great Spirit, who looks upon him, grant this good child a long life!”