Skip to content
This repository has been archived by the owner on Oct 18, 2022. It is now read-only.

move python side of workbench to the invest repo #72

Merged
merged 25 commits into from
Jan 8, 2021

Conversation

davemfish
Copy link
Collaborator

This PR fixes #70 and fixes #71

The main changes are to the build process. The workbench build process will no longer build invest binaries from source, instead there is a npm run fetch-invest step that will look for pre-built binaries on GCS to download and bundle with the electron distribution.

package.json now has an "invest" property to configure which invest binaries will be fetched for workbench builds.

The flask app that was formerly server.py will now live at natcap.invest.web_api and can be launched from the invest CLI (invest serve). That means the workbench only needs to include that one python executeable (the invest cli) when it formerly needed two. Those changes are evident in main_helpers.js.

This PR also drops binary builds for ubuntu - since we don't make invest binaries for ubuntu. And it skips the puppeteer test on macos because they reliably don't work at the moment (see #52 ).

@davemfish
Copy link
Collaborator Author

Oh and there's a related invest PR that it probably makes sense to review kind of in parallel. natcap/invest#399

Probably neither should be merged until we're happy with both being merged.

@@ -6,13 +6,14 @@
"main": "src/main.js",
"homepage": "./",
"scripts": {
"start": "npx electron . --dev",
Copy link
Member

Choose a reason for hiding this comment

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

Was the reason for dropping npx just because it's not really needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, npx was pretty redundant inside this "scripts" context. I mainly use npx because it searches the local node_modules first for CLIs like electron, etc. But the "scripts" context already ensures that, I've since learned.

readme.md Outdated
## To build this application
For development, choose either:
**A.** Duplicate the production setup by fetching prebuilt binaries `npm run fetch-invest`
**B.** Use an any other locally installed, compatible, invest CLI (e.g. from a local python environment). To configure this, see `.env-example`
Copy link
Member

Choose a reason for hiding this comment

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

Typo Use an any

* build invest binaries
`python -m PyInstaller --workpath build/pyi-build --clean --distpath build ./invest-flask.spec`
* `npm start`
* bind to an `invest` executeable (see package.json "invest" for a compatible version)
Copy link
Member

Choose a reason for hiding this comment

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

Related to this and invest in package.json, is this something that developers are expected to change frequently and commit in PRs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think it will be changed frequenty, but yes, the "invest" property will need to be updated to whatever version of invest we want packaged with the workbench. Maybe in the future we would want to programmaticaly default to the latest invest release, but for now hardcoding the invest version in package.json seems okay to me.

Comment on lines +35 to +36
prefix commands with `npx` (e.g. `npx eslint ...`). Otherwise, only
globally installed packages are on the PATH.
Copy link
Member

Choose a reason for hiding this comment

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

Ah, thank you.

Copy link
Member

@dcdenu4 dcdenu4 left a comment

Choose a reason for hiding this comment

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

Hey @davemfish This seems like a good move to me overall and I only had a few comments / questions. My main question / concern was around the invest setup in package.json and how this will work in practice for development and PRs. Should we also be providing a link those archives in the Readme from which to grab InVEST binaries from?

I'll add more thoughts on the InVEST side of things!

@davemfish davemfish mentioned this pull request Jan 4, 2021
@davemfish
Copy link
Collaborator Author

This PR now also fixes #73

Copy link
Member

@dcdenu4 dcdenu4 left a comment

Choose a reason for hiding this comment

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

This looks good to me @davemfish !

@emlys
Copy link
Member

emlys commented Jan 7, 2021

Looks like the mac test is failing to download the binaries, maybe a wrong url?

@davemfish
Copy link
Collaborator Author

Looks like the mac test is failing to download the binaries, maybe a wrong url?

Right, this should be due to the fact that the invest Mac builds failed on the invest commit this build is linked to.

Copy link
Member

@phargogh phargogh left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Drop binary build support for linux move python side of workbench to natcap.invest repo
4 participants