|
1 | | -# DipDup contribution guide |
2 | | - |
3 | | -The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119](https://www.ietf.org/rfc/rfc2119.txt). |
4 | | - |
5 | | -## For contributors |
6 | | - |
7 | | -### General |
8 | | - |
9 | | -- All code in this repository MUST be licensed under the [MIT License](./LICENSE.md). |
10 | | -- Python code in this repository MUST run on Python 3.11. Using modern language features is encouraged. |
11 | | -- Python code in this repository MUST run in Linux, macOS, Docker, and `amd64`/`arm64` environments. Windows SHOULD be supported as well. |
12 | | -- We use the PDM package manager to set up the development environment. You SHOULD install it and run `pdm run -l` to see available shortcuts. |
13 | | -- Have fun! |
14 | | - |
15 | | -### Git workflow |
16 | | - |
17 | | -- Branch names MUST follow `prefix/short-description` format. Prefixes currently in use: `feat` for features, `fix` for bugfixes, `docs` for documentation, `exp` for experiments, `ci` for GHA and Docker stuff, `aux` for everything else. |
18 | | -- Commits in pull requests MUST be squashed when merging to `next`. |
19 | | -- Issues and pull requests MUST have a descriptive title; they SHOULD be linked to each other, appropriately labeled, and assigned to maintainers while in progress. |
20 | | - |
21 | | -### Codestyle |
22 | | - |
23 | | -We use `isort` and `black` for autoformatting, `ruff` for linting, and `mypy` for typechecking. All checks MUST pass before merging the code to default branch. Everything not enforced by these tools is up to the developer. But here are some recommendations: |
24 | | - |
25 | | -- Consistency is the key. If you see a pattern in the codebase, follow it. |
26 | | -- Use `NOTE`, `TODO`, and `FIXME` prefixes for meaningful comments. It greatly helps to navigate the codebase. |
27 | | -- Lazy imports are important to keep startup time low for tiny commands. We also do it for project imports, so not a big deal. |
28 | | -- Some methods and attributes made private to avoid polluting the public API. Feel free to access them from the outside if you know what you are doing. |
29 | | -- Finally, about exact language features. F-string formatting is preferred over other syntax. Be careful with walrus operator. Don't forget else in conditional expressions. Listen to you mom. We have no consensus about the match-case yet. |
30 | | - |
31 | | -### Packaging |
32 | | - |
33 | | -- All dependencies MUST be declared in `pyproject.toml` file. |
34 | | -- Non-development dependencies MUST be pinned to non-breaking versions (e.g. `^1.2.3`). |
35 | | -- Core dependencies that we patch MUST be pinned to specific versions (e.g. `1.2.3`). |
36 | | - |
37 | | -### Changelog |
38 | | - |
39 | | -- All changes that affect user (developer) experience MUST be documented in the CHANGELOG.md file. |
40 | | -- Changes that significantly affect DipDup maintainers' experience MAY be documented in the CHANGELOG.md file. |
41 | | -- The changelog MUST conform to the "Keep a Changelog" specification (CI will break otherwise). Group order we use: Added, Fixed, Changed, Deprecated, Removed, Performance, Security, Other. |
42 | | -- Lines describing changes MUST be sorted and begin with DipDup component name (`index: Added ...`). One of the following: ci, cli, codegen, coinbase, config, context, database, demos, deps, docs, exceptions, hasura, hooks, http, index, install, ipfs, jobs, metadata, models, projects, prometheus, sentry, tzkt. |
43 | | - |
44 | | -## Documentation |
45 | | - |
46 | | -- A page in Release Notes SHOULD accompany all major releases. |
47 | | - |
48 | | -## For maintainers |
49 | | - |
50 | | -### Security |
51 | | - |
52 | | -- GitHub alerts about dependencies that contain vulnerabilities MUST be investigated and resolved as soon as possible. |
53 | | -- Security-related bugfixes MUST be mentioned in the changelog under the "Security" section. |
54 | | - |
55 | | -### Privacy |
56 | | - |
57 | | -- Crash reporting MUST be opt-in (disabled by default) both in config and project templates. |
58 | | -- Sentry events and crash reports MUST NOT contain any sensitive information (IP addresses, hostnames, etc.) |
59 | | -- DipDup SHOULD NOT perform network requests to APIs not defined in config as datasources. Current exceptions: GitHub. |
60 | | - |
61 | | -### Docker images |
62 | | - |
63 | | -- DipDup dockerfiles use autogenerated `requirements.txt` files. Maintainers MUST run `pdm run update` script on every change in dependencies. |
64 | | -- Docker images for stable releases MUST be published on Docker Hub. They MAY also be published on GHCR. |
65 | | -- Maintainers MAY publish arbitrary images on GHCR and remove them when not needed. |
66 | | - |
67 | | -### Installer |
68 | | - |
69 | | -- Installer module MUST depend on Python stdlib only. |
70 | | - |
71 | | -### Scaffolding |
72 | | - |
73 | | -- Project templates SHOULD cover all index types available in DipDup. |
74 | | -- They also MAY contain additional features and integrations. |
75 | | - |
76 | | -### Demo projects |
77 | | - |
78 | | -- Demos are stored in `src` directory. They MUST be generated automatically from project templates using replay files. |
79 | | -- Maintainers SHOULD run `pdm demos` command regularly to ensure that demo projects are up to date. |
80 | | - |
81 | | -### Releases |
82 | | - |
83 | | -- Release versions MUST conform to [Semantic Versioning](https://semver.org/). Releases that introduce breaking changes MUST be major ones. |
84 | | -- Only the latest major version is supported in general. Critical fixes MAY be backported to the previous major release. To do so, create an `aux/X.Y.Z` branch from the latest stable tag, bump the DipDup version manually, and add a new tag. |
| 1 | +This page was moved to the [Contribution](https://dipdup.io/docs/contribution) page in docs. |
0 commit comments