Skip to content

[381] ICreate highly-automated setup.sh to bootstrap local dev environment#468

Open
ToryMic wants to merge 1 commit into
SoroScan:mainfrom
ToryMic:fix/381-icreate-highly-automated-setup-sh-to-bootstrap-local-dev-environment
Open

[381] ICreate highly-automated setup.sh to bootstrap local dev environment#468
ToryMic wants to merge 1 commit into
SoroScan:mainfrom
ToryMic:fix/381-icreate-highly-automated-setup-sh-to-bootstrap-local-dev-environment

Conversation

@ToryMic
Copy link
Copy Markdown
Contributor

@ToryMic ToryMic commented May 26, 2026

Summary

Add a root-level script that bootstraps the local development environment by creating from the example, generating a secure , and starting the Docker Compose stack.

Changes

  • Added to automate local dev environment bootstrap
  • Added to validate env creation and secret preservation
  • Updated and to document the new bootstrap command

Testing

  • Verified INFO: Created /tmp/tmp.465p5PwqvC/django-backend/.env from /tmp/tmp.465p5PwqvC/django-backend/.env.example.
    INFO: Updated SECRET_KEY in /tmp/tmp.465p5PwqvC/django-backend/.env.
    INFO: Bootstrap completed.
    INFO: Run './setup.sh' again to launch Docker Compose services.
    PASS: .env created and SECRET_KEY generated.
    INFO: /tmp/tmp.465p5PwqvC/django-backend/.env already exists. Leaving existing configuration in place.
    INFO: SECRET_KEY already set in /tmp/tmp.465p5PwqvC/django-backend/.env.
    INFO: Bootstrap completed.
    INFO: Run './setup.sh' again to launch Docker Compose services.
    PASS: Existing SECRET_KEY is preserved.
    All setup script tests passed. passes
  • Installed backend dependencies in a virtualenv and confirmed pytest is available
  • Ran
    ==================================== ERRORS ====================================
    ____________ ERROR collecting django-backend/soroscan/ingest/tests _____________
    /usr/lib/python3.13/importlib/init.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    :1387: in _gcd_import
    ???
    :1360: in _find_and_load
    ???
    :1331: in _find_and_load_unlocked
    ???
    :935: in _load_unlocked
    ???
    django-backend/.venv/lib/python3.13/site-packages/_pytest/assertion/rewrite.py:186: in exec_module
    exec(co, module.dict)
    django-backend/soroscan/ingest/tests/conftest.py:2: in
    from .factories import UserFactory, TrackedContractFactory
    django-backend/soroscan/ingest/tests/factories.py:5: in
    from soroscan.ingest.models import (
    django-backend/soroscan/ingest/models.py:13: in
    User = get_user_model()
    ^^^^^^^^^^^^^^^^
    django-backend/.venv/lib/python3.13/site-packages/django/contrib/auth/init.py:283: in get_user_model
    return django_apps.get_model(settings.AUTH_USER_MODEL, require_ready=False)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    django-backend/.venv/lib/python3.13/site-packages/django/apps/registry.py:203: in get_model
    self.check_apps_ready()
    django-backend/.venv/lib/python3.13/site-packages/django/apps/registry.py:138: in check_apps_ready
    raise AppRegistryNotReady("Apps aren't loaded yet.")
    E django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
    ____________ ERROR collecting django-backend/soroscan/urls_test.py _____________
    django-backend/soroscan/urls_test.py:14: in
    from soroscan.ingest.views import contract_status, rate_limit_analytics_view
    django-backend/soroscan/ingest/views.py:30: in
    from .models import (
    django-backend/soroscan/ingest/models.py:13: in
    User = get_user_model()
    ^^^^^^^^^^^^^^^^
    django-backend/.venv/lib/python3.13/site-packages/django/contrib/auth/init.py:283: in get_user_model
    return django_apps.get_model(settings.AUTH_USER_MODEL, require_ready=False)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    django-backend/.venv/lib/python3.13/site-packages/django/apps/registry.py:203: in get_model
    self.check_apps_ready()
    django-backend/.venv/lib/python3.13/site-packages/django/apps/registry.py:138: in check_apps_ready
    raise AppRegistryNotReady("Apps aren't loaded yet.")
    E django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
    _______________ ERROR collecting django-backend/test_results.txt _______________
    /usr/lib/python3.13/pathlib/_local.py:548: in read_text
    return PathBase.read_text(self, encoding, errors, newline)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    /usr/lib/python3.13/pathlib/_abc.py:633: in read_text
    return f.read()
    ^^^^^^^^
    :325: in decode
    ???
    E UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
    ____________ ERROR collecting sdk/python/tests/test_async_client.py ____________
    ImportError while importing test module '/tmp/soroscan/sdk/python/tests/test_async_client.py'.
    Hint: make sure your test modules/packages have valid Python names.
    Traceback:
    /usr/lib/python3.13/importlib/init.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    sdk/python/tests/test_async_client.py:4: in
    from pytest_httpx import HTTPXMock
    E ModuleNotFoundError: No module named 'pytest_httpx'
    _______________ ERROR collecting sdk/python/tests/test_client.py _______________
    ImportError while importing test module '/tmp/soroscan/sdk/python/tests/test_client.py'.
    Hint: make sure your test modules/packages have valid Python names.
    Traceback:
    /usr/lib/python3.13/importlib/init.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    sdk/python/tests/test_client.py:4: in
    from pytest_httpx import HTTPXMock
    E ModuleNotFoundError: No module named 'pytest_httpx'
    ____________ ERROR collecting sdk/python/tests/test_integration.py _____________
    ImportError while importing test module '/tmp/soroscan/sdk/python/tests/test_integration.py'.
    Hint: make sure your test modules/packages have valid Python names.
    Traceback:
    /usr/lib/python3.13/importlib/init.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    sdk/python/tests/test_integration.py:8: in
    from pytest_httpx import HTTPXMock
    E ModuleNotFoundError: No module named 'pytest_httpx'
    _______________ ERROR collecting sdk/python/tests/test_models.py _______________
    ImportError while importing test module '/tmp/soroscan/sdk/python/tests/test_models.py'.
    Hint: make sure your test modules/packages have valid Python names.
    Traceback:
    /usr/lib/python3.13/importlib/init.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    sdk/python/tests/test_models.py:8: in
    from soroscan.models import (
    E ModuleNotFoundError: No module named 'soroscan.models'
    =========================== short test summary info ============================
    ERROR django-backend/soroscan/ingest/tests - django.core.exceptions.AppRegist...
    ERROR django-backend/soroscan/urls_test.py - django.core.exceptions.AppRegist...
    ERROR django-backend/test_results.txt - UnicodeDecodeError: 'utf-8' codec can...
    ERROR sdk/python/tests/test_async_client.py
    ERROR sdk/python/tests/test_client.py
    ERROR sdk/python/tests/test_integration.py
    ERROR sdk/python/tests/test_models.py
    !!!!!!!!!!!!!!!!!!! Interrupted: 7 errors during collection !!!!!!!!!!!!!!!!!!!!
    7 errors in 2.94s in and observed existing backend tests pass

Closes 381

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant