diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 5379dd3364..61b8a420a2 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -11,7 +11,8 @@ env: IMAGE_NAME: ${{ github.repository }}/agent0 jobs: - build-and-push: + docker: + name: Docker image runs-on: ubuntu-latest permissions: contents: read @@ -22,14 +23,12 @@ jobs: with: submodules: recursive token: ${{secrets.GITHUB_TOKEN}} - - name: Log in to the Container registry uses: docker/login-action@v2.2.0 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v4.5.0 @@ -40,7 +39,6 @@ jobs: type=semver,pattern={{version}} # Add the edge tag to every image to represent the latest commit to main type=edge,branch=main - - name: Build and push Docker image uses: docker/build-push-action@v4.1.0 with: diff --git a/.github/workflows/jobs.yml b/.github/workflows/jobs.yml new file mode 100644 index 0000000000..e506077343 --- /dev/null +++ b/.github/workflows/jobs.yml @@ -0,0 +1,87 @@ +name: lint and test + +on: + push: + branches: + - main + pull_request: + +jobs: + test-code: + name: Lint and test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: set up python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + token: ${{github.token}} + - name: install uv + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + - name: install venv + run: | + source $HOME/.cargo/env + uv venv .venv -p 3.10 + - name: install requirements + run: | + source $HOME/.cargo/env + source .venv/bin/activate + uv pip install --upgrade -r requirements.txt + uv pip install --upgrade -r requirements-rl.txt + uv pip install --upgrade -r requirements-dev.txt + - name: run black + run: | + source .venv/bin/activate + python -m black --config pyproject.toml --check --diff . + - name: get all Python files + id: list_files + run: | + echo "files=$(git ls-files '*.py' '*.pyi' | xargs)" >> $GITHUB_OUTPUT + - name: run Pylint on files + run: | + source .venv/bin/activate + files="${{ steps.list_files.outputs.files }}" + if [ -n "$files" ]; then + pylint --rcfile=.pylintrc $files + else + echo "No Python files found." + fi + - name: Analyse code with pyright + run: | + source .venv/bin/activate + python -m pyright $(git ls-files '*.py' '*.pyi') + - name: install node + uses: actions/setup-node@v3 + with: + node-version: 16.x + - name: install packages + uses: borales/actions-yarn@v4 + with: + cmd: install # will run `yarn install` command + env: + # A warning is thrown here unnecessarily. tracking issue here: + # https://github.com/github/vscode-github-actions/issues/222 + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # if needed + - name: install foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + - name: run pytest with coverage + run: | + source .venv/bin/activate + IN_CI=true coverage run -m pytest + - name: generate coverage report + run: | + source .venv/bin/activate + coverage xml -i + coverage html -i + - name: upload coverage report to Codecov + uses: codecov/codecov-action@v3 + with: + flags: unittests + fail_ci_if_error: true + # A warning is thrown here unnecessarily. tracking issue here: + # https://github.com/github/vscode-github-actions/issues/222 + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 4084226638..0000000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: lint - -on: - push: - branches: - - main - pull_request: - -jobs: - build: - name: lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - token: ${{github.token}} - - - name: set up python - uses: actions/setup-python@v4 - with: - python-version: "3.10" - cache: "pip" - token: ${{github.token}} - - - name: upgrade pip - run: python -m pip install --upgrade pip - - - name: install requirements - run: | - python -m pip install --upgrade -r requirements.txt - python -m pip install --upgrade -r requirements-rl.txt - python -m pip install --upgrade -r requirements-dev.txt - - - name: run black - run: python -m black --config pyproject.toml --check --diff . - - - name: get all Python files - id: list_files - run: | - echo "files=$(git ls-files '*.py' '*.pyi' | xargs)" >> $GITHUB_OUTPUT - - - name: run Pylint on files - run: | - files="${{ steps.list_files.outputs.files }}" - if [ -n "$files" ]; then - pylint --rcfile=.pylintrc $files - else - echo "No Python files found." - fi diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml deleted file mode 100644 index c723e1a030..0000000000 --- a/.github/workflows/static.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: static - -on: - push: - branches: - - main - pull_request: - -jobs: - build: - name: static - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - token: ${{github.token}} - - - name: set up python - uses: actions/setup-python@v4 - with: - python-version: "3.10" - cache: "pip" - token: ${{github.token}} - - - name: upgrade pip - run: python -m pip install --upgrade pip - - - name: install requirements - run: | - python -m pip install --upgrade -r requirements.txt - python -m pip install --upgrade -r requirements-rl.txt - python -m pip install --upgrade -r requirements-dev.txt - - - name: analysing code with pyright - run: python -m pyright $(git ls-files '*.py' '*.pyi') diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 2c01032507..0000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: test - -on: - push: - branches: - - main - pull_request: - -jobs: - build: - name: test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - token: ${{github.token}} - - - name: install node - uses: actions/setup-node@v3 - with: - node-version: 16.x - - - name: install packages - uses: borales/actions-yarn@v4 - with: - cmd: install # will run `yarn install` command - env: - # A warning is thrown here unnecessarily. tracking issue here: - # https://github.com/github/vscode-github-actions/issues/222 - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # if needed - - - name: install foundry - uses: foundry-rs/foundry-toolchain@v1 - with: - version: nightly - - - name: set up python - uses: actions/setup-python@v4 - with: - python-version: "3.10" - cache: "pip" - token: ${{github.token}} - - - name: upgrade pip - run: python -m pip install --upgrade pip - - - name: install requirements - run: | - python -m pip install --upgrade -r requirements.txt - python -m pip install --upgrade -r requirements-rl.txt - python -m pip install --upgrade -r requirements-dev.txt - - - name: run pytest with coverage - run: | - IN_CI=true coverage run -m pytest - - - name: generate coverage report - run: | - coverage xml -i - coverage html -i - - - name: upload coverage report to Codecov - uses: codecov/codecov-action@v3 - with: - flags: unittests - fail_ci_if_error: true - # A warning is thrown here unnecessarily. tracking issue here: - # https://github.com/github/vscode-github-actions/issues/222 - token: ${{ secrets.CODECOV_TOKEN }} diff --git a/lib/agent0/pyproject.toml b/lib/agent0/pyproject.toml index 97bafc005a..5064cfe693 100644 --- a/lib/agent0/pyproject.toml +++ b/lib/agent0/pyproject.toml @@ -15,29 +15,17 @@ classifiers = [ "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", ] - -[project.optional-dependencies] -# This flag installs all dependencies and should be ran when installing this subpackage in isolation -with-dependencies = ["agent0[base, lateral]"] -base = [ - "fixedpointmath", +dependencies = [ "numpy", "python-dotenv", - # will include eth- packages "web3", "hexbytes", "pandas", "nest_asyncio", "rollbar", "dill", + "fixedpointmath @ git+https://github.com/delvtech/fixedpointmath.git", ] -lateral = [ - # Lateral dependencies across subpackages are pointing to github - "hyperlogs[with-dependencies] @ git+https://github.com/delvtech/agent0.git/#subdirectory=lib/hyperlogs", - "ethpy[with-dependencies] @ git+https://github.com/delvtech/agent0.git/#subdirectory=lib/ethpy", - "chainsync[with-dependencies] @ git+https://github.com/delvtech/agent0.git/#subdirectory=lib/chainsync", -] - [build-system] requires = ["flit_core>=3.2"] diff --git a/lib/chainsync/pyproject.toml b/lib/chainsync/pyproject.toml index 31944ce5e3..1d946fcd7c 100644 --- a/lib/chainsync/pyproject.toml +++ b/lib/chainsync/pyproject.toml @@ -15,13 +15,7 @@ classifiers = [ "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", ] - -[project.optional-dependencies] -# This flag installs all dependencies and should be ran when installing this subpackage in isolation -with-dependencies = [ - "chainsync[base, lateral]" -] -base = [ +dependencies = [ "fixedpointmath", "matplotlib", "numpy", @@ -37,11 +31,6 @@ base = [ "pandas-stubs", "requests", ] -lateral = [ - # Lateral dependencies across subpackages are pointing to github - "hyperlogs[with-dependencies] @ git+https://github.com/delvtech/agent0.git/#subdirectory=lib/hyperlogs", - "ethpy[with-dependencies] @ git+https://github.com/delvtech/agent0.git/#subdirectory=lib/ethpy", -] [build-system] requires = ["flit_core>=3.2"] diff --git a/lib/ethpy/pyproject.toml b/lib/ethpy/pyproject.toml index fc769801af..17c6c5b0e4 100644 --- a/lib/ethpy/pyproject.toml +++ b/lib/ethpy/pyproject.toml @@ -15,22 +15,12 @@ classifiers = [ "License :: OSI Approved :: Apache License 2.0", "Operating System :: OS Independent", ] - -[project.optional-dependencies] -# This flag installs all dependencies and should be run when installing this subpackage in isolation -with-dependencies = [ - "ethpy[base, lateral]" -] -base = [ +dependencies = [ "fixedpointmath", "numpy", "python-dotenv", "web3", ] -lateral = [ - # Lateral dependencies across subpackages are pointing to github - "hypertypes[with-dependencies] @ git+https://github.com/delvtech/agent0.git/#subdirectory=lib/hypertypes", -] [project.urls] "Homepage" = "https://github.com/delvtech/agent0" diff --git a/lib/hyperlogs/pyproject.toml b/lib/hyperlogs/pyproject.toml index fcc42639fb..d207cf0d16 100644 --- a/lib/hyperlogs/pyproject.toml +++ b/lib/hyperlogs/pyproject.toml @@ -16,14 +16,6 @@ classifiers = [ "Operating System :: OS Independent", ] -[project.optional-dependencies] -# This flag installs all dependencies and should be ran when installing this subpackage in isolation -with-dependencies = [ - "hyperlogs[base, lateral]" -] -base = [] -lateral = [] - [build-system] requires = ["flit_core>=3.2"] build-backend = "flit_core.buildapi" diff --git a/lib/hypertypes/pyproject.toml b/lib/hypertypes/pyproject.toml index ce4e373fcf..1807304f22 100644 --- a/lib/hypertypes/pyproject.toml +++ b/lib/hypertypes/pyproject.toml @@ -10,10 +10,10 @@ classifiers = [ "License :: OSI Approved :: Apache License 2.0", "Operating System :: OS Independent", ] - -[project.optional-dependencies] -with-dependencies = ["hypertypes[base]"] -base = ["web3", "pypechain"] +dependencies = [ + "web3", + "pypechain", +] [build-system] requires = ["flit_core>=3.2"] diff --git a/requirements.txt b/requirements.txt index 8a615288f6..e4f3ce16d5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,6 @@ -e lib/chainsync[base] -e lib/ethpy[base] -e lib/hypertypes[base] ---find-links="packages/hyperdrivepy" +--find-links=packages/hyperdrivepy hyperdrivepy rollbar