Skip to content

Commit

Permalink
made documentation strict
Browse files Browse the repository at this point in the history
  • Loading branch information
jspaezp committed Sep 3, 2022
1 parent df82542 commit e3ee8b4
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 19 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ jobs:
- name: Unit testing
run: |
poetry run python -m pytest
- name: Setup Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: View Quarto version
run:
quarto --version
- name: Build Notebooks
run: bash docs/render_nbs.bash
- name: Deploy Docs
run: |
poetry run python -m mkdocs gh-deploy --strict --force
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,12 @@ jobs:
run: poetry run isort . --check
- name: Pytest
run: poetry run python -m pytest
- name: Setup Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: View Quarto version
run:
quarto --version
- name: Build Notebooks
run: bash docs/render_nbs.bash
- name: mkdocs
run: poetry run python -m mkdocs build
run: poetry run python -m mkdocs build --strict
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,10 @@ benchmarking_workflow/prosit_in

notebooks/*.csv
.Rproj.user

notebooks/**.html
docs/notebooks/**
docs/notebooks/**files
docs/**files/
site/**
notebooks/**/**.html
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,15 @@ repos:
language: system
pass_filenames: false
always_run: true
- id: build_nbs
name: build_nbs
entry: bash docs/render_nbs.bash
language: system
pass_filenames: false
always_run: true
- id: build_docs
name: build_docs
entry: poetry run python -m mkdocs build --strict
language: system
pass_filenames: false
always_run: true
18 changes: 18 additions & 0 deletions docs/render_nbs.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

set -e
set -x
# It is meant to be run from the root of the repository

OUTDIR=docs/notebooks
rm -rf ${OUTDIR}
mkdir -p ${OUTDIR}


for NOTEBOOK_NAME in $(find notebooks/docs -name '*.qmd'); do
bn=$(basename $NOTEBOOK_NAME .qmd)
poetry run quarto render ${NOTEBOOK_NAME} --to gfm --output docs/notebooks/${bn}.md $@

# Manually move the images ... this should be fixed in a future release of quarto ...
mv notebooks/docs/${bn}_files docs/notebooks/${bn}_files
done
16 changes: 5 additions & 11 deletions elfragmentador/nn_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,19 @@
learnable embeddings for the aminoacids and ions.
"""

try:
from typing import Literal, Union

LiteralFalse = Literal[False]
except ImportError:
# Python pre-3.8 compatibility
from typing import NewType, Union

LiteralFalse = NewType("LiteralFalse", bool)

import math
from typing import Literal, Tuple, Union

import pandas as pd
import torch
import torch.nn.functional as F
from pandas import DataFrame
from torch import Tensor, nn

from elfragmentador import constants

LiteralFalse = Literal[False]


class SeqPositionalEmbed(torch.nn.Module):
def __init__(self, dims_add: int = 10, max_len: int = 30, inverted=True):
Expand Down Expand Up @@ -313,7 +307,7 @@ def forward(self, seq, mods):

return seq

def as_DataFrames(self):
def as_DataFrames(self) -> Tuple[DataFrame, DataFrame]:
"""
Returns the weights as data frames.
Expand Down
4 changes: 1 addition & 3 deletions notebooks/docs/visualize_attention.qmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
______________________________________________________________________

## jupyter: python3 format: gfm
# "Visualize Attention of the default checkpoint"

```{python}
from matplotlib import pyplot as plt
Expand Down
4 changes: 1 addition & 3 deletions notebooks/docs/visualize_embeddings.qmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
______________________________________________________________________

## jupyter: python3 format: gfm
# "Visualize The embeddings of the default checkpoint"

```{python}
import elfragmentador
Expand Down
1 change: 0 additions & 1 deletion tests/dataset_tests/test_spectronaut_dataset.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pandas as pd
import torch
from pandas import DataFrame
from torch.utils.data import DataLoader

Expand Down

0 comments on commit e3ee8b4

Please sign in to comment.