Skip to content

Commit

Permalink
Initial release (#1)
Browse files Browse the repository at this point in the history
* Initial commit

* Cleanup config

* Generate handlers

* Split codegen module

* Init command

* Lint, fix tests

* Create package if not exists

* Add some tests

* Docs

* Rename project

* Rename project

* CI, docs

* Tests

* Tests

* Another test

* Mode tests

* Logging readme

* Match datasources by name

* Match datasources by name

* Lint, fix CI

* CLI group, fix codegen

* More tests

* Fix codegen test

* Add jsonschema codegen

* Add support for multiple operation indexes

* Rename default config to dipdup.yml

* Pass operations to handler, fix codegen

* Drop Transaction model

* Save hash for each index, drop database on configuration change

* fix typo

* Drop database on schema change, some notes in readme

* Process reorg messages

* Fetch schemas from datasource on codegen

* Test codegen results validity

Co-authored-by: m-kus <[email protected]>
  • Loading branch information
droserasprout and m-kus authored Apr 5, 2021
1 parent cefbb77 commit 5f2f8e9
Show file tree
Hide file tree
Showing 85 changed files with 5,716 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[bumpversion]
current_version = 0.0.0
commit = True
tag = True
tag_name = {new_version}

[bumpversion:file:pyproject.toml]
search = version = "{current_version}"
replace = version = "{new_version}"

[bumpversion:file:src/dipdup/__init__.py]
search = __version__ = '{current_version}'
replace = __version__ = '{new_version}'
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
dist/
docs/
examples/
assets/
.pytest_cache
.ipynb_checkpoints
*.egg-info
scripts
tests
*.ipynb
*.json
*.zip
54 changes: 54 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Release
on:
push:
tags:
- '*.*.*'

jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- uses: actions/checkout@master
- name: set env
run: echo ::set-env name=RELEASE_VERSION::${GITHUB_REF#refs/*/}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8.x'
- uses: snok/[email protected]
- name: Install dependencies
run: |
sudo apt-get update -q
sudo apt-get install libsodium-dev libsecp256k1-dev libgmp-dev -y
poetry install -v
- name: Run tests
run: poetry run pytest tests/
- name: Poetry publish
run: |
poetry config http-basic.pypi __token__ ${{secrets.PYPI_TOKEN}}
poetry build
poetry publish
- name: Build github release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
- name: telegram notification
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
Pytezos ${{ env.RELEASE_VERSION }} has been released 🎉
More info at https://github.com/baking-bad/pytezos/releases/tag/${{ env.RELEASE_VERSION }}
- name: slack notification
uses: Ilshidur/action-slack@master
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
with:
args: |
Pytezos ${{ env.RELEASE_VERSION }} has been released 🎉
More info at https://github.com/baking-bad/pytezos/releases/tag/${{ env.RELEASE_VERSION }}
33 changes: 33 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Tests
on: push

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.6.x'
- uses: snok/[email protected]
- name: Install dependencies
run: |
sudo apt-get update -q
sudo apt-get install libsodium-dev libsecp256k1-dev libgmp-dev -y
- name: Install project
run: make install
- name: Run lint
run: make lint
- name: Run tests
run: make test
# - name: Make docs
# if: github.ref == 'refs/heads/master'
# run: poetry run make docs
# - name: Deploy to GH Pages
# if: github.ref == 'refs/heads/master'
# uses: peaceiris/actions-gh-pages@v3
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: ./docs/build/html
146 changes: 146 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
*.ipynb
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

.vscode
.idea

*sqlite3*

.noseids
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "tests/unit_tests/test_michelson/test_repl/tzt"]
path = tests/unit_tests/test_michelson/test_repl/tzt
url = https://gitlab.com/tezos/tzt-reference-test-suite.git
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM python:3.8-slim-buster

RUN apt update && \
apt install -y make git && \
rm -rf /var/lib/apt/lists/*
RUN pip install poetry
RUN useradd -ms /bin/bash dipdup

RUN mkdir /home/dipdup/source
COPY Makefile pyproject.toml poetry.lock README.md /home/dipdup/source/
# We want to copy our code at the last layer but not to break poetry's "packages" section
RUN mkdir -p /home/dipdup/source/src/dipdup && \
touch /home/dipdup/source/src/dipdup/__init__.py

WORKDIR /home/dipdup/source
RUN poetry config virtualenvs.create false
RUN make install DEV=0

COPY . /home/dipdup/source/
RUN chown -R dipdup /home/dipdup/

USER dipdup

WORKDIR /home/dipdup/
EXPOSE 8888
ENTRYPOINT [ "python", "-m", "dipdup"]
53 changes: 53 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
.ONESHELL:
.PHONY: docs
.DEFAULT_GOAL: all

DEV ?= 1

all: install lint test cover
lint: isort black pylint mypy

debug:
pip install . --force --no-deps

install:
poetry install `if [ "${DEV}" = "0" ]; then echo "--no-dev"; fi`

isort:
poetry run isort src tests

black:
poetry run black src tests

pylint:
poetry run pylint src tests || poetry run pylint-exit $$?

mypy:
poetry run mypy src tests

test:
poetry run pytest --cov-report=term-missing --cov=dipdup --cov-report=xml -v tests

cover:
poetry run diff-cover coverage.xml

build:
poetry build

image:
docker build . -t dipdup

release-patch:
bumpversion patch
git push --tags
git push

release-minor:
bumpversion minor
git push --tags
git push

release-major:
bumpversion major
git push --tags
git push
Loading

0 comments on commit 5f2f8e9

Please sign in to comment.