Getting Started¶
Install¶
$ pip install malaffinity
Alternatively, download this repo and run:
$ python setup.py install
To use the development version (please don’t), run:
$ pip install --upgrade https://github.com/erkghlerngm44/malaffinity/archive/master.zip
Dependencies¶
BeautifulSoup4
lxml
Requests
These should be installed when you install this package, so no need to worry about them.
lxml
is a bit wonky sometimes. If install fails:
$ pip install --upgrade pip
$ pip install --upgrade lxml
If all else fails and you’re on Windows, download the wheel yourself and:
$ pip install /path/to/wheel.whl
Development¶
This section demonstrates how documentation can be built, tests run, and how to check if you’re adhering to PEP 8 and PEP 257. These should not be used unless you’re contributing to the package.
Conventions¶
The flake8
and pydocstyle
packages can be used to check that
PEP 8 and PEP 257 are being followed respectively.
These can be installed as follows:
$ pip install .[conventions]
The following commands can then be run:
$ flake8
$ pydocstyle malaffinity
which will print any warnings/errors/other stuff. These should ideally
be fixed, but in the event that they can’t, place a # noqa: ERROR_CODE
comment on the offending line(s).
Documentation¶
To install the dependencies needed to build the docs, run:
$ pip install .[docs]
The docs can then be built by navigating to the docs
directory, and running:
$ make html
The built docs will now be in ./_build/html
. You can either run them
by clicking and viewing them, or by running a server in that directory,
which you can view in your browser.
Note
Any warnings that show up when building will be interpreted as errors when the tests get run on Travis, which will cause the build to fail. You’ll want to make sure these are taken care of.
Test Suite¶
To install the dependencies needed for the test suite, run:
$ pip install .[tests]
It is advised to run the test suite through coverage
, so a
coverage report can be generated as well. To do this, run:
$ coverage run --source malaffinity setup.py test
The tests should then run. You can view the coverage report by running:
$ coverage report