Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add contributing documentation #12

Merged
merged 3 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Contributing guide

This chapter is reserved for developers who wish to contribute to
`pycrdt-websocket`.

All commands are to be run from the root of the repository unless otherwise
specified.

## Developer installation

It is recommended to use a package manager such as [pixi](https://prefix.dev/docs/pixi/overview).
You will need to install `pip` and `npm`:

```bash
pixi init
pixi add pip nodejs
pixi shell
```

To install this project in editable mode, along with optional dependencies
needed to run tests and build documentation:

```bash
pip install -e ".[test,docs]"
```

## Documentation

To build the documentation and start a server:

```bash
mkdocs serve
```

Then open a browser at [http://127.0.0.1:8000](http://127.0.0.1:8000).

## Integration tests

The NPM test dependencies must first be installed:

```bash
cd tests/
npm install
cd ..
```

To run the integration tests:

```
pytest -v
```

To run a specific test file:

```bash
pytest tests/<filename>
```

Notably helpful `pytest` options include:

- `-rP`: print all standard output, which is hidden for passing tests by default.
- `-k <test-name>`: run a specific test function (not file) by its name.
3 changes: 2 additions & 1 deletion docs/usage/WebSocket_API.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
The WebSocket object passed to `WebsocketProvider` and `WebsocketServer.serve` must implement the following API, defined as a [protocol class](../../reference/WebSocket):
The WebSocket object passed to `WebsocketProvider` and `WebsocketServer.serve`
must implement the following API, defined as a [protocol class](../reference/WebSocket.md):

```py
class WebSocket:
Expand Down
52 changes: 27 additions & 25 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ site_description: Async WebSocket connector for pycrdt
repo_url: https://github.com/jupyter-server/pycrdt-websocket

theme:
name: 'material'
name: "material"
palette:
- scheme: default
primary: 'black'
accent: 'black'
primary: "black"
accent: "black"
toggle:
icon: material/lightbulb-outline
name: Switch to dark mode
icon: material/lightbulb-outline
name: Switch to dark mode
- scheme: slate
primary: 'black'
accent: 'black'
primary: "black"
accent: "black"
toggle:
icon: material/lightbulb
name: Switch to light mode
icon: material/lightbulb
name: Switch to light mode
features:
- navigation.instant
- navigation.top
Expand All @@ -27,20 +27,22 @@ theme:
- content.code.copy

nav:
- Overview: index.md
- install.md
- Usage:
- usage/client.md
- usage/server.md
- usage/WebSocket_API.md
- Code Reference:
- reference/WebSocket_provider.md
- reference/WebSocket_server.md
- reference/ASGI_server.md
- reference/Django_Channels_consumer.md
- reference/WebSocket.md
- reference/Room.md
- reference/Store.md
- Overview: index.md
- install.md
- Usage:
- usage/client.md
- usage/server.md
- usage/WebSocket_API.md
- Contributing:
- contributing.md
- Code Reference:
- reference/WebSocket_provider.md
- reference/WebSocket_server.md
- reference/ASGI_server.md
- reference/Django_Channels_consumer.md
- reference/WebSocket.md
- reference/Room.md
- reference/Store.md

markdown_extensions:
- pymdownx.snippets
Expand All @@ -53,5 +55,5 @@ markdown_extensions:
format: !!python/name:pymdownx.superfences.fence_code_format

plugins:
- mkdocstrings:
default_handler: python
- mkdocstrings:
default_handler: python
Loading