Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasteuwen committed Oct 15, 2023
0 parents commit 6342fe0
Show file tree
Hide file tree
Showing 101 changed files with 7,510 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length = 120
extend-ignore = E203
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
A clear and concise description on how to reproduce the problem.

**Expected behavior**
A clear and concise description of what you expected to happen.

**Environment**
dlup version:
How installed:
Python version:
Operating System:

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixes #{issue number}
50 changes: 50 additions & 0 deletions .github/workflows/precommit_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# This action is triggered when a pull request review is submitted.
# It will run precommit checks only when the pull request is approved.
# Reference: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-when-a-pull-request-is-approved

name: Run Precommit Checks on PR Approval

on:
workflow_dispatch:
push:
branches:
- main
pull_request_review:
types: [submitted]

jobs:
# This job runs the precommit checks on the changed files.
run_precommit_checks:

# Ensures the job only runs when the PR review state is "approved".
if: github.event.review.state == 'approved'
runs-on: ubuntu-22.04

steps:
# Checkout the repository to the GitHub Actions runner.
- name: Checkout Repository
uses: actions/checkout@v4

# Set up the desired Python environment.
- name: Setup Python Environment
uses: actions/setup-python@v4
with:
python-version: '3.10.13'
cache: 'pip'

# Install the required dependencies for local repos in the precommit hooks
- name: Install Dependencies
run: pip install -r .github/workflows/requirements.txt

# Determine which python files have changed in the PR.
- name: Get Changed Files
id: changed-files
uses: tj-actions/changed-files@v36
with:
files: '*.py'

# Run the precommit hooks only on the changed files.
- name: Execute Precommit Hooks on Changed Files in PR
uses: pre-commit/action@v3.0.0
with:
extra_args: --files ${{ steps.changed-files.outputs.all_changed_files }}
3 changes: 3 additions & 0 deletions .github/workflows/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pylint==2.17.5
mypy==1.5.1
numpy==1.25.2
121 changes: 121 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# CMake
CMakeCache.txt
CMakeFiles

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# 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/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# dotenv
.env

# virtualenv
.venv
venv/
ENV/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

# IDE settings
.vscode/
.idea/

# Output of tests
dlup/preprocessors/tests/data/test_output

# OS files
.DS_Store


tools/logs
config/machine_settings/*
!config/machine_settings/example.yaml
37 changes: 37 additions & 0 deletions .mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[mypy]
plugins = numpy.typing.mypy_plugin

[mypy-h5py.*]
ignore_missing_imports = True

[mypy-pytorch_lightning.*]
ignore_missing_imports = True

[mypy-torchvision.*]
ignore_missing_imports = True

[mypy-torchmetrics.*]
ignore_missing_imports = True

[mypy-scipy.ndimage.*]
ignore_missing_imports = True

[mypy-kornia.*]
ignore_missing_imports = True

[mypy-shapely.*]
ignore_missing_imports = True

[mypy-tqdm.*]
ignore_missing_imports = True

[mypy-cv2.*]
ignore_missing_imports = True

; shouldn't this be in types-Pillow?
[mypy-PIL.*]
ignore_missing_imports = True

# TODO: This needs to be fixed obviously
[mypy-dlup.*]
ignore_errors = True
50 changes: 50 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
# Ignore the configuration files
hooks:
- id: flake8
exclude: ^docs/
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
- repo: local # Use pylint from local environment as it requires to import packages
hooks:
- id: mypy
name: mypy
entry: mypy
language: system
types: [python]
args: ["ahcore", "--strict"]
- repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
hooks:
- id: detect-secrets
- repo: local # Use pylint from local environment as it requires to import packages
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
args:
[
"-rn", # Only display messages
"-sn", # Don't display the score
"--errors-only" # Only show the errors
]
Loading

0 comments on commit 6342fe0

Please sign in to comment.