Skip to content

Instantly share code, notes, and snippets.

@0x666c6f
Last active September 28, 2022 20:15
Show Gist options
  • Select an option

  • Save 0x666c6f/e0fa9ed2e5432d71df9823d87ffe9b2c to your computer and use it in GitHub Desktop.

Select an option

Save 0x666c6f/e0fa9ed2e5432d71df9823d87ffe9b2c to your computer and use it in GitHub Desktop.
Feedback on new Dipdup installer and project generator

Install

❯ python -c \
    "$(curl -sSL https://raw.githubusercontent.com/dipdup-net/dipdup/aux/more-pipx/src/dipdup/install.py)" \
    --ref aux/more-pipx
=> Welcome to DipDup installer
=> Installing pipx
  WARNING: The script userpath is installed in '/XXXX/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  NOTE: The current PATH contains path(s) starting with `~`, which may not be expanded by all applications.
  WARNING: The script pipx is installed in '/XXXX/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  NOTE: The current PATH contains path(s) starting with `~`, which may not be expanded by all applications.
Success! Added /XXXX/.local/bin to the PATH environment variable.

Consider adding shell completions for pipx. Run 'pipx completions' for instructions.

You will need to open a new terminal or re-login for the PATH changes to take effect.

Otherwise pipx is ready to go! ✨ 🌟 ✨
Traceback (most recent call last):
  File "<string>", line 193, in <module>
  File "<string>", line 184, in cli
  File "<string>", line 102, in install
  File "<string>", line 87, in get_pipx_packages
  File "<string>", line 22, in run
  File "/XXXX/.pyenv/versions/3.10.3/lib/python3.10/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'pipx list --short' returned non-zero exit status 127.

No problem with the command, except I had an error because the pipx install location was not in my path. After running source ~/.zshrc everything was fine

Creating a new project

❯ mkdir dipdup-test
❯ cd dipdup-test
❯ dipdup new
Traceback (most recent call last):
  File "/Users/florianpautot/.pyenv/versions/3.10.3/bin/dipdup", line 5, in <module>
    from dipdup.cli import cli
  File "/Users/florianpautot/.pyenv/versions/3.10.3/lib/python3.10/site-packages/dipdup/cli.py", line 32, in <module>
    from dipdup.codegen import DipDupCodeGenerator
  File "/Users/florianpautot/.pyenv/versions/3.10.3/lib/python3.10/site-packages/dipdup/codegen.py", line 19, in <module>
    from dipdup.config import BigMapIndexConfig
  File "/Users/florianpautot/.pyenv/versions/3.10.3/lib/python3.10/site-packages/dipdup/config.py", line 54, in <module>
    from dipdup.exceptions import ConfigInitializationException
  File "/Users/florianpautot/.pyenv/versions/3.10.3/lib/python3.10/site-packages/dipdup/exceptions.py", line 12, in <module>
    from tortoise.models import Model
  File "/Users/florianpautot/.pyenv/versions/3.10.3/lib/python3.10/site-packages/tortoise/models.py", line 25, in <module>
    from tortoise import connections
ImportError: cannot import name 'connections' from 'tortoise' (/Users/florianpautot/.pyenv/versions/3.10.3/lib/python3.10/site-packages/tortoise/__init__.py)

I got an error during the install because it seems it was missing the tortoise dependency

Running tortoise-orm instllation did not work as it seems it was already installed correctly

❯ pip3 install tortoise-orm

Requirement already satisfied: tortoise-orm in /XXXX/.pyenv/versions/3.10.3/lib/python3.10/site-packages (0.19.2)
Requirement already satisfied: pytz in /XXXX/.pyenv/versions/3.10.3/lib/python3.10/site-packages (from tortoise-orm) (2022.2.1)
Requirement already satisfied: pypika-tortoise<0.2.0,>=0.1.6 in /XXXX/.pyenv/versions/3.10.3/lib/python3.10/site-packages (from tortoise-orm) (0.1.6)
Requirement already satisfied: iso8601<2.0.0,>=1.0.2 in /XXXX/.pyenv/versions/3.10.3/lib/python3.10/site-packages (from tortoise-orm) (1.0.2)
Requirement already satisfied: aiosqlite<0.18.0,>=0.16.0 in /XXXX/.pyenv/versions/3.10.3/lib/python3.10/site-packages (from tortoise-orm) (0.17.0)
Requirement already satisfied: typing_extensions>=3.7.2 in /XXXX/.pyenv/versions/3.10.3/lib/python3.10/site-packages (from aiosqlite<0.18.0,>=0.16.0->tortoise-orm) (4.3.0)

Troubleshooting

Tried injecting tortoise-orm to dipdup with pipx

❯ pipx inject dipdup tortoise-orm
  injected package tortoise-orm into venv dipdup
done! ✨ 🌟 ✨

Command worked, but it did not change anything


Tried injecting tortoise-orm to datamodel-code-generator with pipx

❯ pipx inject datamodel-code-generator tortoise-orm
  injected package tortoise-orm into venv datamodel-code-generator
done! ✨ 🌟 ✨

Command worked, but it did not change anything


Tried running dipdup directly through pipx, and it seems to work:

❯ pipx run dipdup new
⚠️  dipdup is already on your PATH and installed at /Users/florianpautot/.pyenv/shims/dipdup. Downloading and running anyway.
Usage: dipdup [OPTIONS] COMMAND [ARGS]...
Try 'dipdup --help' for help.

Error: No such command 'new'.

Tried pipx reinstall-all, it worked, but did not solve the problem

❯ pipx reinstall-all
uninstalled datamodel-code-generator! ✨ 🌟 ✨
⚠️  Note: datamodel-codegen was already on your PATH at /Users/florianpautot/.pyenv/shims/datamodel-codegen
  installed package datamodel-code-generator 0.13.1, installed using Python 3.10.3
  These apps are now globally available
    - datamodel-codegen
done! ✨ 🌟 ✨
  injected package tortoise-orm into venv datamodel-code-generator
done! ✨ 🌟 ✨
uninstalled poetry! ✨ 🌟 ✨
⚠️  Note: poetry was already on your PATH at /opt/homebrew/bin/poetry
  installed package poetry 1.2.1, installed using Python 3.10.3
  These apps are now globally available
    - poetry
done! ✨ 🌟 ✨
uninstalled dipdup! ✨ 🌟 ✨
⚠️  Note: dipdup was already on your PATH at /Users/florianpautot/.pyenv/shims/dipdup
  installed package dipdup 6.1.3, installed using Python 3.10.3
  These apps are now globally available
    - dipdup
    - dipdup-install
done! ✨ 🌟 ✨
  injected package tortoise-orm into venv dipdup
done! ✨ 🌟 ✨
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment