Skip to content

Commit

Permalink
ci: fix doc
Browse files Browse the repository at this point in the history
  • Loading branch information
js2264 committed Jul 31, 2024
1 parent f361c1b commit 81e30d4
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 161 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
pull_request:
branches: [ devel ]

permissions:
contents: write

jobs:

Test:
Expand All @@ -31,10 +34,31 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install package and dependencies on ${{ matrix.os }}
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
- name: Run tests on ${{ matrix.os }}
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
# stop the build if there are Python syntax errors or undefined names
ruff check . --select=E9,F63,F7,F82
pytest
- name: Buid Sphinx doc on ${{ matrix.os }}
if: runner.os == 'Linux' && ${{ github.event_name == 'push' && github.ref == 'refs/heads/devel' }} && ${{ matrix.python-version == '3.12'}}
run: |
sudo apt-get update && sudo apt-get -y install make
pip install -e .[dev,docs]
make -C docs html
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
if: runner.os == 'Linux' && ${{ github.event_name == 'push' && github.ref == 'refs/heads/devel' }} && ${{ matrix.python-version == '3.12'}}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/build/html
force_orphan: true
38 changes: 0 additions & 38 deletions .github/workflows/doc.yml

This file was deleted.

6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ __pycache__
.coverage.*
coverage.xml
htmlcov/
tiledb/

# setup and build artifacts
docs/_*
Expand All @@ -31,6 +32,7 @@ venv/
.Trashes
ehthumbs.db
Thumbs.db

tmp/
_scratch/
_scratch/
.vscode
example.py
29 changes: 5 additions & 24 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
PAPER = a4
SOURCEDIR = source
BUILDDIR = build

# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
Expand All @@ -15,11 +16,11 @@ endif
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SOURCEDIR)
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .

.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext

help:
@echo "Please use \`make <target>' where <target> is one of"
Expand All @@ -29,9 +30,7 @@ help:
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " applehelp to make an Apple Help Book"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
Expand Down Expand Up @@ -82,15 +81,6 @@ htmlhelp:
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."

qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/cooler.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/cooler.qhc"

applehelp:
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
@echo
Expand All @@ -99,15 +89,6 @@ applehelp:
"~/Library/Documentation/Help or install it in your application" \
"bundle."

devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/cooler"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/cooler"
@echo "# devhelp"

epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
Expand Down
8 changes: 4 additions & 4 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
"sphinx.ext.ifconfig",
"sphinx.ext.viewcode",
"sphinx.ext.autosummary",
"sphinx.ext.napoleon",
"sphinx.ext.napoleon",
"recommonmark",
]

numpydoc_show_class_members = False
napoleon_use_rtype = False
autodoc_typehints = "description"
autodoc_class_signature = "separated"
templates_path = ['_templates']
templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
source_suffix = {
".rst": "restructuredtext",
Expand All @@ -52,8 +52,8 @@
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'alabaster'
html_static_path = ['_static']
html_theme = "furo"
html_static_path = ["_static"]
htmlhelp_basename = "momicsdoc"

# -- Options for manual page output ---------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The `momics` package aims to facilitate:
* Scalable: cloud-native, out-of-core operations on the data;
* Export: data export.

Follow cooler development on `GitHub <https://github.com/js2264/momics>`_.
Follow `momics` development on `GitHub <https://github.com/js2264/momics>`_.

Contents:

Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ classifiers = [
]
dependencies = [
"tiledb",
"libtiledb-sql-py",
"pyBigWig",
"numpy",
"pandas"
"pandas",
"pyarrow>=1.0",
]

[project.urls]
Expand Down
2 changes: 1 addition & 1 deletion src/momics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"""

from ._version import __format_version__, __version__
from .api import Momics
from .Momics import Momics

__all__ = [
"__version__",
Expand Down
87 changes: 0 additions & 87 deletions src/momics/api.py

This file was deleted.

27 changes: 27 additions & 0 deletions src/momics/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import os
import shutil
import pyBigWig
import numpy as np


def get_chr_lengths(bw):
with pyBigWig.open(bw) as bw:
{chrom: length for chrom, length in bw.chroms().items()}


def _check_chr_lengths(bw_files):
reference_lengths = {}
with pyBigWig.open(list(bw_files.values())[0]) as bw:
reference_lengths = {chrom: length for chrom, length in bw.chroms().items()}

# Compare chromosome lengths with other files
for file in list(bw_files.values())[1:]:
with pyBigWig.open(file) as bw:
lengths = {chrom: length for chrom, length in bw.chroms().items()}
if lengths != reference_lengths:
raise Exception(
"Provided .bw files do not have identical chromomosome lengths."
)

# return np.array(list(reference_lengths.values()), dtype=np.int64)
return reference_lengths
6 changes: 3 additions & 3 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
import pytest

import momics
from momics import api

testdir = os.path.dirname(os.path.realpath(__file__))


@pytest.mark.parametrize(
"file_path",
[(os.path.join(testdir, "data", "test.momics"))],
)
def test_api(file_path):
clr = momics.api.Momics(file_path)
print(clr)
mom = momics.Momics(file_path)
print(mom)

0 comments on commit 81e30d4

Please sign in to comment.