-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from TheMrSheldon/main
CI, Dev Container, and Documentation
- Loading branch information
Showing
19 changed files
with
592 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM debian:stable | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
RUN apt-get update && apt-get install -y locales &&\ | ||
echo "en_US.UTF-8 UTF-8" | tee -a /etc/locale.gen && locale-gen | ||
|
||
# Tools | ||
RUN apt-get update && apt-get -y install sudo git python3 python3-pip | ||
|
||
# Dependencies | ||
# pytorch for CPU | ||
RUN apt-get install -y libpcre3-dev | ||
RUN pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu --break-system-packages | ||
|
||
# Since splade makes problems otherwise: | ||
RUN pip3 install "splade@git+https://github.com/naver/splade.git" --break-system-packages --no-deps | ||
RUN pip3 install omegaconf==2.1.2 --break-system-packages | ||
|
||
# Change root Password to 1234 | ||
RUN echo 'root:1234' | chpasswd | ||
|
||
# Create new user: "dev" with password "1234" and change to that user | ||
RUN useradd -ms /bin/bash dev \ | ||
&& echo 'dev:1234' | chpasswd \ | ||
&& usermod -aG sudo dev \ | ||
&& groupadd -g 973 docker \ | ||
&& usermod -aG docker dev | ||
USER dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile | ||
{ | ||
"name": "Existing Dockerfile", | ||
"build": { | ||
// Sets the run context to one level up instead of the .devcontainer folder. | ||
"context": "..", | ||
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename. | ||
"dockerfile": "Dockerfile.dev" | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"editor.formatOnSave": true, | ||
"json.format.keepLines": true, | ||
"livePreview.portNumber": 3080, | ||
"remote.autoForwardPorts": false, | ||
"[python]": { | ||
"editor.codeActionsOnSave": { "source.organizeImports": "explicit" } | ||
}, | ||
"python.formatting.provider": "black" | ||
}, | ||
"extensions": [ | ||
"ms-python.python", | ||
"ms-vscode.live-server", | ||
"ms-python.black-formatter", | ||
"ms-python.isort", | ||
"ms-python.flake8", | ||
"ms-python.mypy-type-checker", | ||
"njpwerner.autodocstring" | ||
] | ||
} | ||
}, | ||
|
||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
|
||
// Uncomment the next line to run commands after the container is created. | ||
"postCreateCommand": "sudo pip3 install -e .[dev,docs,test] --break-system-packages" | ||
|
||
// Configure tool-specific properties. | ||
// "customizations": {}, | ||
|
||
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "devcontainer" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Deploy Documentation | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- master | ||
|
||
jobs: | ||
build-doc: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Install Dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y python3-pip | ||
pip3 install .[docs] | ||
cd docs/ | ||
make doctest | ||
make html | ||
touch _build/html/.nojekyll | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v5 | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
# Upload entire repository | ||
path: 'docs/_build/html' | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Linters | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
pull_request: | ||
branches: | ||
- master | ||
- main | ||
types: | ||
- ready_for_review | ||
workflow_dispatch: {} | ||
|
||
jobs: | ||
mypy: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
- name: Install mypy | ||
run: pip3 install mypy | ||
- name: Run mypy | ||
working-directory: ${{github.workspace}} | ||
run: | | ||
mkdir .mypy_cache | ||
mypy . --disallow-untyped-calls --explicit-package-bases --ignore-missing-imports --install-types --non-interactive --cache-dir=.mypy_cache/ | ||
flake8: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
- name: Install flake8 | ||
run: pip3 install flake8 | ||
- name: Run flake8 | ||
working-directory: ${{github.workspace}} | ||
run: flake8 . | ||
|
||
black: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
- name: Install black | ||
run: pip3 install black | ||
- name: Run black | ||
working-directory: ${{github.workspace}} | ||
run: black --check . | ||
|
||
isort: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
- name: Install isort | ||
run: pip3 install isort | ||
- name: Run isort | ||
working-directory: ${{github.workspace}} | ||
run: isort --check . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Tests | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
pull_request: | ||
branches: | ||
- master | ||
- main | ||
types: | ||
- ready_for_review | ||
workflow_dispatch: {} | ||
|
||
jobs: | ||
run-tests: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
strategy: | ||
matrix: | ||
python-version: ["3.9", "3.10", "3.11", "3.12"] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Install self | ||
working-directory: ${{github.workspace}} | ||
run: | | ||
# Since splade makes problems otherwise: | ||
pip3 install "splade@git+https://github.com/naver/splade.git" --no-deps | ||
pip3 install omegaconf==2.1.2 | ||
pip3 install .[test,dev] | ||
- name: Run tests | ||
working-directory: ${{github.workspace}} | ||
run: pytest tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line, and also | ||
# from the environment for the first two. | ||
SPHINXOPTS ?= | ||
SPHINXBUILD ?= sphinx-build | ||
SOURCEDIR = . | ||
BUILDDIR = _build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{{ objname | escape | underline}} | ||
|
||
.. currentmodule:: {{ module }} | ||
|
||
.. auto{{ objtype }}:: {{ objname }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{{ objname | escape | underline}} | ||
|
||
.. currentmodule:: {{ module }} | ||
|
||
.. autoclass:: {{ objname }} | ||
:members: | ||
:show-inheritance: | ||
:inherited-members: | ||
|
||
{% block methods %} | ||
.. automethod:: __init__ | ||
|
||
{% if methods %} | ||
.. rubric:: {{ _('Methods') }} | ||
|
||
.. autosummary:: | ||
{% for item in methods %} | ||
~{{ name }}.{{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block attributes %} | ||
{% if attributes %} | ||
.. rubric:: {{ _('Attributes') }} | ||
|
||
.. autosummary:: | ||
{% for item in attributes %} | ||
~{{ name }}.{{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{{ objname | escape | underline}} | ||
|
||
.. automodule:: {{ fullname }} | ||
|
||
{% block attributes %} | ||
{% if attributes %} | ||
.. rubric:: Module Attributes | ||
|
||
.. autosummary:: | ||
:toctree: | ||
{% for item in attributes %} | ||
{{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block functions %} | ||
{% if functions %} | ||
.. rubric:: {{ _('Functions') }} | ||
|
||
.. autosummary:: | ||
:toctree: | ||
{% for item in functions %} | ||
{{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block classes %} | ||
{% if classes %} | ||
.. rubric:: {{ _('Classes') }} | ||
|
||
.. autosummary:: | ||
:toctree: | ||
{% for item in classes %} | ||
{{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block exceptions %} | ||
{% if exceptions %} | ||
.. rubric:: {{ _('Exceptions') }} | ||
|
||
.. autosummary:: | ||
:toctree: | ||
{% for item in exceptions %} | ||
{{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block modules %} | ||
{% if modules %} | ||
.. rubric:: Modules | ||
|
||
.. autosummary:: | ||
:toctree: | ||
:recursive: | ||
{% for item in modules %} | ||
{{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} |
Oops, something went wrong.