2019-01-22 19:27:56 +03:00
|
|
|
# Common tasks
|
2014-03-05 19:05:18 +04:00
|
|
|
|
2019-05-17 00:56:02 +03:00
|
|
|
## Serving the docs locally
|
2015-08-11 14:41:54 +03:00
|
|
|
|
2019-05-17 00:56:02 +03:00
|
|
|
The docs are built using MkDocs, which has a live-reloading development server,
|
|
|
|
that makes working on the docs locally much easier.
|
2015-08-11 14:41:54 +03:00
|
|
|
|
2020-03-09 20:58:01 +03:00
|
|
|
```console
|
|
|
|
% pip install poetry
|
|
|
|
% poetry run mkdocs serve
|
2019-05-17 00:56:02 +03:00
|
|
|
```
|
2020-04-04 04:59:36 +03:00
|
|
|
|
2020-04-14 08:29:53 +03:00
|
|
|
<!-- prettier-ignore -->
|
|
|
|
!!! note
|
|
|
|
On Windows you might need to fallback ```python -m venv venv``` or ```virtualenv``` to manage your virtualenv if ```poetry``` does not work for you.
|
2019-05-17 00:56:02 +03:00
|
|
|
|
2020-04-14 08:29:53 +03:00
|
|
|
The docs will then be available at: <http://localhost:8000>
|
2015-08-11 14:41:54 +03:00
|
|
|
|
2019-01-22 19:27:56 +03:00
|
|
|
## Updating package.json
|
2015-09-22 20:46:44 +03:00
|
|
|
|
2019-01-22 19:27:56 +03:00
|
|
|
- Always use `yarn` to make changes, not `npm`, so that `yarn.lock` remains in sync.
|
|
|
|
- Add new packages using `yarn add <PACKAGE>` (`yarn.lock` will be automatically updated).
|
|
|
|
- After changes to `package.json` use `yarn install` to install them and automatically update `yarn.lock`.
|
|
|
|
- For more details see the [Yarn documentation].
|
2015-09-22 20:46:44 +03:00
|
|
|
|
2019-01-22 19:27:56 +03:00
|
|
|
[yarn documentation]: https://yarnpkg.com/en/docs/usage
|
2016-05-30 17:07:55 +03:00
|
|
|
|
2020-03-19 21:07:31 +03:00
|
|
|
## Debugging Tools
|
|
|
|
|
|
|
|
You can use the Python Debugger ([pdb](https://docs.python.org/3.7/library/pdb.html)) in a Docker container.
|
|
|
|
After starting a local Treeherder instance using [docker-compose](installation.md#server-and-full-stack-development),
|
|
|
|
in a separate shell type `docker attach backend`. Then set a breakpoint in your file using either `import pdb; pdb.set_trace()`
|
|
|
|
or `breakpoint()` (for Python v3.7+). The pdb debugger will start in that shell once the breakpoint has been triggered.
|
|
|
|
For example, it can be triggered via refreshing the browser (localhost) if the view you're on calls an API with a breakpoint on it.
|