Skip to content

Commit

Permalink
feat: add graphite (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBernstorff authored Jan 1, 2024
2 parents cd7e128 + ae1f0fa commit 79fa18e
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {}
},
"postStartCommand": "make install"
"postStartCommand": "pip install -e .[dev]"
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ __pycache__/
.*venv*
_build/
.tox
build/

# Coverage
**/.coverage*
Expand Down
45 changes: 33 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,39 @@
FROM python:3.10-bullseye
# Use an official Python runtime as a parent image
FROM python:3.12-bookworm

# Set the working directory to /app
WORKDIR /app
####################
# Install Graphite #
####################
ENV NVM_DIR=$HOME/.nvm
RUN mkdir -p $NVM_DIR
ENV NODE_VERSION=18.2.0

# Dev experience
COPY Makefile ./
COPY dev-requirements.txt ./
RUN --mount=type=cache,target=/root/.cache/pip make install-dev
RUN pyright .
# Install nvm with node and npm
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash \
&& . $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default

COPY requirements.txt ./
RUN --mount=type=cache,target=/root/.cache/pip make install-deps
ENV NODE_PATH=$NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH

RUN npm install -g @withgraphite/graphite-cli@stable

###########
# Pyright #
###########
WORKDIR /app
RUN pip install pyright
RUN pyright .

################
# Install deps #
################
COPY pyproject.toml ./
RUN --mount=type=cache,target=/root/.cache/pip pip install pip install --upgrade .[dev]

# Ensure pyright builds correctly.
# If run in make validate, it is run in parallel, which breaks its installation.
# Install the entire app
COPY . /app
RUN pip install .
RUN git init
8 changes: 0 additions & 8 deletions dev-requirements.txt

This file was deleted.

16 changes: 16 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,22 @@ classifiers = [
"Programming Language :: Python :: 3.11"
]
requires-python = ">=3.10"
dependencies = [
"linetimer",
"polars",
]

[project.optional-dependencies]
dev = [
"cruft==2.15.0",
"pyright==1.1.344",
"pytest==7.4.4",
"pytest-cov==4.1.0",
"pytest-xdist==3.5.0",
"pytest-sugar==0.9.7",
"diff-cover==8.0.2",
"ruff==0.1.9",
]

[project.license]
file = "LICENSE"
Expand Down
2 changes: 0 additions & 2 deletions requirements.txt

This file was deleted.

0 comments on commit 79fa18e

Please sign in to comment.