Skip to content

Commit

Permalink
initialize repository
Browse files Browse the repository at this point in the history
  • Loading branch information
Valerieducret committed Jan 31, 2025
0 parents commit 8e56972
Show file tree
Hide file tree
Showing 44 changed files with 9,402 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/page.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Deploy doc

on:
# Runs on pushes targeting the main branch (uncomment to next 3 lines to enable)
# push:
# branches:
# - main
# - master

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"

- name: Install Poetry
run: make install-poetry

- name: Pypi authentication
run: |
poetry config repositories.owkin https://pypi.owkin.com/simple/
poetry config http-basic.owkin "${{ secrets.PYPI_USERNAME }}" "${{ secrets.PYPI_PASSWORD }}"
poetry config repositories.sowce https://github.com/owkin/sowce.git
poetry config http-basic.sowce "${{ secrets.GIT_USERNAME }}" "${{ secrets.GIT_TOKEN }}"
- name: Install dependencies
run: poetry install --all-extras --with=docs

- name: Build docs
run: poetry run make docs

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: docs/_build/html

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
32 changes: 32 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Publish
on:
release:
types: [published]
jobs:
publish-on-pypi-servers:
runs-on: ubuntu-latest
steps:
- name: Checkout repo and submodule
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install Poetry
run: make install-poetry

- name: Pypi authentication
run: |
poetry config repositories.owkin https://pypi.owkin.com/simple/
poetry config http-basic.owkin "${{ secrets.PYPI_USERNAME }}" "${{ secrets.PYPI_PASSWORD }}"
poetry config repositories.sowce https://github.com/owkin/sowce.git
poetry config http-basic.sowce "${{ secrets.GIT_USERNAME }}" "${{ secrets.GIT_TOKEN }}"
- name: Install dependencies
run: poetry install --all-extras

- name: Publish package
run: poetry publish -r owkin --build
76 changes: 76 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Python dev

on:
pull_request:
push:
branches:
- main
- master # Just in case the repo has the deprecated main branch name

jobs:
testing:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.9", "3.10"]
name: Testing Python ${{ matrix.python }}
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: Install Poetry
run: make install-poetry

- name: Pypi authentication
run: |
python -m poetry config virtualenvs.in-project false
python -m poetry config repositories.owkin https://pypi.owkin.com/simple/
python -m poetry config http-basic.owkin "${{ secrets.PYPI_USERNAME }}" "${{ secrets.PYPI_PASSWORD }}"
python -m poetry config repositories.seaborn_owkin https://github.com/owkin/seaborn_owkin.git
python -m poetry config http-basic.seaborn_owkin "${{ secrets.GIT_USERNAME }}" "${{ secrets.GIT_TOKEN }}"
- name: Install dependencies
run: poetry install --all-extras --with=testing

- name: Testing
run: poetry run make test

linting:
runs-on: ubuntu-latest
name: Test Linting
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"

- name: Install Poetry
run: make install-poetry

- name: Pypi authentication
run: |
python -m poetry config virtualenvs.in-project false
python -m poetry config repositories.owkin https://pypi.owkin.com/simple/
python -m poetry config http-basic.owkin "${{ secrets.PYPI_USERNAME }}" "${{ secrets.PYPI_PASSWORD }}"
python -m poetry config repositories.seaborn_owkin https://github.com/owkin/seaborn_owkin.git
python -m poetry config http-basic.seaborn_owkin "${{ secrets.GIT_USERNAME }}" "${{ secrets.GIT_TOKEN }}"
- name: Install dependencies
run: poetry install --all-extras --with=linting,docs

- name: Test pre-commit checks
run: poetry run make pre-commit-checks

- name: Test linting
run: poetry run make lint

- name: Test typing
run: poetry run make typing

- name: Test docs
run: poetry run make test-docs
141 changes: 141 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# IDE settings
.vscode/
.idea/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/
docs/api/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# OS
.DS_Store

# Others
notebooks/figures/*
notebooks/necrosis_enrichment/*
59 changes: 59 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
repos:
- repo: https://github.com/sirosen/check-jsonschema
rev: 0.27.0
hooks:
- id: check-github-actions
- id: check-github-workflows
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
name: Trim trailing whitespace
- id: end-of-file-fixer
name: Fix end of files
exclude: \.ipynb$
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
hooks:
- id: prettier
name: Format yaml files using `prettier`
files: \.(yaml|yml)$
- repo: https://github.com/python-poetry/poetry
rev: 1.6.0
hooks:
- id: poetry-check
name: Run poetry check to validate configuration
- repo: local
hooks:
# Linter
- id: ruff-linter
name: Lint with `ruff`
language: system
types: [python]
require_serial: true
entry: poetry run ruff check
args: [--fix]
files: ^(gbmosaic|tests)/
# Formatter
- id: ruff-format
name: Format with `ruff`
language: system
types: [python]
require_serial: true
entry: poetry run ruff format
files: ^(gbmosaic|tests)/
# Type checker
- id: mypy
name: Test typing with `mypy`
language: system
types: [python]
require_serial: true
entry: poetry run mypy
files: ^gbmosaic/
# Jupyter notebook formatter
- id: jupyter-nb-clear-output
name: Clear Jupyter notebook outputs
files: \.ipynb$
language: system
entry: poetry run jupyter nbconvert
args: [--ClearOutputPreprocessor.enabled=True, --inplace]
4 changes: 4 additions & 0 deletions .pydocstyle
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[pydocstyle]
convention = numpy
match = (?!_).*\.py
add_ignore = D105
Loading

0 comments on commit 8e56972

Please sign in to comment.