Граф коммитов

77 Коммитов

Автор SHA1 Сообщение Дата
Matjaž Horvat 385476a2a1
Remove django-sslserver (#3359)
We don't really use it. The library hasn't been updated in years. The same can be achieved using django-extensions.

Also fix compile_requirements.sh to output requirements .txt files. See:
https://docs.astral.sh/uv/pip/compatibility/#pip-compile-defaults
2024-09-20 16:23:17 +02:00
Francesco Lodolo e3e5935f66
Replace pip and pip-tools with uv (#3357) 2024-09-20 13:29:39 +02:00
JohnKagunda d310eab4b2
Update: Removed docker/k8s-first-steps (#3280) 2024-07-22 10:35:28 +02:00
JohnKagunda 185a7e0b05
Add ability to log to a file (#3260)
Co-authored-by: Matjaž Horvat <matjaz.horvat@gmail.com>
2024-07-17 11:34:43 +02:00
Matjaž Horvat 7f78be7d7f
Create email consent page (#3231)
- Adds Email consent screen as per the spec for existing and new users.
- Prevent random test failures
2024-05-20 15:19:12 +02:00
Francesco Lodolo 4b6e839447
Update workflows and docker to Python 3.11 (#3188)
* Use Python 3.11

* Run pyupgrade with Python 3.11+

* Update pyupgrade to latest version

* Update Celery and python-dateutil

Celery is not compatible with Python 3.11, leading to test failures. Need to update also python-dateutil to install the latest version.
2024-04-25 12:31:24 +02:00
Eemeli Aro 06d0ed5b32
Use postgres:15 instead of custom postgres:13.4 build for dev env (#3170) 2024-04-09 16:41:26 +02:00
Francesco Lodolo fb25c53ddc
Update to Debian 12, PostgreSQL 15, Node.js 18 in Docker (#3115) 2024-02-23 07:53:43 +01:00
Francesco Lodolo 9cf89026f2
Update to Python 3.10 (#3112)
In:
* GitHub workflows
* Docker
* Heroku

Also make related flake8, black and pyupgrade fixes (some actually only needed in future versions of python).
2024-02-22 19:33:05 +01:00
Matjaž Horvat d1714dd06a
Pretranslation monitoring: Insights page (#2932)
* ENABLE_INSIGHTS_TAB -> ENABLE_INSIGHTS
* insights.{css,js} -> insights_tab.{css,js}
* Restore chart group on the Profile page
* Move Custom legend to insights_charts CSS/JS
* Only show clicked dataset when holding Alt or Command key
2023-08-18 16:16:24 +02:00
Eemeli Aro 4a1f92a20e
Speed up server stop in development (#2863) 2023-05-29 12:54:24 +02:00
Matjaž Horvat 60735c68f0 Update black and test requirements, fix pip-compile warnings
- Ignore resolver deprecation warning on make requirements
- Ignore egg fragment deprecation warning on make requirements
- Update test requirements (needed to update black)
- Update black (needed to install the regex package)
- Run make black
- Add regex package (needed to implement accesskey candidate generator)
2023-05-17 17:47:13 +02:00
Matjaž Horvat ca67f5d312
Add support for Google AutoML Translation (#2648)
* Gracefully handle Google AutoML error when credentials not set

* Prevent app crash on Heroku by forcing protobuf to use Python for parsing

By default, protobuf uses C++ for parsing. The library includes prebuilt binary modules for Apple silicon, which my local box uses, so for me the
library works as expected without this hack. I only noticed that's not the case for everyone after deploying to the stage server on Heroku.

Read more:
https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
https://developers.google.com/protocol-buffers/docs/reference/python-generated#sharing-messages

* Add buildpack needed for authentication using Google Cloud service accounts

And while we're at it, let's remove the unused buildpack.
2022-11-07 11:51:04 +01:00
Roger Meier ccdcceb233
fix(docker): copy using chown for package.json and .env (#2571) 2022-07-14 20:59:46 +02:00
Eemeli Aro 9faea69c20
Set `tabWidth: 2` in Prettier config (#2438)
* chore: Update Prettier config, setting tabWidth:2

* style: Apply updated Prettier styles

If you need to rebase work past this style change, do as follows:

0. Consider this to be commit `commitA`, replacing that with its id in the following.
1. To make sure mistakes aren't fatal, assign a second branch to your current work.
2. Rebase your branch on the commit immediately before this one, commitA~
3. Run the following command at the root of the repo:

    git rebase --strategy-option=theirs \
      --exec 'npx prettier --write . && git add -u && git commit --amend --no-edit' \
      commitA

That will take a short while esp. if you have multiple commits,
as it runs Prettier on everything for every commit.
If you've deleted files, the rebase may drop down to interactive mode
and have you `git rm` as appropriate, then `git rebase --continue`.

You should end up with just your changes in your branch,
prettily formatted. To validate that,
apply the same Prettier config change to your original branch,
reformat the files with `npm run prettier`,
and then compare the results with the rebased branch.

* chore: Clean up lint configs
2022-03-03 09:46:35 +01:00
Eemeli Aro 9fc9430cc7
Refactor the frontend build (#2437)
* feat!(frontend): Drop react-scripts

* chore(frontend): Add missing dependency on escape-html

* refactor(frontend): Use ~ to prefix paths from src/ root

* chore(frontend): Add & configure jest & ts-jest

* chore(frontend): Fix bugs & tests revealed by updated jest, skipping EntityDetails

* chore(frontend): Add ESLint as explicit dev dependency; satisfy linter

* chore(frontend): Clean up dependencies, using caret ^ range for all

* chore(frontend): Switch from yarn to npm & configure as a workspace

Prettier & ESLint dependencies are now defined in the root package.json

Changing package management means that many path & minor updates are
simultaneously applied via the caret ^ ranges.

The local/pontoon-frontend Docker image now uses node:16 as a base
and /app/frontend rather than /frontend for its contents & workdir,
in order to accommodate the changed topography.

* chore: Collect devDependencies in root package.json

* chore(tag-admin): Move Babel config to repo root

* feat(frontend): Adjust public/ for being served as Django static files

* chore(frontend): Add build with Rollup

* feat(pontoon): Drop frontend proxy, server static files normally, add pipeline for frontend

* chore(server): Add dependencies via pontoon/package.json; clean up Dockerfile

* chore: Add build:prod targets for frontend & tag-admin

frontend image droapped from Dockerfile as unused

styled-components updated to v5 to avoid a broken import in v4.

* chore: Add watch targets for workspaces & root, using concurrently

* chore: Code review & CI-identified fixes

* chore: Refresh lockfiles, dropping frontend/yaml.lock

* chore: Add /bin/watch.sh to watch all builds; refactor `make run`

* ci: Fix frontend TS test CLI args due to yarn -> npm change

* chore: Use `npm start` rather than `npm run watch`

* chore(pontoon): Mark django-pipeline JS dependencies as devDependencies

* refactor: Rename frontend/ as translate/
2022-03-02 16:10:42 +01:00
Eemeli Aro 8d2714d5db
Refactor tag-admin to use functional components, stop testing its internals, replace webpack with rollup (#2432)
* refactor(tag-admin): Use functional components, stop testing internals

* style(tag-admin): Satisfy Prettier

* chore(tag-admin): Add & configure build with Rollup

* chore: Drop webpack dependencies as unused

terser is included in the root package.json to ensure its availability
for pipeline during the Django build via TERSER_BINARY.

* chore(tag-admin): Add npm install & build targets to Makefile

Also sets engine-strict = true in .npmrc, so attempts to use
npm cli versions which do not support workspaces will fail.

* chore(tag-admin): Update from rollup-plugin-replace to @rollup/plugin-replace

* docs: Update prerequisites
2022-02-21 19:28:25 +01:00
Eemeli Aro d26c91487e
Handle the `tags/admin/` client as an npm workspace at `/tag-admin/` (#2430)
* Move tag-admin sources & tests to /tag-admin/src/

Import paths are modified to use relative, fully qualified file names.

* Configure tag-admin as an npm workspace

* Fix build & CI issues

Consistently call 'npm ci' and 'npm run build' where appropriate

* Apply lint & style rules to tag-admin/webpack.config.js

* Fix permissions for /tag-admin/ in Dockerfile

* ci: Rename "non-frontend-js" action as "tag-admin"

* docs(tag-admin): Add README
2022-02-16 16:47:32 +02:00
Jarek 4883395701
Add a Make target to run all linters. (#2011)
* Add a Make target to run all linters

* Unify order of commands in PHONY, help and definitions

* More meaningful order of commands

* Simpler ci command definition

* Document pyupgrade

* Fix b0rken link in the docs

Co-authored-by: Matjaž Horvat <matjaz.horvat@gmail.com>
2021-10-03 01:36:06 +02:00
Eemeli Aro 623d7bbb39
Add a separate frontend container (#1996)
* refactor: Rename build-frontend make task as build-tagadmin

* feat: Split frontend app into its own container

* chore: Include static frontend build in webapp for compatibility

* chore: Run all tests on `make test`; add `make test-webapp`

* refactor: Rename "webapp" as "server"

* refactor: Use fronted build stage rather than duplicated Dockerfile

* chore: Rename run_server -> server_run also in docker/k8s-first-steps

* chore: Run ESLint & Prettier tasks also in frontend

* chore: Use new `make ci` to test & lint both frontend & server

Based on `make test-server`, that now only runs server tests.
2021-09-30 15:02:01 +02:00
Eemeli Aro 5ea99679c9
chore: Dev env updates: Debian Buster → Bullseye, Postgres 11 → 13, Node.js 10 → 14 (#2008) 2021-09-08 10:13:41 +02:00
Matjaž Horvat 70afb79a9e
Include missing lint requirements in Dockerfile (#2010) 2021-09-03 16:10:02 +02:00
Axel Hecht 8601d0a197 No bug, use constraints vs imports in python requirements.
Using constraints has the benefit that updates to default.in only
show up in default.txt, and not in dev.txt. That should make reviews
easier. It still ensures there's only one version of each package
used across production, dev, and local testing.
2021-08-02 20:40:05 +02:00
Matjaž Horvat 581b23a279
Fix bug 1722562: Update FxA local configuration (#1977) 2021-07-27 20:44:44 +02:00
Ranieri Althoff e08dd14825
Upgrade Python to 3.9.6 (#1971)
Also run pyupgrade to improve syntax
2021-07-15 18:24:58 +02:00
Axel Hecht c349a272e5
Fix bug 1697462, update node dependencies (#1895)
* Bug 1697462, update node dependencies

* Update babel and eslint

* Fix more references to lint-frontend

* Get make test to work again

* npm update

* yarn upgrade

* browserslist --update-db

* yarn upgrade react-scripts --latest

* Remove last Translate.Next in Makefile

* yarn upgrade tlds --latest

* yarn upgrade sinon --latest

* yarn upgrade enzyme-adapter-react-16 --latest

* Use yarn in workflow to stick to pinned versions

* Install top-level, too, as that has @babel/eslint-parser
2021-03-17 18:18:09 +01:00
Axel Hecht 20908ee255
Fix bug 1691959: Upgrade dependencies, and script updates to make that easy (#1864) 2021-02-10 22:02:10 +01:00
Julen Ruiz Aizpuru a29ed24b99 Fix bug 1687371 - pipeline: delegate JS compression to Terser 2021-01-20 09:43:00 +01:00
Matjaž Horvat c41f880982
Fix bug 1685799: Compile python requirements in docker (#1806) 2021-01-08 22:02:29 +01:00
Matjaž Horvat 18a0698527
Update lxml to 4.6.2 and python to 3.8.7 (#1805) 2021-01-08 21:41:58 +01:00
Matjaž Horvat 847e43c377
Fix bug 1680056: Implement community health dashboard frontend (#1776)
Also:
* Add optional `ENABLE_INSIGHTS_TAB` setting to enable the Insights tab
* Make code play more nicely with black
2020-12-21 21:42:50 +01:00
quimicefa 5b047d921e
Update node.js from jessie to buster in Dockerfile (#1775) 2020-12-17 10:29:31 +01:00
Philipp Fischbeck 5084c1cf97
Fix bug 1680536: Use pip-compile for Python dependencies (#1766)
All direct dependencies are now in requirements/*.in files, and the requirements/*.txt files are generated with pip-compile. We provide a script for that, since these files should always be updated all at once.
2020-12-09 16:16:54 +01:00
April Bowler eda809bb42
Bug 1615565: Move prettier to main folder (#1749)
The original implementation of Prettier only covered the files in the /frontend folder.
This patch moves Prettier to the main folder so that it covers the .js and .css files in
/frontend, /pontoon, and /tests folders.

In addition, it also adds a script to give the option to just run a format 'check' with Prettier.
2020-12-05 20:36:52 +01:00
Matjaž Horvat 46516624d7
Fix bug 1680429: Update compare-locales and fluent (#1756)
* Add --use-deprecated=legacy-resolver to bypasss pip 20.3 limitations
* Update compare-locales to 8.1.0
* Update frontend Fluent libraries
2020-12-03 13:31:35 +01:00
Matjaž Horvat 0e52b11ec0
Fix bug 1667765: Enable Sync button by default in production (#1690) 2020-09-28 21:04:32 +02:00
April Bowler 0f31239f21
Fix Bug 1615565: Use prettier to format frontend code (#1688)
* Add prettier to test and CI to enforce formatting FE code
* Add make commands for prettier and update documentation
2020-09-27 23:03:32 +02:00
Jarek 3f87f7d71d
Fix bug 1644770 - Bump Python to 3.8.3 and Psycopg2 to 2.8.5 (#1646) 2020-06-15 10:31:43 +02:00
Harald Binkle e7c6619b9d
first steps for running in k8s environment (#1580)
* * adjusted base.py to enabled using some more env vars needed for running in k8s environment
* example files and instructions to get pontoon running on k8s.
--- it's not yet a stable solution ---
2020-03-30 10:46:46 +02:00
Jarek 2c8d8d7a18
No bug - On some of Docker images, the `pontoon` user won't have id=1000 b… (#1552)
* No bug - On some of Docker images, the `pontoon` won't have id=1000 by default.

Changes:
* Explicitly set the user id (to avoid confusions when maintainers of the docker image will change something).
* Parametrize the user/group id in the Makefile to give people an easy way to get around that problem.

To give you more context -> I rebuild the webapp image today and had problems with permissions (e.g. making new migrations).
My user id was:
```bash
pontoon@63acee8f6019:/app$ id
uid=999(pontoon) gid=1000(pontoon) groups=1000(pontoon)
```
2020-01-31 11:50:34 +01:00
Adrian Gaudebert fd0efb769d
Bug 1594793 - Enforce black formatting in CI. (#1545)
This also reformats code with Black where needed.
2020-01-30 09:01:35 +01:00
Adrian Gaudebert cf627b9645 Bug 1600344 - Only build and run Python 3 on docker. 2020-01-28 17:33:52 +01:00
Adrian Gaudebert e5817a3f63
No bug - Upgrade react-scripts to latest version. (#1520) 2019-12-23 12:22:14 +01:00
Adrian Gaudebert f14eb08c52
No bug - Allow changing files from volumes in docker. (#1502)
When creating containers with docker-compose, volumes containing the source code from the host are created. From inside a docker container, it was not possible to make changes in those volumes, because of a permission issue. This commit sets the GID of the pontoon group so that it matches what will, in most cases, be the group of the user in the host (1000). That allows to make changes inside volumes. Note that if a user has a different group GID (for example, 1001, because they are the second user created on the host) then this will not work. But most folks work on their personal computer so that should not happen too often, and I do not have a good solution for that anyway. This is strictly better than before.
2019-11-25 09:11:58 +01:00
Adrian Gaudebert 236fffe6ae
No bug - Update postgresql version used for local docker setup. (#1490) 2019-11-18 12:11:37 +01:00
Adrian Gaudebert 10f17aef70 No bug: Dockerfile rewrite (#1463)
Rework docker file into a single file, remove gosu, simplify instructions, and reduce build time.
2019-11-06 08:34:44 +01:00
April Bowler 30d8c3d3dd Fix bug 1558484 - Add ability to log users in using GitHub (#1442)
Also: Make standard Django login the default authentication method.
2019-10-30 19:09:51 +01:00
Adrian Gaudebert 40332ebf08
Fix bug 1589137 - Autoreload django static files in dev. (#1445)
Because of the way we set up static files for Translate.Next, in order to load them from the webpack server, we broke autoreloading of django static files. One had to rebuild the docker image in order to get updated static files. The problem was that the WhiteNoise middleware was taking over serving files, and in doing so only served from collected static files, thus never serving updated files in dev. With WhiteNoise disabled in dev, our static files serve function takes over and does the right thing at all time.
2019-10-22 16:36:45 +02:00
Jarek de28fe7a3f Fix bug 1541252 - Fix linting errors on Python 3 (#1288)
Fix all errors detected by flake8. `pytest` is able to run testsuites and report failing tests. Changes don't affect Pontoon on Python 2.

Included changes/bugfixes:
* bump up the version number of:
** Mercurial==5.0, it has experimental support for Python 3
** lxml==4.3.3
* add new dependencies:
** python3-openid - required by django-allauth
** defused-xml - required by python3-openid
* move sqlparse to `constraints.txt`, because it's a dependency of django-debug-toolbar
* nested() from contextlib is not available in Python 3
* update hashes of some dependencies for Python 3 (thanks to Hashin)
2019-06-03 18:21:05 +02:00
Jarek b6a80102af Bug 1541253 - Remove pylama in favour of flake8 (#1299) 2019-05-27 12:07:26 +02:00