Skip to content

Commit

Permalink
Adds type checking (through mypy) to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ilumsden committed Nov 14, 2024
1 parent 6179835 commit 9e44373
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 22 deletions.
21 changes: 1 addition & 20 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,11 @@ COPY requirements.txt /requirements.txt

RUN python3 -m pip install -r requirements.txt

RUN python3 -m pip install --upgrade flake8-pytest-importorskip click==8.0.4 black==24.4.2 flake8==4.0.1
RUN python3 -m pip install --upgrade flake8-pytest-importorskip click==8.0.4 black==24.4.2 flake8==4.0.1 mypy==1.13.0

RUN groupadd -g ${USER_GID} ${USERNAME} && \
adduser --disabled-password --uid ${USER_UID} --gid ${USER_GID} --gecos "" ${USERNAME} && \
echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers

USER $USERNAME

# FROM mcr.microsoft.com/devcontainers/miniconda:1-3
#
# # Copy environment.yml (if found) to a temp location so we update the environment. Also
# # copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists.
# COPY environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/
# RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \
# && rm -rf /tmp/conda-tmp
#
# COPY requirements.txt /requirements.txt
#
# RUN conda install -y python=3.9 \
# && pip install --no-cache-dir pipx \
# && pipx reinstall-all
#
#
# # [Optional] Uncomment this section to install additional OS packages.
# # RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# # && apt-get -y install --no-install-recommends <your-package-list-here>

8 changes: 7 additions & 1 deletion .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,25 @@ jobs:
python setup.py build_ext --inplace
python -m pip list
- name: Update Black
- name: Update Black and mypy
if: ${{ matrix.python-version == 3.9 }}
run: |
pip install flake8-pytest-importorskip
pip install --upgrade click==8.0.4
pip install black==24.4.2
pip install flake8==4.0.1
pip install mypy==1.13.0
- name: Lint and Format Check with Flake8 and Black
if: ${{ matrix.python-version == 3.9 }}
run: |
black --diff --check .
flake8
- name: Run type checking with mypy
if: ${{ matrix.python-version == 3.9 }}
run: |
mypy hatchet --pretty
- name: Check License Headers
run: |
Expand Down
2 changes: 1 addition & 1 deletion hatchet/graphframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ def tree(

if color is False:
try:
import IPython
import IPython # type: ignore[import-not-found]

shell = IPython.get_ipython().__class__.__name__
except ImportError:
Expand Down

0 comments on commit 9e44373

Please sign in to comment.