Notes and resolution of work issues during the ‘Fuzzy Bunny’ sprint.
Extend Project Scope with Lint Checking | WC-152
After researching many alternatives, including:
- Pylint
- Individual’s can customize errors and conventions.
- PyChecker
- hasn’t been updated in years. Issue?
- Pep8
- Guido’s original style guide.
- Flake8
- Integrate both
pep8
andpyflakes
.
Since it wraps pep8 as well as pyflakes error checking library, I’m sure that Flake8 library should be sufficient for us. Install it in a virtual environment with:
pyenv virtualenv demo
pyenv activate demo
pip install --upgrade flake8
When I run the flake8
executable on our current Reporter
project, I get the following warnings:
flake8 --exit-zero reporter.py
reporter.py:18:1: E302 expected 2 blank lines, found 1 reporter.py:49:80: E501 line too long (80 > 79 characters) reporter.py:53:80: E501 line too long (85 > 79 characters) reporter.py:57:80: E501 line too long (86 > 79 characters) reporter.py:61:80: E501 line too long (85 > 79 characters) reporter.py:83:19: E711 comparison to None should be 'if cond is not None:' reporter.py:87:80: E501 line too long (88 > 79 characters)
Create a Setup File for Better Installation | WC-134
To package the Reporter module as a package, we need to create a
setup.py
that imports the setup
function:
from setuptools import setup
setup(name='Reporter',
version='1.0',
description='Helper instance for dealing with Nagios',
author='Howard Abrams',
author_email='[email protected]',
py_modules=['reporter'])
With the source code for the Reporter
project, we build the
archive distribution archive:
python setup.py sdist
Odd that the name of the archive isn’t actually displayed in
the output of the sdist
command. The archive is the file in
dist
directory that matches the version we specified in the
setup.py
file.
ls dist
The archive contains the following files:
tar -tzf dist/$ZIP
The contents of the generated, PKG-INFO
, show that we are
missing some fields in our setup.py
that we will want to describe:
tar -xOzf dist/$ZIP $CFG
Set up a Chef Server for Deployment | WC-181
Deploy the Project Application | WC-182
Need to make sure that the correct version of Python is installed on the server, but I suspected that we had already installed it.
All of the following commands are executed on our deployment
server, minecraft.howardabrams.com
. Do we need to fix it so that
it knows about its FQDN? I only get the hostname
when I run:
hostname --long
Here is the list of currently installed, python-related packages on the server:
sudo dpkg --get-selections | grep -v deinstall | egrep -i '^python\b'
(mapcar 'car data)
Called dpkg
to get the list of currently installed,
python-related packages on the server:
dpkg --get-selections