Below are instructions for getting Haystack running on your machine. Let's find those needles!
You will need Git and Python 3 to pull from this repository and run Haystack.
First, fork this repo and copy the clone URL.
- For example,
https://github.com/YOUR_USERNAME/haystack-link-checker.git
Next, go to the folder or workspace that you want to clone the repository into:
cd C:\myprojects
Where myprojects is where you want to place the repository. Next, issue the following commands:
# Clone this repository
git clone https://github.com/YOUR_USERNAME/haystack-link-checker.git
# Go into the repository
cd haystack-link-checker
Be sure to upgrade to the latest version of Python because pip is already installed if you are using Python 2 >=2.7.9 or Python 3 >=3.4.
# While still inside your C:\myprojects\haystack-link-checker folder
# Install dependencies using pip
pip install termcolor
pip install requests
pip install black
pip install pylint
pip install coverage
Before committing any changes, be sure to format the main haystack.py
file via Python Black and run PyLint like so:
black haystack.py
pylint haystack.py
Be sure to fix any warnings before committing! To see how Black formats the code, see the styling documentation.
Haystack uses the unittest unit testing framework.
To run the tests, run python test.py
(unit tests should be run before committing any changes).
To run code coverage, run coverage run -m unittest discover
and then run coverage report
to report on the results.
To automatically use Black with your VS Code, follow the instructions below:
- Go to the settins by pressing
Ctrl+
or by pressing the gear icon in the bottom right of your VS Code. - Type "format on save" at the top search bar and check the box.
- Search for "python formatting provider" and select "black" in the drop down menu (NOTE: you must have Black installed already). To automatically use PyLint with your VS Code, follow the second set of instructions below:
- Open VS Code's command pallete by pressing
Ctrl+Shift+P
. - Type "Python: Select Linter" and choose PyLint (NOTE: you must have PyLint installed already).