Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint with pre-commit on GitHub Actions #186

Merged
merged 7 commits into from
Sep 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Lint

on: [push, pull_request]

env:
FORCE_COLOR: 1

jobs:
build:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2

- name: Cache
uses: actions/cache@v2
with:
path: |
~/.cache/pip
~/.cache/pre-commit
key:
lint-v1-${{ hashFiles('**/setup.py') }}-${{
hashFiles('**/.pre-commit-config.yaml') }}
restore-keys: |
lint-v1-

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U pre-commit

- name: Lint
run: pre-commit run --all-files --show-diff-on-failure
env:
PRE_COMMIT_COLOR: always
42 changes: 42 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.7.2
hooks:
- id: pyupgrade
args: ["--py36-plus"]

- repo: https://github.com/psf/black
rev: 20.8b1
hooks:
- id: black
args: ["--target-version", "py36"]

- repo: https://github.com/PyCQA/isort
rev: 5.5.3
hooks:
- id: isort

- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.3
hooks:
- id: flake8
additional_dependencies: [flake8-2020, flake8-implicit-str-concat]

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.6.0
hooks:
- id: python-check-blanket-noqa

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: check-merge-conflict
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/prettier/prettier
rev: 2.1.1
hooks:
- id: prettier
args: [--prose-wrap=always, --print-width=88]
11 changes: 4 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cache: pip
matrix:
fast_finish: true
include:
- python: 3.9-dev
- python: 3.8
- python: 3.7
- python: 3.6
Expand All @@ -18,16 +19,12 @@ branches:

install:
- pip install -r requirements.txt
- pip install black coveralls flake8
- pip install black coveralls

script:
- coverage run --append --source scripts test/test_gpo_member_photos.py
- coverage run --append --source scripts scripts/missing.py
- black --check --diff .
- flake8 scripts
- coverage run --append --source scripts test/test_gpo_member_photos.py
- coverage run --append --source scripts scripts/missing.py

