Skip to content

Commit 945bcc3

Browse files
meta: 7.0.0rc1 release (#744)
Co-authored-by: Vladimir Bobrikov <[email protected]>
1 parent ae00104 commit 945bcc3

File tree

236 files changed

+2785
-2993
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

236 files changed

+2785
-2993
lines changed

.github/workflows/release.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ jobs:
88
release:
99
name: Release
1010
runs-on: ubuntu-22.04
11+
env:
12+
DOCKER_REGISTRY: ghcr.io
13+
DOCKER_IMAGE_NAME: ${{ github.repository }}
14+
1115
steps:
1216
- name: Check out the repo
1317
uses: actions/checkout@v3
@@ -29,11 +33,29 @@ jobs:
2933
username: ${{ secrets.DOCKER_USERNAME }}
3034
password: ${{ secrets.DOCKER_PASSWORD }}
3135

36+
- name: Log in to the registry
37+
uses: docker/login-action@v1
38+
with:
39+
registry: ${{ env.DOCKER_REGISTRY }}
40+
username: ${{ github.actor }}
41+
password: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Tag image for ghcr registry
44+
uses: docker/metadata-action@v3
45+
with:
46+
images: dipdup/dipdup
47+
flavor: |
48+
latest=false
49+
tags: |
50+
${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}/dipdup
51+
3252
- name: Set up metadata
3353
id: meta
3454
uses: docker/metadata-action@v3
3555
with:
36-
images: dipdup/dipdup
56+
images: |
57+
dipdup/dipdup
58+
${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}/dipdup
3759
flavor: |
3860
latest=false
3961
tags: |

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog], and this project adheres to [Semantic Versioning].
66

7-
## [Unreleased]
7+
## [7.0.0rc1] - 2023-07-21
88

99
### Added
1010

@@ -1089,7 +1089,8 @@ This release contains no changes except for the version number.
10891089
[semantic versioning]: https://semver.org/spec/v2.0.0.html
10901090

10911091
<!-- Versions -->
1092-
[Unreleased]: https://github.com/dipdup-io/dipdup/compare/6.5.9...HEAD
1092+
[Unreleased]: https://github.com/dipdup-io/dipdup/compare/7.0.0rc1...HEAD
1093+
[7.0.0rc1]: https://github.com/dipdup-io/dipdup/compare/6.5.9...7.0.0rc1
10931094
[6.5.9]: https://github.com/dipdup-io/dipdup/compare/6.5.8...6.5.9
10941095
[6.5.8]: https://github.com/dipdup-io/dipdup/compare/6.5.7...6.5.8
10951096
[6.5.7]: https://github.com/dipdup-io/dipdup/compare/6.5.6...6.5.7

CONTRIBUTING.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,6 @@ We use `isort` and `black` for autoformatting, `ruff` for linting, and `mypy` fo
7878
- Demos are stored in `demos` root directory. They MUST be generated automatically from project templates using replay files.
7979
- Maintainers SHOULD run `make demos replays` command regularly to ensure that demo projects are up to date.
8080

81-
```admonish warning title=""
82-
This page or paragraph is yet to be written. Come back later.
83-
```
84-
8581
## Releases
8682

