Skip to content

This repository is part of the data/art project "named after Men", which posts daily on Twitter and on the website www.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.

Notifications You must be signed in to change notification settings

TaiLinhares/named-after-men

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

named after Men - Daily post bot

Description

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.

Context

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.

Setup

Handling secrets and environment variables

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.

Set virtual environment

https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment https://docs.python.org/3/tutorial/venv.html

On VS Code using Conda as interpreter

conda activate base

Create virtual environment on the project root folder

python -m venv venv

Activate virtual environment

venv\Scripts\activate
// or on linux
source venv/bin/activate

Deactivate virtual environment

deactivate

Useful Python commands

// 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

Pythonic Linting

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.

Transfering changes in code from branch to main on github

git stash
git checkout main
git stash pop

Merging updated code from main into a branch

git merge main

Running unittest

python -m unittest test_script_name

Running locally vs. running on Heroku

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 Analysis

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.

Creative Commons License

This project is under the Attribution-NonCommercial-ShareAlike creative commons license.

About

This repository is part of the data/art project "named after Men", which posts daily on Twitter and on the website www.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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published