Skip to content

Commit

Permalink
docs: use mkdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ingerid committed Mar 6, 2024
1 parent b5bbbea commit 1c39e3d
Show file tree
Hide file tree
Showing 14 changed files with 234 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,5 @@ dhlab/_version.py
# vscode settings
.vscode
poetry.lock
docs/new_conf.py
docs/orig_conf.py
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.11"
python: "3.12"
# You can also specify other tool versions:
# nodejs: "16"
# rust: "1.55"
Expand Down
Binary file added docs/_images/DHlab_logo_web_en_black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/NB-logo-no-eng-farge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# ::: dhlab.api
options:
show_root_heading: true

## ::: dhlab.api.dhlab_api
options:
show_root_heading: true

## ::: dhlab.api.nb_ngram_api
options:
show_root_heading: true

## ::: dhlab.api.nb_search_api
options:
show_root_heading: true

13 changes: 13 additions & 0 deletions docs/images.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# ::: dhlab.images
options:
show_root_heading: true


## ::: dhlab.images.nbpictures
options:
show_root_heading: true


## ::: dhlab.nbpictures
options:
show_root_heading: true
26 changes: 26 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

[![DH-LAB logo](_images/DHlab_logo_web_en_black.png)](https://www.nb.no/dh-lab/)

# Welcome to the dhlab reference documentation

This site documents the [code reference](./reference.md) for the [dhlab python library](https://pypi.org/project/dhlab/) functionalities.
It is built directly from docstrings in our code library, and so the functionality documented here will reflect the [code base on GitHub](https://github.com/NationalLibraryOfNorway/DHLAB).

Head to our [official homepage](https://www.nb.no/dh-lab/) for tutorials, how-to-guides, interactive web apps, and more information about the DH-lab group.

## Project overview

::: dhlab

## Installation

Ensure that you already have [Python >= 3.9](https://www.python.org/downloads/) installed.

<!-- start installation -->

Install the latest version of the [`dhlab`](https://pypi.org/project/dhlab/) python package in your (Unix) terminal with pip:

```shell
pip install -U dhlab
```
<!-- end installation -->
11 changes: 11 additions & 0 deletions docs/metadata.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# ::: dhlab.metadata
options:
show_root_heading: true

## ::: dhlab.metadata.natbib
options:
show_root_heading: true

## ::: dhlab.metadata.metadata
options:
show_root_heading: true
11 changes: 11 additions & 0 deletions docs/ngram.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# :::dhlab.ngram
options:
show_root_heading: true

## ::: dhlab.ngram.ngram
options:
show_root_heading: true

## ::: dhlab.ngram.nb_ngram
options:
show_root_heading: true
34 changes: 34 additions & 0 deletions docs/reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
This pages gives an overview of objects available at the top level of the package,
that can be imported directly from `dhlab.*`, for example: `from dhlab import Corpus`


### Classes and functions

!!! info inline end

We recommend importing these objects directly from dhlab, e.g.:

from dhlab import Corpus

The internal subpackages and module structure may change.
If you access the top level objects via full module paths,
you may need to refactor your imports with future releases of `dhlab`.

- [`Corpus`][dhlab.text.corpus.Corpus]
- [`Ngram`][dhlab.ngram.ngram.Ngram]
- [`Chunks`][dhlab.text.chunking.Chunks]
- [`Collocations`][dhlab.text.collocations.Collocations]
- [`Concordance`][dhlab.text.concordance.Concordance]
- [`Frequencies`][dhlab.text.frequencies.Frequencies]
- [`WildcardWordSearch`][dhlab.text.wildcard.WildcardWordSearch]
- [`metadata_from_urn`][dhlab.metadata.natbib.metadata_from_urn]
- [`metadata_query`][dhlab.metadata.natbib.metadata_query]
- [`totals`][dhlab.api.dhlab_api.totals]

### Subpackages

- [`api`][dhlab.api]
- [`images`][dhlab.images]: Retrieve and analyze image data.
- [`metadata`][dhlab.metadata]: Extract metadata on objects from the digital archive.
- [`ngram`][dhlab.ngram]: Retrieve n-gram data.
- [`text`][dhlab.text]: Retrieve and analyze text data.
8 changes: 8 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
mkdocs==1.5.2
mkdocs-autorefs==0.5.0
mkdocs-material==9.1.21
mkdocs-material-extensions==1.1.1
mkdocstrings==0.22.0
mkdocstrings-python==1.3.0
mkdocs-section-index==0.3.5
mkdocs-autorefs==0.5.0
35 changes: 35 additions & 0 deletions docs/text.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# ::: dhlab.text
options:
show_root_heading: true

## ::: dhlab.text.chunking
options:
show_root_heading: true

## ::: dhlab.text.collocations
options:
show_root_heading: true

## ::: dhlab.text.concordance
options:
show_root_heading: true

## ::: dhlab.text.corpus
options:
show_root_heading: true

## ::: dhlab.text.dispersion
options:
show_root_heading: true

## ::: dhlab.text.frequencies
options:
show_root_heading: true

## ::: dhlab.text.utils
options:
show_root_heading: true

## ::: dhlab.text.wildcard
options:
show_root_heading: true
67 changes: 67 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
site_name: dhlab documentation


theme:
name: "material"
logo: _images/NB-symbol-farge.png
favicon: _images/nb_symbol_farge_z5B_icon.ico
palette:
primary: "white"
accent: "red"
features:
- content.code.copy
- navigation.footer
- navigation.path

repo_url: https://github.com/NationalLibraryOfNorway/DHLAB
repo_name: NationalLibraryOfNorway/DHLAB

extra:
social:
- icon: material/home
link: https://www.nb.no/
name: National Library of Norway
- icon: material/book-search
link: https://www.nb.no/search/
name: Online library search
- icon: simple/streamlit
link: https://www.nb.no/dh-lab/apper/
name: dhlab streamlit apps
- icon: fontawesome/brands/github
link: https://github.com/NationalLibraryOfNorway/DHLAB
- icon: simple/python
link: https://pypi.org/project/dhlab/
name: pypi.org
- icon: material/bug
link: https://github.com/NationalLibraryOfNorway/DHLAB/issues
name: bug tracker

plugins:
- mkdocstrings
- search
- autorefs
- section-index

markdown_extensions:
- admonition
- pymdownx.details
- pymdownx.superfences
- pymdownx.highlight:
anchor_linenums: true
line_spans: __span
pygments_lang_class: true
- pymdownx.inlinehilite
- pymdownx.snippets
- toc:
permalink: true

nav:
- Home: index.md
- Code Reference:
- reference.md
- api.md
- images.md
- metadata.md
- ngram.md
- text.md

12 changes: 10 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pandas = "^2.1.2"
python-louvain = "^0.16"
requests = "^2.31.0"
seaborn = "^0.13.0"
scipy = "^1.11.3"
scipy = { version = "^1.11.3", python = ">=3.9,<3.13" }
openpyxl = "^3.1.2"
beautifulsoup4 = "^4.12.2"
numpy = "^1.26.3"
Expand All @@ -44,7 +44,11 @@ sphinx-copybutton = "^0.5.2"
sphinx-togglebutton = "^0.3.2"
sphinx_design = "^0.5.0"
sphinx_inline_tabs = "^2023.4.21"
numpy = "^1.26.1"
mkdocs = "^1.5.2"
mkdocstrings = {extras = ["python"], version = "^0.22.0"}
mkdocs-material = "^9.1.21"
mkdocs-section-index = "^0.3.5"
mkdocs-autorefs = "^0.5.0"

[tool.poetry.group.dev.dependencies]
ipykernel = "^6.26.0"
Expand All @@ -67,6 +71,10 @@ bump = false
vcs = "git"
format = "v{base}{stage}{revision}"


[tool.poetry-dynamic-versioning.substitution]
files = ["dhlab/_version.py"]

[build-system]
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"]
build-backend = "poetry_dynamic_versioning.backend"
Expand Down

0 comments on commit 1c39e3d

Please sign in to comment.