Queries and formats content from a Postgresql database and posts it on Twitter and on a Wordpress blog. If the code throws any exception, the maintainer is notified per email.
This repository is part of the data/art project named after Men, which posts daily on Twitter and on the website namedaftermen.com a plant that was named after a male botanist. The goal of this project is to reflect on the power structures that regulate the act of naming.
Copy the .env.template
file and rename it to .env
add your secrets here. These values will then be loaded as environment variables and used to create a config object in the config package.
https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment https://docs.python.org/3/tutorial/venv.html
conda activate base
python -m venv venv
venv\Scripts\activate
// or on linux
source venv/bin/activate
deactivate
// Check version, installed packages, and current environment
py --version
py -m pip list
where python
// If virtualenv package not installed
py -m pip install virtualenv
// Update requirements.txt
pip3 freeze > requirements.txt
This project is linted using both Black and Pycodestyle. Both can be installed locally and ran with the following commands.
black .
pycodestyle .
Use autopep8 to automatically lint the code.
autopep8 --in-place --aggressive --aggressive .\script_name.py
Configuration for pycodestyle can be found in the ./setup.cfg
file. The linters will also run as github actions when code is pushed to Github.
git stash
git checkout main
git stash pop
git merge main
Running unittest
python -m unittest test_script_name
The FileSystemLoader
template path parameter starts on the root folder on Heroku src/templates
, while it starts from the src folder when running locally, that is templates
.
Data used in this project is available in the folder src/data
. There are four csv files:
botanists.csv
: dataset of botanists and the plants they probably name.distribution.csv
: dataset mapping plants to the regions they are native to.homages.csv
: dataset connecting plants to the men names they inherit.plants.csv
: dataset of all 1026 plants in our sample.
This project is under the Attribution-NonCommercial-ShareAlike creative commons license.