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

Download the list of members from Google Spreadsheet, download avatars as files #85

Merged
merged 10 commits into from
Aug 24, 2019

Conversation

honzajavorek
Copy link
Member

This change introduces a new separate step needed for development and deployment of the site - pipenv run build, which downloads data from external sources. Even though the site is serialized into a static HTML so one might think doing it in Flask views is not a problem, I think this is a better solution, because I can run pipenv run build just once and then develop the site with fast refreshing or even offline.

In this PR I introduce downloading of members list from a spreadsheet saved in Pyvec Google Drive. It updates the board members according to the latest changes. When I was at it, I also moved all avatar handling into the build step - no more proxy views to make thumbnails etc. Now all avatars are downloaded to a directory inside static as PNG images during the build step.

@honzajavorek honzajavorek requested a review from a team June 25, 2019 09:14
README.md Show resolved Hide resolved
@hroncok
Copy link
Member

hroncok commented Jun 26, 2019

I can check the rest within a week. Let me know if that's to late for you

@honzajavorek
Copy link
Member Author

I want to have the site ready for 100th Prague Pyvo and before the summer sprint. Going to bike over the weekend, so I think ~week should be okay. I'm working on another, parallel, but significantly smaller PR which I'll issue promptly.

Copy link
Member

@hroncok hroncok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be a little bit more verbose?

$ pipenv run build
Loading .env environment variables…

### Members

Pyvec members are tracked in an internal Google Spreadsheet. The future
intention is to have the list of members public, but we're not there yet (GDPR).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
intention is to have the list of members public, but we're not there yet (GDPR).
intention is to have the list of members public, but we're not there yet.



def generate_yaml(data):
yaml_contents = '''\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider using textwrap.dedent instead. Or not, it's just a tip.

@honzajavorek
Copy link
Member Author

Note: according to bylaws the list of members should contain a date of birth, which I wouldn't like to leak for anyone, it's over my limits of what can be secured by security by obscurity and what cannot.

This needs to be reworked into something using Google API to access a private Google document.

@honzajavorek
Copy link
Member Author

@hroncok I reworked it so the list uses Google API. Result:

image

@honzajavorek
Copy link
Member Author

I don't get it. I think Travis has a problem:

/home/travis/.travis/job_stages: line 18: /home/travis/.rvm/rubies/ruby-2.5.3/bin/ruby: Argument list too long

I'm very tempted to migrate this repo to Circle CI.

@honzajavorek honzajavorek force-pushed the honzajavorek/members branch 2 times, most recently from 3a98e7e to daa14d1 Compare August 24, 2019 11:10

1. Follow the steps in the [gspread guide](https://gspread.readthedocs.io/en/latest/oauth2.html). Instead of Google Drive API, enable Google Sheets API.
1. Save the obtained JSON file into the `pyvecorg` package as `google_service_account.json`
1. Make sure it is ignored by Git
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose the setup up until this point is needed for local hacking as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. But since it is decoupled, you should be able to run the site without members being populated, for editing other parts of the page.

pyvecorg/build.py Show resolved Hide resolved
pyvecorg/build.py Outdated Show resolved Hide resolved
@honzajavorek
Copy link
Member Author

@hroncok Addressed!

Copy link
Member

@hroncok hroncok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢 🇮🇹

@honzajavorek honzajavorek merged commit 4ceeefb into master Aug 24, 2019
@honzajavorek honzajavorek deleted the honzajavorek/members branch August 24, 2019 18:00
honzajavorek added a commit to pyvec/elsa that referenced this pull request Aug 26, 2019
See https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables for a reference and https://circleci.com/gh/pyvec/pyvec.org/15#build-parameters/containers/0 (Spin Up Environment) for examples:

  BASH_ENV=/tmp/.bash_env-5d614082be728d64db773f33-0-build
  CI=true
  CIRCLECI=true
  CIRCLE_BRANCH=honzajavorek/members
  CIRCLE_BUILD_NUM=15
  CIRCLE_BUILD_URL=https://circleci.com/gh/pyvec/pyvec.org/15
  CIRCLE_COMPARE_URL=
  CIRCLE_JOB=build
  CIRCLE_NODE_INDEX=0
  CIRCLE_NODE_TOTAL=1
  CIRCLE_PREVIOUS_BUILD_NUM=14
  CIRCLE_PROJECT_REPONAME=pyvec.org
  CIRCLE_PROJECT_USERNAME=pyvec
  CIRCLE_PULL_REQUEST=pyvec/pyvec.org#85
  CIRCLE_PULL_REQUESTS=pyvec/pyvec.org#85
  CIRCLE_REPOSITORY_URL=git@github.com:pyvec/pyvec.org.git
  CIRCLE_SHA1=f6e04550035d3f904014689ee8f1541346b5feaf
  CIRCLE_SHELL_ENV=/tmp/.bash_env-5d614082be728d64db773f33-0-build
  CIRCLE_STAGE=build
  CIRCLE_USERNAME=honzajavorek
  CIRCLE_WORKFLOW_ID=e8affa4d-f267-4930-b339-af510fc8f849
  CIRCLE_WORKFLOW_JOB_ID=ce6ad044-09a4-4d4e-8423-ce085a50be0b
  CIRCLE_WORKFLOW_UPSTREAM_JOB_IDS=
  CIRCLE_WORKFLOW_WORKSPACE_ID=e8affa4d-f267-4930-b339-af510fc8f849
  CIRCLE_WORKING_DIRECTORY=~/repo
  CI_PULL_REQUEST=pyvec/pyvec.org#85
  CI_PULL_REQUESTS=pyvec/pyvec.org#85
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants