Skip to content

Commit

Permalink
Merge pull request #3273 from flairNLP/doc-page
Browse files Browse the repository at this point in the history
creating a doc page with autodocs and everything
  • Loading branch information
alanakbik authored Sep 18, 2023
2 parents 8b997ef + a951be1 commit d5c1558
Show file tree
Hide file tree
Showing 120 changed files with 4,679 additions and 916 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
43 changes: 43 additions & 0 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: 'Build doc page'
on:
push:
branches: [ main, doc-page ]
tags:
- "*"

jobs:
publish_docs:
name: Build the docs using Sphinx and push to gh-pages
runs-on: ubuntu-latest
env:
python-version: 3.8
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: setup python ${{ env.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.python-version }}
- name: Install Flair dependencies
run: pip install -e .
- name: Install unittest dependencies
run: pip install -r requirements-dev.txt
- name: Install doc dependencies
run: pip install -r docs/requirements.txt
- name: Fetch git tags
run: git fetch --tags origin
- name: Build docs
run: |
sphinx-multiversion docs doc_build/
- name: Add redirect to stable doc
run: |
cp assets/redirect.html doc_build/index.html
cp assets/redirect.html doc_build/404.html
cp assets/README.md doc_build/README.md
sed -i "s/\[VERSION\]/$(python -c 'import flair;print(flair.__version__)')/g" doc_build/index.html
sed -i "s/\[VERSION\]/$(python -c 'import flair;print(flair.__version__)')/g" doc_build/404.html
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./doc_build
6 changes: 6 additions & 0 deletions assets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Docs For Flair NLP

This branch is currently under construction.

It will contain the docs for Flair NLP.
Don't change files, as this branch will be autogenerated using github actions.
9 changes: 9 additions & 0 deletions assets/redirect.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>Redirecting to https://flairnlp.github.io/</title>
<meta charset="utf-8">
<meta http-equiv="refresh" content="0; URL=https://flairnlp.github.io/">
<link rel="canonical" href="https://flairnlp.github.io/">
</head>
</html>
2 changes: 2 additions & 0 deletions docs/_static/api.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/_static/contributing.svg
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/_static/favicon.ico
Binary file not shown.
36 changes: 36 additions & 0 deletions docs/_static/tutorial.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions docs/_templates/page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% extends "!page.html" %}
{% block body %}
{% if current_version and latest_version and current_version != latest_version and current_version != release and current_version.name != latest_version.release %}
<p>
<strong>
{% if current_version.is_released %}
{% if latest_version.release.replace('v', '').split('.') | map('int') | list > current_version.name.replace('v', '').split('.') | map('int') | list %}
You're reading an old version of this documentation.
If you want up-to-date information, please have a look at <a href="{{ vpathto(latest_version.name) }}">{{latest_version.name}}</a>.
{% endif %}
{% else %}
You're reading the documentation for a development version.
For the latest stable version, please have a look at <a href="{{ vpathto(latest_version.name) }}">{{latest_version.name}}</a>.
{% endif %}
</strong>
</p>
{% endif %}
{{ super() }}
{% endblock %}%
30 changes: 30 additions & 0 deletions docs/_templates/version-switcher.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{# As the version switcher will only work when JavaScript is enabled, we add it through JavaScript.
#}
<script>
document.write(`
<div class="version-switcher__container dropdown">
<button id="versionswitcherbutton" type="button" role="button" class="version-switcher__button btn btn-sm navbar-btn dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="listbox" aria-controls="versionswitcherlist" aria-label="Version switcher list">
{% if current_version.is_released %} {{ current_version.name }} {% if latest_version and item == latest_version %} (stable) {% endif %} {% else %} latest (dev) {% endif %}
<span class="caret"></span>
</button>
<div id="versionswitcherlist" class="version-switcher__menu dropdown-menu list-group-flush py-0" role="listbox" aria-labelledby="versionswitcherbutton">
<!-- dropdown will be populated by javascript on page load -->
{%- for item in versions|reverse %}
<a class="list-group-item list-group-item-action py-1" href="{{ item.url }}" data-version-name="dev" data-version="devdocs">
<span>{% if item.is_released %}
{{ item.name }}
{% if latest_version and item == latest_version %}
(stable)
{% endif %}
{% else %}
latest (dev)
{% endif %}
{% if item == current_version %}
[x]
{% endif %}</span>
</a>
{%- endfor %}
</div>
</div>
`);
</script>
17 changes: 17 additions & 0 deletions docs/_templates/versioning.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% if versions %}
<h3>{{ _('Versions') }}</h3>
<ul>
{%- for item in versions|reverse %}
<li><a href="{{ item.url }}">
{% if item.is_released %}
{{ item.name }}
{% if latest_version and item == latest_version %}
(stable)
{% endif %}
{% else %}
latest ({{ item.name }})
{% endif %}
</a></li>
{%- endfor %}
</ul>
{% endif %}
4 changes: 4 additions & 0 deletions docs/api/datasets/base.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
flair.datasets.base
===================

