From 42790a37691a0f3824d8cf245d47cf6f7407b1b2 Mon Sep 17 00:00:00 2001 From: 8baller <8ball030@gmail.com> Date: Mon, 19 Aug 2024 19:14:27 +0100 Subject: [PATCH] first-commit --- Dockerfile | 32 ++++++++++++++++++++++++++++++++ Dockerfile.wip | 47 +++++++++++++++++++++++++++++++++++++++++++++++ auto_dev/fmt.py | 14 ++++---------- auto_dev/utils.py | 4 +--- pyproject.toml | 6 +----- 5 files changed, 85 insertions(+), 18 deletions(-) create mode 100644 Dockerfile create mode 100644 Dockerfile.wip diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..577e92c6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +FROM python:3.11 AS base +ENV VIRTUAL_ENV=/opt/venv +ENV PATH="$VIRTUAL_ENV/bin:$PATH" +ENV PYTHONPATH=. +RUN mkdir /app +WORKDIR /app + +RUN python3 -m venv $VIRTUAL_ENV + +RUN apt-get update && \ + apt-get install -y \ + --no-install-recommends \ + make python3-dev + +RUN pip install poetry +COPY README.md pyproject.toml poetry.lock ./ +RUN poetry run pip install setuptools wheel packaging +RUN poetry install --no-root --compile --no-dev + +COPY auto_dev auto_dev +RUN poetry install --compile --no-dev + +ENV PATH="$VIRTUAL_ENV/bin:$PATH" + + +RUN echo $VIRTUAL_ENV +RUN poetry env info +ENTRYPOINT ["poetry", "run"] +ENV PYTHONUNBUFFERED=TRUE + +CMD ["--help"] + diff --git a/Dockerfile.wip b/Dockerfile.wip new file mode 100644 index 00000000..756273cb --- /dev/null +++ b/Dockerfile.wip @@ -0,0 +1,47 @@ +FROM pypy:3.10 AS base +ENV VIRTUAL_ENV=/opt/venv +ENV PATH="$VIRTUAL_ENV/bin:$PATH" +ENV PYTHONPATH=. +ENV PYTHONUNBUFFERED=TRUE +ENV PATH="/root/.cargo/bin:$PATH" + +RUN mkdir /app +WORKDIR /app + +RUN python3 -m venv $VIRTUAL_ENV + +RUN apt-get update && \ + apt-get install -y \ + --no-install-recommends \ + make python3-dev + +RUN curl https://sh.rustup.rs -sSf | bash -s -- -y + +RUN pip install poetry +COPY README.md pyproject.toml poetry.lock ./ +RUN poetry run pip install -U setuptools wheel packaging pip + + +# We need to make sure we have all the necessary deps to build cffi +RUN apt-get install build-essential curl gcc libffi-dev libssl-dev -y + +# Get Rust + +RUN rustc --version +RUN cargo install --locked maturin + +RUN poetry run pip install -U setuptools yarl +RUN poetry install --only-main + +COPY auto_dev auto_dev +RUN poetry install + +RUN poetry run python -m pip install maturin + + + + +ENTRYPOINT ["poetry", "run"] + +CMD ["--help"] + diff --git a/auto_dev/fmt.py b/auto_dev/fmt.py index b9180539..64729966 100644 --- a/auto_dev/fmt.py +++ b/auto_dev/fmt.py @@ -4,6 +4,8 @@ from multiprocessing import Pool +import isort +import isort.files import requests from rich.progress import track @@ -74,16 +76,8 @@ def run_black(path, verbose=False): @staticmethod def run_isort(path, verbose=False): """Run isort on the path.""" - command = CommandExecutor( - [ - "poetry", - "run", - "isort", - str(path), - ] - ) - result = command.execute(verbose=verbose) - return result + changed = isort.file(str(path)) + return not changed @staticmethod def run_autoflake8(path, verbose=False): diff --git a/auto_dev/utils.py b/auto_dev/utils.py index 8189c8a4..94467492 100644 --- a/auto_dev/utils.py +++ b/auto_dev/utils.py @@ -32,9 +32,7 @@ def get_logger(name=__name__, log_level="INFO"): ) # We set the time to just the 24 hours minutes and seconds datefmt = "%H:%M:%S" - logging.basicConfig(level="NOTSET", - datefmt=datefmt, - handlers=[handler]) + logging.basicConfig(level="NOTSET", datefmt=datefmt, handlers=[handler]) log = logging.getLogger(name) log.setLevel(log_level) diff --git a/pyproject.toml b/pyproject.toml index f5441206..ca47047f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,10 +24,6 @@ classifiers = [ [[tool.poetry.packages]] include = "auto_dev" -[[tool.poetry.packages]] -include = "tests" -format = "sdist" - [tool.black] line-length = 120 skip-string-normalization = true @@ -52,8 +48,8 @@ open-aea-ledger-ethereum = "==1.55.0" open-aea-ledger-solana= "==1.55.0" open-aea-ledger-cosmos = "==1.55.0" open-aea-cli-ipfs = "==1.55.0" -web3 = "<7,>=6.0.0" ipfshttpclient = "==0.8.0a2" +web3 = "<7,>=6.0.0" typing_extensions = ">=3.10.0.2" protobuf = "<4.25.0,>=4.21.6" hypothesis = "==6.21.6"