* 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.
* 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
- 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)
* 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-updateshttps://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.
* 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
* 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/
* 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
* 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
* 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>
* 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.
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.
* 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
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.
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.
* * 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 ---
* 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)
```
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.
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.
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)