-
Notifications
You must be signed in to change notification settings - Fork 0
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 #3 from BrainLesion/2-update-template
2 update template
- Loading branch information
Showing
11 changed files
with
265 additions
and
15 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
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,22 @@ | ||
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) | ||
|
||
# Contributing to BraTS | ||
|
||
First off, thanks for taking the time to contribute! 🎉 | ||
|
||
|
||
## Contribute Code | ||
Fork the repository, clone it and implement your contribution. | ||
|
||
**Setup:** | ||
- We use [poetry](https://python-poetry.org/), make sure it is installed: `pip install poetry` | ||
- Install dependencies by running: `poetry install` | ||
|
||
**Requirements:** | ||
- Our project follows the [black code style](https://github.com/psf/black). Make sure your code is formatted accordingly. | ||
- Please add _meaningful_ docstring for your functions and annotate types | ||
- Please add _meaningful_ tests for your contribution in `/tests` and make sure _all_ tests are passing by running `python -m pytest` | ||
|
||
|
||
|
||
Once done, create a Pull Request to integrate the code into our project! |
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 |
---|---|---|
@@ -1,2 +1,52 @@ | ||
# brainles-template | ||
Template for new BrainLes repositories | ||
# PACKAGE_NAME | ||
|
||
[![Python Versions](https://img.shields.io/pypi/pyversions/PACKAGE_NAME)](https://pypi.org/project/PACKAGE_NAME/) | ||
[![Stable Version](https://img.shields.io/pypi/v/PACKAGE_NAME?label=stable)](https://pypi.python.org/pypi/PACKAGE_NAME/) | ||
[![Documentation Status](https://readthedocs.org/projects/PACKAGE_NAME/badge/?version=latest)](http://PACKAGE_NAME.readthedocs.io/?badge=latest) | ||
[![tests](https://github.com/BrainLesion/PACKAGE_NAME/actions/workflows/tests.yml/badge.svg)](https://github.com/BrainLesion/PACKAGE_NAME/actions/workflows/tests.yml) | ||
[![codecov](https://codecov.io/gh/BrainLesion/PACKAGE_NAME/graph/badge.svg?token=A7FWUKO9Y4)](https://codecov.io/gh/BrainLesion/PACKAGE_NAME) | ||
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) | ||
|
||
Description | ||
## Features | ||
|
||
|
||
## Installation | ||
|
||
With a Python 3.8+ environment, you can install `PACKAGE_NAME` directly from [PyPI](https://pypi.org/project/brats/): | ||
|
||
```bash | ||
pip install PACKAGE_NAME | ||
``` | ||
|
||
|
||
## Use Cases and Tutorials | ||
|
||
A minimal example to create a segmentation could look like this: | ||
|
||
```python | ||
# example | ||
``` | ||
|
||
<!-- For more examples and details please refer to our extensive Notebook tutorials here [NBViewer](https://nbviewer.org/github/BrainLesion/tutorials/blob/main/PACKAGE_NAME/tutorial.ipynb) ([GitHub](https://github.com/BrainLesion/tutorials/blob/main/PACKAGE_NAME/tutorial.ipynb)). For the best experience open the notebook in Colab. --> | ||
|
||
|
||
## Citation | ||
|
||
If you use PACKAGE_NAME in your research, please cite it to support the development! | ||
|
||
``` | ||
TODO: citation will be added asap | ||
``` | ||
|
||
## Contributing | ||
|
||
We welcome all kinds of contributions from the community! | ||
|
||
### Reporting Bugs, Feature Requests and Questions | ||
|
||
Please open a new issue [here](https://github.com/BrainLesion/PACKAGE_NAME/issues). | ||
|
||
### Code contributions | ||
|
||
Nice to have you on board! Please have a look at our [CONTRIBUTING.md](CONTRIBUTING.md) file. |
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 = source | ||
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,35 @@ | ||
@ECHO OFF | ||
|
||
pushd %~dp0 | ||
|
||
REM Command file for Sphinx documentation | ||
|
||
if "%SPHINXBUILD%" == "" ( | ||
set SPHINXBUILD=sphinx-build | ||
) | ||
set SOURCEDIR=source | ||
set BUILDDIR=build | ||
|
||
%SPHINXBUILD% >NUL 2>NUL | ||
if errorlevel 9009 ( | ||
echo. | ||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx | ||
echo.installed, then set the SPHINXBUILD environment variable to point | ||
echo.to the full path of the 'sphinx-build' executable. Alternatively you | ||
echo.may add the Sphinx directory to PATH. | ||
echo. | ||
echo.If you don't have Sphinx installed, grab it from | ||
echo.https://www.sphinx-doc.org/ | ||
exit /b 1 | ||
) | ||
|
||
if "%1" == "" goto help | ||
|
||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
goto end | ||
|
||
:help | ||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
|
||
:end | ||
popd |
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 @@ | ||
# Configuration file for the Sphinx documentation builder. | ||
# | ||
# For the full list of built-in configuration values, see the documentation: | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
||
import os | ||
import sys | ||
from subprocess import run | ||
|
||
|
||
sys.path.insert(0, os.path.abspath("../../")) | ||
|
||
|
||
run(["python", "preprocess_readme.py"]) | ||
|
||
# -- Project information ----------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information | ||
|
||
project = "PACKAGE_NAME" | ||
copyright = "2024, Marcel Rosier et al." | ||
author = "Marcel Rosier, Florian Kofler" | ||
|
||
# -- General configuration --------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration | ||
|
||
extensions = [ | ||
"sphinx.ext.autodoc", | ||
"sphinx.ext.autosummary", | ||
"sphinx.ext.napoleon", | ||
"sphinx_copybutton", | ||
"myst_parser", | ||
] | ||
|
||
templates_path = ["_templates"] | ||
exclude_patterns = [] | ||
|
||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output | ||
|
||
html_theme = "furo" | ||
# html_static_path = ["_static"] | ||
|
||
autodoc_default_options = { | ||
"members": True, | ||
"undoc-members": True, | ||
"private-members": False, | ||
"show-inheritance": True, | ||
} |
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,22 @@ | ||
PACKAGE_NAME documentation | ||
=================== | ||
|
||
.. include:: ../README_preprocessed.md | ||
:parser: myst_parser.sphinx_ | ||
|
||
|
||
Sections | ||
=================== | ||
|
||
|
||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
:caption: Getting Started: | ||
|
||
readme | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: API Reference: | ||
|
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,36 @@ | ||
import re | ||
|
||
|
||
def preprocess_readme(input_file: str, output_file: str) -> None: | ||
"""Preprocess a README file to replace GitHub admonitions with Sphinx-style admonitions. | ||
Args: | ||
input_file (str): original README file | ||
output_file (str): processed README file | ||
""" | ||
with open(input_file, "r") as file: | ||
content = file.read() | ||
|
||
admonition_types = ["IMPORTANT", "NOTE", "TIP", "WARNING", "CAUTION"] | ||
|
||
for ad_type in admonition_types: | ||
# Replace > [!ad_type] with Sphinx admonition syntax | ||
content = re.sub( | ||
r"> \[!" | ||
+ ad_type | ||
+ "\]\s*\n((?:> .*\n)*)", # Match the > [!ad_type] and subsequent lines | ||
lambda m: "```{" | ||
+ ad_type | ||
+ "}\n" | ||
+ m.group(1).replace("> ", "").strip() | ||
+ "\n```", # Replace with MyST syntax | ||
content, | ||
) | ||
# Write the transformed content to the output file | ||
with open(output_file, "w") as file: | ||
file.write(content) | ||
|
||
|
||
if __name__ == "__main__": | ||
preprocess_readme("../../README.md", "../README_preprocessed.md") |
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,6 @@ | ||
Readme | ||
============== | ||
|
||
|
||
.. include:: ../README_preprocessed.md | ||
:parser: myst_parser.sphinx_ |
Empty file.
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