after_success:
- coverage report
- coveralls
- pip install pycodestyle
- pycodestyle scripts/*.py
27 changes: 18 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
## Contributing other photos

If GPO doesn't have a photo for someone in their member guide, we may be willing to accept a photo from another source.
If GPO doesn't have a photo for someone in their member guide, we may be willing to
accept a photo from another source.

In this case, [open a ticket](https://github.com/unitedstates/images/issues/new), and include:
In this case, [open a ticket](https://github.com/unitedstates/images/issues/new), and
include:

* The name and Bioguide ID of the member of Congress.
* A link to the image you're suggesting we incorporate, and to a page that displays that image.
* Why you believe the image is definitely official and in the public domain.
- The name and Bioguide ID of the member of Congress.
- A link to the image you're suggesting we incorporate, and to a page that displays that
image.
- Why you believe the image is definitely official and in the public domain.

When submitting a PR for an image found outside of the GPO, use the URL for the **context** of the photo, not the image source URL, as the value for `link: ` in `metadata/*.yaml`.
When submitting a PR for an image found outside of the GPO, use the URL for the
**context** of the photo, not the image source URL, as the value for `link: ` in
`metadata/*.yaml`.

## Public domain

The project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the [CC0 1.0 Universal public domain dedication][CC0].
The project is in the public domain within the United States, and copyright and related
rights in the work worldwide are waived through the [CC0 1.0 Universal public domain
dedication][cc0].

All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest.
All contributions to this project will be released under the CC0 dedication. By
submitting a pull request, you are agreeing to comply with this waiver of copyright
interest.

[CC0]: http://creativecommons.org/publicdomain/zero/1.0/
[cc0]: http://creativecommons.org/publicdomain/zero/1.0/
5 changes: 3 additions & 2 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
* [ ] *I'm acknowledging that my submission is free of all known copyright in at least the United States.* (In general, works of the federal government should satisfy this criteria.)

- [ ] _I'm acknowledging that my submission is free of all known copyright in at least
the United States._ (In general, works of the federal government should satisfy
this criteria.)
59 changes: 40 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,37 @@ Public domain images of members of the US Congress.

## Using the photos

Photos are available at predictable URLs, by size and Bioguide ID. Photos are served using GitHub Pages.
Photos are available at predictable URLs, by size and Bioguide ID. Photos are served
using GitHub Pages.

```
https://theunitedstates.io/images/congress/[size]/[bioguide].jpg
```

`[size]` can be one of:

* `original` - As originally downloaded. Typically, `675x825`, but [it can vary](https://github.com/unitedstates/images/issues/1#issuecomment-35070231).
* `450x550`
* `225x275`
- `original` - As originally downloaded. Typically, `675x825`, but
[it can vary](https://github.com/unitedstates/images/issues/1#issuecomment-35070231).
- `450x550`
- `225x275`

`[bioguide]` must be a Bioguide ID. These are unique IDs for members of Congress, as defined by the [Congressional Bioguide](http://bioguide.congress.gov). They can be found and connected to many other Congressional datasets, including the partner dataset over at [unitedstates/congress-legislators](https://github.com/unitedstates/congress-legislators).
`[bioguide]` must be a Bioguide ID. These are unique IDs for members of Congress, as
defined by the [Congressional Bioguide](http://bioguide.congress.gov). They can be found
and connected to many other Congressional datasets, including the partner dataset over
at
[unitedstates/congress-legislators](https://github.com/unitedstates/congress-legislators).

**Note:** Our HTTPS permalinks are provided through CloudFlare's [Universal SSL](https://blog.cloudflare.com/introducing-universal-ssl/), which also uses "Flexible SSL" to talk to GitHub Pages' unencrypted endpoints. So, you should know that it's not an end-to-end encrypted channel, but is encrypted between your client use and CloudFlare's servers (which at least should dissociate your requests from client IP addresses).
**Note:** Our HTTPS permalinks are provided through CloudFlare's
[Universal SSL](https://blog.cloudflare.com/introducing-universal-ssl/), which also uses
"Flexible SSL" to talk to GitHub Pages' unencrypted endpoints. So, you should know that
it's not an end-to-end encrypted channel, but is encrypted between your client use and
CloudFlare's servers (which at least should dissociate your requests from client IP
addresses).

## Downloading all images of a particular size

If you want to quickly grab all images of a particular size without cloning the entire repo (and have `svn` installed), you can just do something like this:
If you want to quickly grab all images of a particular size without cloning the entire
repo (and have `svn` installed), you can just do something like this:

`svn checkout https://github.com/unitedstates/images/trunk/congress/225x275`

Expand All @@ -33,7 +45,9 @@ If you want to quickly grab all images of a particular size without cloning the
[![Build Status](https://travis-ci.org/unitedstates/images.svg?branch=gh-pages)](https://travis-ci.org/unitedstates/images)
[![Coverage Status](https://coveralls.io/repos/unitedstates/images/badge.svg?branch=gh-pages&service=github)](https://coveralls.io/github/unitedstates/images?branch=gh-pages)

This project uses a Python script that scrapes the [Government Printing Office's Member Guide](https://memberguide.gpo.gov/) for official photos of Members of Congress. You can run the script to find and fetch new photos.
This project uses a Python script that scrapes the
[Government Printing Office's Member Guide](https://memberguide.gpo.gov/) for official
photos of Members of Congress. You can run the script to find and fetch new photos.

Install dependencies with:

Expand All @@ -47,24 +61,31 @@ Run the script with:
./scripts/gpo_member_photos.py
```


## Contributing other photos

If GPO doesn't have a photo for someone in their member guide, we may be willing to accept a photo from another source.

In this case, [open a ticket](https://github.com/unitedstates/images/issues/new), and include:
If GPO doesn't have a photo for someone in their member guide, we may be willing to
accept a photo from another source.

* The name and Bioguide ID of the member of Congress.
* A link to the image you're suggesting we incorporate, and to a page that displays that image.
* Why you believe the image is definitely official and in the public domain.
In this case, [open a ticket](https://github.com/unitedstates/images/issues/new), and
include:

- The name and Bioguide ID of the member of Congress.
- A link to the image you're suggesting we incorporate, and to a page that displays that
image.
- Why you believe the image is definitely official and in the public domain.

## Public domain

The photos of members of Congress are from the Government Printing Office, which [has assured us that all photos are public domain](https://github.com/sunlightlabs/congress/issues/432#issuecomment-34481338).
The photos of members of Congress are from the Government Printing Office, which
[has assured us that all photos are public domain](https://github.com/sunlightlabs/congress/issues/432#issuecomment-34481338).

All other files in this project are [dedicated to the public domain](LICENSE). As spelled out in [CONTRIBUTING](CONTRIBUTING.md):
All other files in this project are [dedicated to the public domain](LICENSE). As
spelled out in [CONTRIBUTING](CONTRIBUTING.md):

> The project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the [CC0 1.0 Universal public domain dedication](http://creativecommons.org/publicdomain/zero/1.0/).
> The project is in the public domain within the United States, and copyright and
> related rights in the work worldwide are waived through the
> [CC0 1.0 Universal public domain dedication](http://creativecommons.org/publicdomain/zero/1.0/).

> All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest.
> All contributions to this project will be released under the CC0 dedication. By
> submitting a pull request, you are agreeing to comply with this waiver of copyright
> interest.
2 changes: 1 addition & 1 deletion congress/metadata/B001304.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name:
name: Office of Anthony Brown
link: https://anthonybrown.house.gov/sites/anthonybrown.house.gov/files/wysiwyg_uploaded/official.jpg
2 changes: 1 addition & 1 deletion congress/metadata/B001306.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: U.S. House Office of Photography
link: https://commons.wikimedia.org/w/index.php?curid=78590567
link: https://commons.wikimedia.org/w/index.php?curid=78590567
2 changes: 1 addition & 1 deletion congress/metadata/C001055.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: U.S. House Office of Photography
link: https://commons.wikimedia.org/w/index.php?curid=80784529
link: https://commons.wikimedia.org/w/index.php?curid=80784529
2 changes: 1 addition & 1 deletion congress/metadata/C001122.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: U.S. House Office of Photography
link: https://commons.wikimedia.org/w/index.php?curid=76586796
link: https://commons.wikimedia.org/w/index.php?curid=76586796
2 changes: 1 addition & 1 deletion congress/metadata/C001123.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: U.S. House Office of Photography
link: https://commons.wikimedia.org/w/index.php?curid=75585145
link: https://commons.wikimedia.org/w/index.php?curid=75585145
2 changes: 1 addition & 1 deletion congress/metadata/C001124.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: U.S. House Office of Photography
link: https://commons.wikimedia.org/w/index.php?curid=81932819
link: https://commons.wikimedia.org/w/index.php?curid=81932819
2 changes: 1 addition & 1 deletion congress/metadata/D000631.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: U.S. House Office of Photography
link: https://commons.wikimedia.org/w/index.php?curid=79245159
link: https://commons.wikimedia.org/w/index.php?curid=79245159
2 changes: 1 addition & 1 deletion congress/metadata/G000061.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: House Creative Services
link: https://commons.wikimedia.org/w/index.php?curid=93516904
link: https://commons.wikimedia.org/w/index.php?curid=93516904
2 changes: 1 addition & 1 deletion congress/metadata/G000578.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: @Rep_Matt_Gaetz - Twitter
name: "@Rep_Matt_Gaetz - Twitter"
link: https://twitter.com/Rep_Matt_Gaetz
2 changes: 1 addition & 1 deletion congress/metadata/G000583.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: @RepJoshG - Twitter
name: "@RepJoshG - Twitter"
link: https://twitter.com/RepJoshG
2 changes: 1 addition & 1 deletion congress/metadata/G000588.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: U.S. House Office of Photography
link: https://commons.wikimedia.org/w/index.php?curid=84184710
link: https://commons.wikimedia.org/w/index.php?curid=84184710
2 changes: 1 addition & 1 deletion congress/metadata/G000590.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: United States Congress
link: https://commons.wikimedia.org/w/index.php?curid=75592712
link: https://commons.wikimedia.org/w/index.php?curid=75592712
2 changes: 1 addition & 1 deletion congress/metadata/H001082.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: U.S. House of Representatives
link: https://commons.wikimedia.org/w/index.php?curid=75580048
link: https://commons.wikimedia.org/w/index.php?curid=75580048
2 changes: 1 addition & 1 deletion congress/metadata/H001083.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: House Creative Services
link: https://commons.wikimedia.org/w/index.php?curid=86984657
link: https://commons.wikimedia.org/w/index.php?curid=86984657
2 changes: 1 addition & 1 deletion congress/metadata/H001089.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: Senate Committee on the Judiciary
name: Senate Committee on the Judiciary
link: https://www.judiciary.senate.gov/about/members
2 changes: 1 addition & 1 deletion congress/metadata/H001090.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: US House of Representativess
link: https://commons.wikimedia.org/w/index.php?curid=75597669
link: https://commons.wikimedia.org/w/index.php?curid=75597669
2 changes: 1 addition & 1 deletion congress/metadata/J000020.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: U.S. House of Representatives
link: https://commons.wikimedia.org/w/index.php?curid=92583419
link: https://commons.wikimedia.org/w/index.php?curid=92583419
2 changes: 1 addition & 1 deletion congress/metadata/K000390.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: @RepKihuen - Twitter
name: "@RepKihuen - Twitter"
link: https://twitter.com/RepKihuen
2 changes: 1 addition & 1 deletion congress/metadata/K000395.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: House Creative Services
link: https://commons.wikimedia.org/w/index.php?curid=80784651
link: https://commons.wikimedia.org/w/index.php?curid=80784651
2 changes: 1 addition & 1 deletion congress/metadata/L000586.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: Wikimedia Commons
link: https://commons.wikimedia.org/wiki/File:Al_Lawson_115th_Congress_photo.jpg
link: https://commons.wikimedia.org/wiki/File:Al_Lawson_115th_Congress_photo.jpg
2 changes: 1 addition & 1 deletion congress/metadata/L000594.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: Office of Senator Kelly Loeffler
link: https://commons.wikimedia.org/w/index.php?curid=85928962
link: https://commons.wikimedia.org/w/index.php?curid=85928962
2 changes: 1 addition & 1 deletion congress/metadata/M000687.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: House Creative Services
link: https://commons.wikimedia.org/w/index.php?curid=93421269
link: https://commons.wikimedia.org/w/index.php?curid=93421269
2 changes: 1 addition & 1 deletion congress/metadata/M001204.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: U.S. House of Representatives
link: https://commons.wikimedia.org/w/index.php?curid=75580991
link: https://commons.wikimedia.org/w/index.php?curid=75580991
2 changes: 1 addition & 1 deletion congress/metadata/M001210.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: U.S. Congress
link: https://commons.wikimedia.org/w/index.php?curid=83284876
link: https://commons.wikimedia.org/w/index.php?curid=83284876
2 changes: 1 addition & 1 deletion congress/metadata/P000614.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: United States Congress
link: https://commons.wikimedia.org/w/index.php?curid=75731216
link: https://commons.wikimedia.org/w/index.php?curid=75731216
2 changes: 1 addition & 1 deletion congress/metadata/S001205.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: U.S. House Office of Photography
link: https://commons.wikimedia.org/w/index.php?curid=79199722
link: https://commons.wikimedia.org/w/index.php?curid=79199722
2 changes: 1 addition & 1 deletion congress/metadata/S001208.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: United States Congress
link: https://commons.wikimedia.org/w/index.php?curid=75591621
link: https://commons.wikimedia.org/w/index.php?curid=75591621
4 changes: 2 additions & 2 deletions congress/metadata/S001209.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: United States House of Representatives
link: https://commons.wikimedia.org/w/index.php?curid=75552783
name: United States House of Representatives
link: https://commons.wikimedia.org/w/index.php?curid=75552783
2 changes: 1 addition & 1 deletion congress/metadata/S001211.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: United States Congress
link: https://commons.wikimedia.org/w/index.php?curid=75644409
link: https://commons.wikimedia.org/w/index.php?curid=75644409
Loading