Skip to content

Commit

Permalink
Update python side from pipenv -> poetry (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathcolo authored Apr 17, 2022
1 parent 31e14d4 commit 7fb49c4
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 610 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
node-version: 12.13.0
- name: Lint frontend code with ESLint
run: |
pip install pipenv
curl -sSL https://install.python-poetry.org | python3 -
npm install
npm run lint-frontend
Expand All @@ -37,6 +37,6 @@ jobs:
node-version: 12.13.0
- name: Lint backend code with Flake8
run: |
pip install pipenv
curl -sSL https://install.python-poetry.org | python3 -
npm install
npm run lint-backend
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
node_modules
.vscode
dist/
Expand Down
24 changes: 0 additions & 24 deletions Pipfile

This file was deleted.

568 changes: 0 additions & 568 deletions Pipfile.lock

This file was deleted.

9 changes: 2 additions & 7 deletions devops/deploy-on-lightsail.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,8 @@
state: restarted
daemon_reload: yes

- name: update pipenv dependencies
shell: pipenv update
args:
chdir: /home/ubuntu/new-train-tracker

- name: update npm
shell: npm update
- name: install app dependencies
shell: npm ci
args:
chdir: /home/ubuntu/new-train-tracker

Expand Down
2 changes: 1 addition & 1 deletion devops/tracker-supervisor.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[program:new-train-tracker]
directory=/home/ubuntu/new-train-tracker
command=/home/ubuntu/.local/bin/pipenv run gunicorn -b localhost:5001 -w 1 server.application:application
command=/home/ubuntu/.local/bin/poetry run gunicorn -b localhost:5001 -w 1 server.application:application
user=ubuntu
autostart=true
autorestart=true
Expand Down
6 changes: 3 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Dependencies:
- `npm` `6.12.0`
- `node` `12.13.0`
- `python` `3.8`
- [`pipenv`](https://pipenv.readthedocs.io/en/latest/)
- [`poetry`](https://python-poetry.org/)
- [`postgresql`](https://www.postgresql.org/)

Run:
Expand Down Expand Up @@ -43,13 +43,13 @@ The Flask app is being run under gunicorn, and this process is controlled by sup
### For a fresh deploy
- Copy `devops/tracker-nginx.conf` into `/etc/nginx/sites-enabled/`. Probably restart nginx (`sudo systemctl restart nginx`)
- Copy `devops/tracker-supervisor.conf` into `/etc/supervisor/conf.d/`
- Run `pipenv install`
- Run `poetry install`
- Run `npm run build`
- Run `sudo supervisorctl reload`

### To deploy changes
- If supervisor/nginx conf files changed, copy them to those directories and restart services accordingly.
- If Pipfile has changed, run `pipenv update`. (N.B. If the source of a package has changed, you may have to manually run `pipenv run pip uninstall ____` before updating so the old one is removed)
- If pyproject.toml has changed, run `poetry update`. (N.B. If the source of a package has changed, you may have to manually run `poetry run pip uninstall ____` before updating so the old one is removed)
- `npm run build`
- `sudo supervisorctl restart new-train-tracker`

Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
"build": "webpack --mode production",
"lint": "npm run lint-frontend && npm run lint-backend",
"lint-frontend": "eslint src",
"lint-backend": "cd server && pipenv run flake8 --ignore=E501,E731",
"postinstall": "pipenv install --python=3.8",
"lint-backend": "cd server && poetry run flake8 --ignore=E501,E731",
"postinstall": "poetry install",
"start-prod": "npm run build && NODE_ENV=production npm run start-python",
"start-python": "pipenv run python -m server.application",
"start-python": "poetry run python -m server.application",
"start": "concurrently npm:start-python npm:build-dev",
"create-history-db": "pipenv run python -m server.history.create_history_db",
"update-history-db": "pipenv run python -m server.history.update_history_db"
"create-history-db": "poetry run python -m server.history.create_history_db",
"update-history-db": "poetry run python -m server.history.update_history_db"
},
"repository": {
"type": "git",
Expand Down
26 changes: 26 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[tool.poetry]
name = "new-train-tracker"
version = "1.0.0"
description = ""
authors = ["TransitMatters Labs Team"]
license = "MIT"

[tool.poetry.dependencies]
python = "^3.8"
flask = "1.1.4"
aiohttp = "3.8.1"
gunicorn = "20.1.0"
psycopg2-binary = "2.9.3"
json-api-doc = "0.15.0"
pytz = "2022.1"


[tool.poetry.dev-dependencies]
black = "20.8b1"
pylint = "2.13.5"
flake8 = "4.0.1"


[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

0 comments on commit 7fb49c4

Please sign in to comment.