8783
- Release versions MUST conform to [Semantic Versioning](https://semver.org/). Releases that introduce breaking changes MUST be major ones.

README.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,7 @@
99
[![GitHub issues](https://img.shields.io/github/issues/dipdup-io/dipdup?color=2c2c2c)](https://github.com/dipdup-io/dipdup/issues)
1010
[![GitHub pull requests](https://img.shields.io/github/issues-pr/dipdup-io/dipdup?color=2c2c2c)](https://github.com/dipdup-io/dipdup/pulls)
1111

12-
```text
13-
____ _ ____
14-
/ __ \ (_)____ / __ \ __ __ ____
15-
/ / / // // __ \ / / / // / / // __ \
16-
/ /_/ // // /_/ // /_/ // /_/ // /_/ /
17-
/_____//_// .___//_____/ \__,_// .___/
18-
/_/ /_/
19-
```
12+
<h3 align="center"><img src="https://actual-docs.interface-1bp.pages.dev/_nuxt/logo.9b02ab5e.svg" alt="DipDup logo"></h3>
2013

2114
DipDup is a Python framework for building smart contract indexers. It helps developers focus on business logic instead of writing a boilerplate to store and serve data. DipDup-based indexers are selective, which means only required data is requested. This approach allows to achieve faster indexing times and decreased load on underlying APIs.
2215

@@ -26,7 +19,7 @@ DipDup is a Python framework for building smart contract indexers. It helps deve
2619

2720
* **Want to participate?** Vote for [open issues](https://github.com/dipdup-io/dipdup/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc), join [discussions](https://github.com/dipdup-io/dipdup/discussions) or [become a sponsor](https://github.com/sponsors/dipdup-io).
2821

29-
* **Have a question?** Join our [Discord](https://discord.gg/sfqjBpmU) or tag @dipdup_io on [Twitter](https://twitter.com/dipdup_io).
22+
* **Have a question?** Join our [Discord](https://discord.gg/NbANhqCJHA) or tag @dipdup_io on [Twitter](https://twitter.com/dipdup_io).
3023

3124
This project is maintained by the [Baking Bad](https://bakingbad.dev/) team.
3225
<br>

docs/.gitignore

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 78 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1+
---
2+
title: "Quickstart"
3+
description: "This page will guide you through the steps to get your first selective indexer up and running in a few minutes without getting too deep into the details."
4+
navigation.icon: "stars"
5+
---
6+
17
# Quickstart
28

39
This page will guide you through the steps to get your first selective indexer up and running in a few minutes without getting too deep into the details.
410

511
Let's create an indexer for the [tzBTC FA1.2 token contract](https://tzkt.io/KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn/operations/). Our goal is to save all token transfers to the database and then calculate some statistics of its holders' activity.
612

13+
`demo_token` demo is discussed in this guide; you can find it in the list of available templates when running `dipdup new` command.
14+
715
A modern Linux/macOS distribution with Python 3.11 installed is required to run DipDup.
816

917
## Create a new project
@@ -12,25 +20,30 @@ A modern Linux/macOS distribution with Python 3.11 installed is required to run
1220

1321
You can initialize a hello-world project interactively by choosing configuration options in the terminal. The following command will install DipDup for the current user:
1422

15-
```shell
16-
curl -Lsf https://dipdup.io/install.py | python
23+
```shell [Terminal]
24+
curl -Lsf https://dipdup.io/install.py | python3.11
1725
```
1826

1927
Now, let's create a new project:
2028

21-
```shell
29+
```shell [Terminal]
2230
dipdup new
2331
```
2432

2533
Follow the instructions; the project will be created in the current directory. You can skip reading the rest of this page and slap `dipdup run` instead.
2634

2735
### From scratch
2836

29-
Currently, we mainly use [Poetry](https://python-poetry.org) for dependency management in DipDup. If you prefer hatch, pdb, piptools or others — use them instead. Below are some snippets to get you started.
37+
If you don't want to use our installer, you can install DipDup manually. You can use any Python package manager you like, but we recommend [PDM](https://pdm.fming.dev/latest/).
3038

31-
```shell
39+
```shell [Terminal]
3240
# Create a new project directory
33-
mkdir dipdup_indexer; cd dipdup_indexer
41+
mkdir {{ project.package }}; cd {{ project.package }}
42+
43+
# PDM
44+
pdm init --python ">=3.11,<3.12"
45+
pdm add dipdup
46+
pdm venv activate
3447

3548
# Plain pip
3649
python -m venv .venv
@@ -43,138 +56,124 @@ poetry add dipdup
4356
poetry shell
4457
```
4558

46-
::banner{type="note"}
47-
48-
* {{ #summary getting-started/installation.md}}
49-
* [Poetry documentation](https://python-poetry.org/docs/)
50-
::
51-
5259
## Write a configuration file
5360

54-
DipDup configuration is stored in YAML files of a specific format. Create a new file named `dipdup.yaml` in your current working directory with the following content:
61+
DipDup configuration is stored in YAML files of a specific format. Create a new file named `dipdup.yaml` in the project root with the following content:
5562

5663
```yaml [dipdup.yaml]
5764
{{ #include ../src/demo_token/dipdup.yaml }}
5865
```
5966

60-
::banner{type="note"}
61-
62-
* {{ #summary getting-started/templates-and-variables.md}}
63-
* {{ #summary config/README.md}}
64-
::
65-
66-
## Initialize project tree
67+
## Generate types and stubs
6768

6869
Now it's time to generate typeclasses and callback stubs. Run the following command:
6970

70-
```shell
71+
```shell [Terminal]
7172
dipdup init
7273
```
7374

7475
DipDup will create a Python package `demo_token` having the following structure:
7576

76-
```
77-
demo_token
77+
```shell
78+
demo_token [src/demo_token]
79+
├── abi
80+
├── configs
81+
│ ├── dipdup.compose.yaml
82+
│ ├── dipdup.sqlite.yaml
83+
│ ├── dipdup.swarm.yaml
84+
│ └── replay.yaml
85+
├── deploy
86+
│ ├── .env.default
87+
│ ├── Dockerfile
88+
│ ├── compose.sqlite.yaml
89+
│ ├── compose.swarm.yaml
90+
│ ├── compose.yaml
91+
│ ├── sqlite.env.default
92+
│ └── swarm.env.default
7893
├── graphql
7994
├── handlers
80-
│ ├── __init__.py
95+
│ ├── on_balance_update.py
8196
│ ├── on_mint.py
8297
│ └── on_transfer.py
98+
├── hasura
8399
├── hooks
84-
│ ├── __init__.py
100+
│ ├── on_index_rollback.py
85101
│ ├── on_reindex.py
86102
│ ├── on_restart.py
87-
│ ├── on_index_rollback.py
88103
│ └── on_synchronized.py
89-
├── __init__.py
90-
── models.py
104+
├── models
105+
│ └── __init__.py
91106
├── sql
92-
│ ├── on_reindex
93-
│ ├── on_restart
94-
│ ├── on_index_rollback
95-
│ └── on_synchronized
96-
└── types
97-
├── __init__.py
98-
└── tzbtc
99-
├── __init__.py
100-
├── parameter
101-
│ ├── __init__.py
102-
│ ├── mint.py
103-
│ └── transfer.py
104-
└── storage.py
107+
├── types
108+
│ ├── tzbtc/tezos_parameters/mint.py
109+
│ ├── tzbtc/tezos_parameters/transfer.py
110+
│ └── tzbtc/tezos_storage.py
111+
├── py.typed
112+
├── __init__.py
113+
└── pyproject.toml
105114
```
106115

107-
That's a lot of files and directories! But don't worry, we will need only `models.py` and `handlers` modules in this guide.
108-
109-
::banner{type="note"}
110-
111-
* {{ #summary getting-started/project-package.md}}
112-
* {{ #summary cli-reference.md#init}}
113-
::
116+
That's a lot of files and directories! But don't worry, we will need only `models` and `handlers` sections in this guide.
114117

115118
## Define data models
116119

117120
Our schema will consist of a single model `Holder` having several fields:
118121

119-
* `address` — account address
120-
* `balance` — in tzBTC
121-
* `volume` — total transfer/mint amount bypassed
122-
* `tx_count` — number of transfers/mints
123-
* `last_seen` — time of the last transfer/mint
122+
- `address` — account address
123+
- `balance` — in tzBTC
124+
- `volume` — total transfer/mint amount bypassed
125+
- `tx_count` — number of transfers/mints
126+
- `last_seen` — time of the last transfer/mint
124127

125-
Put the following content in the `models.py` file:
128+
Put the following content in the `models/__init__.py` file:
126129

127-
```python
130+
```python [models/__init__.py]
128131
{{ #include ../src/demo_token/models/__init__.py }}
129132
```
130133

131-
::banner{type="note"}
132-
133-
* {{ #summary getting-started/defining-models.md}}
134-
* [Tortoise ORM documentation](https://tortoise-orm.readthedocs.io/en/latest/)
135-
* [Tortoise ORM examples](https://tortoise-orm.readthedocs.io/en/latest/examples.html)
136-
::
137-
138134
## Implement handlers
139135

140136
Everything's ready to implement an actual indexer logic.
141137

142138
Our task is to index all the balance updates, so we'll start with a helper method to handle them. Create a file named `on_balance_update.py` in the `handlers` package with the following content:
143139

144-
```python
140+
```python [handlers/on_balance_update.py]
145141
{{ #include ../src/demo_token/handlers/on_balance_update.py }}
146142
```
147143

148144
Three methods of tzBTC contract can alter token balances — `transfer`, `mint`, and `burn`. The last one is omitted in this tutorial for simplicity. Edit corresponding handlers to call the `on_balance_update` method with data from matched operations:
149145

150-
`on_transfer.py`
151-
152-
```python
146+
```python [handlers/on_transfer.py]
153147
{{ #include ../src/demo_token/handlers/on_transfer.py }}
154148
```
155149

156-
`on_mint.py`
157-
158-
```python
150+
```python [handlers/on_mint.py]
159151
{{ #include ../src/demo_token/handlers/on_mint.py }}
160152
```
161153

162154
And that's all! We can run the indexer now.
163155

164-
::banner{type="note"}
165-
166-
* {{ #summary getting-started/implementing-handlers.md}}
167-
::
156+
## Next steps
168157

169-
## Run your indexer
158+
Run the indexer in-memory:
170159

171-
```shell
160+
```bash
172161
dipdup run
173162
```
174163

175-
DipDup will fetch all the historical data and then switch to realtime updates. Your application data has been successfully indexed!
164+
Store data in SQLite database:
165+
166+
```bash
167+
dipdup -c . -c configs/dipdup.sqlite.yaml run
168+
```
176169

177-
::banner{type="note"}
170+
Or spawn a docker-compose stack:
178171

179-
* {{ #summary cli-reference.md}}
180-
::
172+
```bash
173+
cd deploy
174+
cp .env.default .env
175+
# Edit .env before running
176+
docker-compose up
177+
```
178+
179+
DipDup will fetch all the historical data and then switch to realtime updates. Your application data has been successfully indexed!

0 commit comments

Comments
 (0)