.. automodule:: flair.datasets.base
4 changes: 4 additions & 0 deletions docs/api/datasets/biomedical.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
flair.datasets.biomedical
=========================

.. automodule:: flair.datasets.biomedical
4 changes: 4 additions & 0 deletions docs/api/datasets/document_classification.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
flair.datasets.document_classification
======================================

.. automodule:: flair.datasets.document_classification
4 changes: 4 additions & 0 deletions docs/api/datasets/entity_linking.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
flair.datasets.entity_linking
=============================

.. automodule:: flair.datasets.entity_linking
4 changes: 4 additions & 0 deletions docs/api/datasets/ocr.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
flair.datasets.ocr
==================

.. automodule:: flair.datasets.ocr
4 changes: 4 additions & 0 deletions docs/api/datasets/relation_extraction.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
flair.datasets.relation_extraction
==================================

.. automodule:: flair.datasets.relation_extraction
4 changes: 4 additions & 0 deletions docs/api/datasets/sequence_labeling.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
flair.datasets.sequence_labeling
================================

.. automodule:: flair.datasets.sequence_labeling
4 changes: 4 additions & 0 deletions docs/api/datasets/text_image.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
flair.datasets.text_image
=========================

.. automodule:: flair.datasets.text_image
4 changes: 4 additions & 0 deletions docs/api/datasets/text_text.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
flair.datasets.text_text
=========================

.. automodule:: flair.datasets.text_text
4 changes: 4 additions & 0 deletions docs/api/datasets/treebanks.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
flair.datasets.treebanks
========================

.. automodule:: flair.datasets.treebanks
4 changes: 4 additions & 0 deletions docs/api/embeddings/base.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
flair.embeddings.base
=====================

.. automodule:: flair.embeddings.base
4 changes: 4 additions & 0 deletions docs/api/embeddings/document.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
flair.embeddings.document
=========================

.. automodule:: flair.embeddings.document
4 changes: 4 additions & 0 deletions docs/api/embeddings/image.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
flair.embeddings.image
======================

.. automodule:: flair.embeddings.image
8 changes: 8 additions & 0 deletions docs/api/embeddings/legacy.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
flair.embeddings.legacy
============================

.. warning::
All embeddings in `flair.embeddings.legacy` are considered deprecated.
there is no guarantee that they are still working and we recommend using different embeddings instead.

.. automodule:: flair.embeddings.legacy
4 changes: 4 additions & 0 deletions docs/api/embeddings/token.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
flair.embeddings.token
======================

.. automodule:: flair.embeddings.token
4 changes: 4 additions & 0 deletions docs/api/embeddings/transformer.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
flair.embeddings.transformer
============================

.. automodule:: flair.embeddings.transformer
4 changes: 4 additions & 0 deletions docs/api/flair.data.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
flair.data
==========

.. automodule:: flair.data
8 changes: 8 additions & 0 deletions docs/api/flair.datasets.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
flair.datasets
==============

.. toctree::
:glob:
:maxdepth: 2

datasets/*
8 changes: 8 additions & 0 deletions docs/api/flair.embeddings.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
flair.embeddings
================

.. toctree::
:glob:
:maxdepth: 2

embeddings/*
4 changes: 4 additions & 0 deletions docs/api/flair.models.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
flair.models
============

.. automodule:: flair.models
4 changes: 4 additions & 0 deletions docs/api/flair.nn.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
flair.nn
========

.. automodule:: flair.nn
4 changes: 4 additions & 0 deletions docs/api/flair.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
flair
=====

.. automodule:: flair
4 changes: 4 additions & 0 deletions docs/api/flair.splitter.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
flair.splitter
==============

.. automodule:: flair.splitter
4 changes: 4 additions & 0 deletions docs/api/flair.tokenization.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
flair.tokenization
==================

.. automodule:: flair.tokenization
4 changes: 4 additions & 0 deletions docs/api/flair.trainers.plugins.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
flair.trainers.plugins
======================

.. automodule:: flair.trainers.plugins
4 changes: 4 additions & 0 deletions docs/api/flair.trainers.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
flair.trainers
==============

.. automodule:: flair.trainers
9 changes: 9 additions & 0 deletions docs/api/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
API Docs
========

.. toctree::
:glob:
:maxdepth: 2

flair
flair.*
Loading

0 comments on commit d5c1558

Please sign in to comment.