Skip to content

Commit

Permalink
Merge pull request #575 from tira-io/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
mam10eks authored Nov 26, 2023
2 parents 4e94f4f + 48a71a0 commit abd02fc
Show file tree
Hide file tree
Showing 55 changed files with 1,524 additions and 138 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build-documentation-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ jobs:
- name: Install Dependencies
run: |
sudo apt-get install -y python3-pip
pip install sphinx furo myst-parser
pip install sphinx furo myst-parser sphinx-toolbox
pip install pandas pyterrier ir_datasets
cd python-client/sphinx
sphinx-apidoc -o . ../tira
# sphinx-apidoc -o . ../tira
make doctest
make html
touch _build/html/.nojekyll
- name: Deploy
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/build-documentation-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ jobs:
- name: Install Dependencies
run: |
sudo apt-get install -y python3-pip
pip install sphinx furo myst-parser
pip install sphinx furo myst-parser sphinx-toolbox
pip install pandas pyterrier ir_datasets
cd python-client/sphinx
sphinx-apidoc -o . ../tira
# sphinx-apidoc -o . ../tira
make doctest
make html
touch _build/html/.nojekyll
- name: Deploy
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/test-python-client-on-many-python-versions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Test Python Client on Many Python Versions
on: [push]

jobs:
image:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build Image
run: |
cd python-client
pip3 install twine coverage-badge python-terrier coverage ir_datasets pytest docker
echo running on branch ${GITHUB_REF##*/}
pytest
2 changes: 1 addition & 1 deletion application/.devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"image": "webis/tira-application:basis-0.0.93",
"image": "webis/tira-application:basis-0.0.94",
"customizations": {
"vscode": {
"extensions": ["ms-python.python", "ms-python.vscode-pylance", "ms-toolsai.jupyter"]
Expand Down
2 changes: 1 addition & 1 deletion application/Dockerfile.application
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN cd /src/tira/frontend-vuetify \


# Only change in case of new / updated dependencies
FROM webis/tira-application:basis-0.0.93
FROM webis/tira-application:basis-0.0.94

# This Dockerfile ensures that all dependencies do rarely change by starting from a basis image
# that contains already all dependencies (so that the minor versions do rarely change, but we
Expand Down
4 changes: 3 additions & 1 deletion application/Dockerfile.application-dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# docker build -t webis/tira-application:basis-0.0.93 -f Dockerfile.application-dev .
# docker build -t webis/tira-application:basis-0.0.94 -f Dockerfile.application-dev .
FROM ubuntu:22.04

RUN apt-get update \
Expand Down Expand Up @@ -51,3 +51,5 @@ RUN chown -R tira:tira /usr/local && \
chown tira:tira -R /home/tira &&\
chown tira:tira -R /tira

RUN pip3 install tira==0.0.97 ir-measures==0.3.1

4 changes: 2 additions & 2 deletions application/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

VENV_NAME?=venv
PYTHON=${PWD}/${VENV_NAME}/bin/python3
VERSION_APPLICATION=0.0.93
VERSION_GRPC=0.0.93
VERSION_APPLICATION=0.0.94
VERSION_GRPC=0.0.94

.DEFAULT: help
help:
Expand Down
1 change: 1 addition & 0 deletions application/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ django-extensions
coverage
coverage-badge
discourse-client-in-disraptor==0.0.8
tira>=0.0.97
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,32 @@
<v-expansion-panel>
<v-expansion-panel-title>Step 1: Upload your Code to your repository</v-expansion-panel-title>
<v-expansion-panel-text>
<p>Short conceptual description: deployment + key for git repo, deployment + key of tira key</p>
<p>Your <a :href="http_repo_url" target="_blank">prepared Github repository</a> already contains all secrets to build and upload your code as Docker image to TIRA and makes it easier for us to help you in case of problems because we can access the code.</p>

<p>If you start from scratch, you can just <a :href="http_repo_url" target="_blank">clone your repository</a>.</p>

<code-snippet title="Merge your existing repository" :code="code_for_merging" expand_message="If you already have a git repository, please merge it with the tira repository."/>
<code-snippet title="Merge your existing repository (intended as second upstream)" :code="code_for_merging" expand_message="If you already have a git repository, please merge it with the tira repository that is intended as second remote/upstream."/>
</v-expansion-panel-text>
</v-expansion-panel>

<v-expansion-panel>
<v-expansion-panel-title>Step 2: Build your Docker image via GitHub Actions</v-expansion-panel-title>
<v-expansion-panel-text>
<p>step by step description</p>
<p>Please go to your <a :href="http_repo_url" target="_blank">prepared Github repository</a> and upload your code to the repository. Upon initialization, your repository contains a jupyter notebook
<a :href="http_repo_url + '/blob/main/jupyter-notebook-submissions/pyterrier-notebook.ipynb'" target="_blank">Jupyter notebook</a> together with <a :href="http_repo_url +'/tree/main/jupyter-notebook-submissions'" target="_blank">a detailed README on how to submit together with background information</a>.</p>

<p>In short, navigate to "Actions" -> "upload-notebook-submission" in <a :href="http_repo_url" target="_blank">your Github repository</a> and click on "Run workflow" to start the Github action that builds, tests, and uploads your submission.</p>

<p>You can also watch the <a href="https://conf.fmi.uni-leipzig.de/playback/presentation/2.3/9d654239893aee5d164d92e3b2263ab510249eea-1700482128152" target="_blank">recording of the tutorial</a> from the IR lab in Leipzig from teh 20.11.2023.</p>
</v-expansion-panel-text>
</v-expansion-panel>

<v-expansion-panel>
<v-expansion-panel-title>Step 3:Execute your Docker image in TIRA</v-expansion-panel-title>
<v-expansion-panel-text>
<p>step by step description</p>
<p>After your Github action was successfull, it prints out the name under which your software was added to TIRA as Docker submission (at the very bottom of the step "Build, test, and upload image" of your Github action). Click on the Docker tab and select your newly added software (maybe reload the page). Select the dataset on which you want to execute your software together with the execution instance (e.g., 1CPU + 10GB of RAM) and click on RUN to start your submission. Admins will review your submission (might take up to one day) and reach out to you in case there are problems with the execution.</p>

<p>You can also watch the <a href="https://conf.fmi.uni-leipzig.de/playback/presentation/2.3/9d654239893aee5d164d92e3b2263ab510249eea-1700482128152" target="_blank">recording of the tutorial</a> from the IR lab in Leipzig from teh 20.11.2023.</p>
</v-expansion-panel-text>
</v-expansion-panel>
</v-expansion-panels>
Expand Down
9 changes: 4 additions & 5 deletions application/src/tira/git_runner_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
logger = logging.getLogger('tira')


def normalize_file(file_content, tira_user_name):
return file_content.replace('TIRA_USER_FOR_AUTOMATIC_REPLACEMENT', tira_user_name)
def normalize_file(file_content, tira_user_name, task_id):
return file_content.replace('TIRA_USER_FOR_AUTOMATIC_REPLACEMENT', tira_user_name)\
.replace('TIRA_TASK_ID_FOR_AUTOMATIC_REPLACEMENT', task_id)


def convert_size(size_bytes):
Expand Down Expand Up @@ -1216,9 +1217,7 @@ def create_software_submission_repository_for_user(self, reference_repository_na
repo.create_secret('TIRA_DOCKER_REGISTRY_USER', dockerhub_user)
repo.create_secret('TIRA_CLIENT_TOKEN', tira_client_token)
repo.create_secret('TIRA_CLIENT_USER', tira_client_user)
repo.create_secret('TIRA_TASK_ID', tira_task_id)
repo.create_secret('TIRA_CODE_REPOSITORY_ID', tira_code_repository_id)
repo.create_secret('TIRA_VM_ID', tira_user_name)

contents = reference_repo.get_contents(repository_search_prefix)
while contents:
Expand All @@ -1227,7 +1226,7 @@ def create_software_submission_repository_for_user(self, reference_repository_na
contents.extend(reference_repo.get_contents(file_content.path))
else:
decoded_content = file_content.decoded_content.decode()
decoded_content = normalize_file(decoded_content, tira_user_name)
decoded_content = normalize_file(decoded_content, tira_user_name, tira_task_id)
repo.create_file(file_content.path, 'Initial Commit.', decoded_content)

return repo
Expand Down
2 changes: 1 addition & 1 deletion python-client/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ USER dev

RUN pip3 install twine coverage-badge python-terrier coverage
RUN pip3 install pytest docker
RUN pip3 install sphinx furo myst-parser
RUN pip3 install sphinx furo myst-parser sphinx-toolbox
RUN pip3 install tira \
&& cd /tmp \
&& python3 -c 'from tira.third_party_integrations import ensure_pyterrier_is_loaded; ensure_pyterrier_is_loaded();' \
Expand Down
2 changes: 1 addition & 1 deletion python-client/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
build-pypi-package: run-tests
python3 -m build --sdist .
python3 -m build --wheel .
twine upload dist/tira-0.0.93-py3-none-any.whl dist/tira-0.0.93.tar.gz
twine upload dist/tira-0.0.97-py3-none-any.whl dist/tira-0.0.97.tar.gz

run-tests:
docker run -u root --rm -v /var/run/docker.sock:/var/run/docker.sock -v ${PWD}:/app -w /app --entrypoint pytest webis/tira:python-client-dev-0.0.4
Expand Down
2 changes: 2 additions & 0 deletions python-client/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[tool.black]
line-length = 120
7 changes: 7 additions & 0 deletions python-client/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,10 @@ console_scripts =
tira-run = tira.tira_run:main
tira-run-notebook = tira.tira_run_notebook:main
tira-run-inference-server = tira.tira_run_inference_server:main

[flake8]
max-line-length = 120
extend-ignore = E203

[isort]
profile=black
16 changes: 16 additions & 0 deletions python-client/sphinx/_static/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
details {
border: 2pt solid var(--color-background-border);
background-color: var(--color-background-secondary);
margin: 2pt;
padding: 0pt 10pt;
}

details > summary {
padding: 2pt 0pt;
cursor: pointer;
font-weight: bold;
}

details[open] > summary {
border-bottom: 2pt solid var(--color-background-border);
}
3 changes: 0 additions & 3 deletions python-client/sphinx/api.rst

This file was deleted.

3 changes: 0 additions & 3 deletions python-client/sphinx/changelog.rst

This file was deleted.

24 changes: 22 additions & 2 deletions python-client/sphinx/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#
import os
import sys
sys.path.insert(0, os.path.abspath('../tira/'))
sys.path.insert(0, os.path.abspath('../'))


# -- Project information -----------------------------------------------------
Expand All @@ -29,9 +29,22 @@
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.todo',
'sphinx.ext.doctest',
'sphinx.ext.viewcode',
'sphinx_toolbox.collapse',
'myst_parser',
]

todo_include_todos=True
python_display_short_literal_types=True
python_use_unqualified_type_names=True
viewcode_line_numbers=True

doctest_global_setup = '''
from tira.io_utils import *
'''

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

Expand All @@ -50,6 +63,7 @@
html_title = 'TIRA'
language = 'en'

html_logo = "https://github.com/tira-io/tira-branding/raw/master/tira-icons/logo-tira-120x120-transparent.png"
html_theme_options: Dict[str, Any] = {
"footer_icons": [
{
Expand All @@ -66,10 +80,16 @@
"source_repository": "https://github.com/tira-io/tira",
"source_branch": "development",
"source_directory": "python-client/sphinx",
"sidebar_hide_name": True,
"navigation_with_keys": True,
}


# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ['_static']

html_css_files = [
'css/custom.css',
]
10 changes: 0 additions & 10 deletions python-client/sphinx/contributing/index.rst

This file was deleted.

12 changes: 0 additions & 12 deletions python-client/sphinx/contributing/internals.rst

This file was deleted.

8 changes: 8 additions & 0 deletions python-client/sphinx/development/backend/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Backend Development
===================
.. todo:: add a nice introductory text and thank for the interest in helping out for further TIRA

.. toctree::
:hidden:

workflow
32 changes: 32 additions & 0 deletions python-client/sphinx/development/backend/workflow.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Workflow
========
.. todo:: add nice introductory text

Getting Started
---------------
Initial Setup
~~~~~~~~~~~~~
.. todo:: how do I start working on TIRA?

Running TIRA locally
~~~~~~~~~~~~~~~~~~~~
.. todo:: How to run tira locally


Commands
--------
Linting
~~~~~~~
.. todo:: What commands are used for linting

Unit Tests
~~~~~~~~~~
.. todo:: How to start the unit tests

Generating documentation
~~~~~~~~~~~~~~~~~~~~~~~~
.. todo:: How to generate documentation

Releasing a new version
~~~~~~~~~~~~~~~~~~~~~~~
.. todo:: How to release a new version
3 changes: 3 additions & 0 deletions python-client/sphinx/development/changelog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Changelog
=========
.. todo:: This page will log changes once we reached the 1.0.0 release
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Contribution Guidelines
=======================

.. include:: ../../../CONTRIBUTING.md
.. include:: ../../../../CONTRIBUTING.md
9 changes: 9 additions & 0 deletions python-client/sphinx/development/contributing/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Contributing
============
.. todo:: add a nice introductory text and thank for the interest in helping out for further TIRA

.. toctree::
:hidden:

internals
guidelines
12 changes: 12 additions & 0 deletions python-client/sphinx/development/contributing/internals.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Internals
=========

.. todo:: add nice introductory text

Repository Layout
-----------------
.. todo:: What does the Repository structure look like

Architecture
------------
.. todo:: document what components make up TIRA, what purpose they serve and how they work with each other
8 changes: 8 additions & 0 deletions python-client/sphinx/development/frontend/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Frontend Development
====================
.. todo:: add a nice introductory text and thank for the interest in helping out for further TIRA

.. toctree::
:hidden:

workflow
Loading

0 comments on commit abd02fc

Please sign in to comment.