Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
fcogidi committed Aug 9, 2024
0 parents commit 76e8c1b
Show file tree
Hide file tree
Showing 73 changed files with 13,738 additions and 0 deletions.
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: ''
assignees: ''

---

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

### To Reproduce
Code snippet or clear steps to reproduce the behaviour.

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

### Screenshots
If applicable, add screenshots to help explain your problem.

### Version
- Version info such as v0.1.0

### Additional context
Add any other context about the problem here.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
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: ''
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.
8 changes: 8 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# PR Type
[Feature | Fix | Documentation | Refactor | Other]

# Short Description
Add a short description of what is in this PR.

# Tests Added
Describe the tests that have been added to ensure the codes correctness, if applicable.
49 changes: 49 additions & 0 deletions .github/workflows/code_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: code checks

on:
push:
branches:
- main
paths:
- .pre-commit-config.yaml
- .github/workflows/code_checks.yml
- '**.py'
- poetry.lock
- pyproject.toml
- '**.ipynb'
pull_request:
branches:
- main
paths:
- .pre-commit-config.yaml
- .github/workflows/code_checks.yml
- '**.py'
- poetry.lock
- pyproject.toml
- '**.ipynb'

jobs:
run-code-check:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- uses: actions/[email protected]
with:
python-version: '3.9'
cache: 'poetry'
- name: Install dependencies and check code
run: |
poetry env use '3.9'
source .venv/bin/activate
poetry install --with test --all-extras
pre-commit run --all-files
- name: pip-audit (gh-action-pip-audit)
uses: pypa/[email protected]
with:
virtual-environment: .venv/
ignore-vulns: GHSA-cqh9-jfqr-h9jj
46 changes: 46 additions & 0 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: integration tests

on:
push:
branches:
- main
paths:
- .pre-commit-config.yaml
- .github/workflows/code_checks.yml
- .github/workflows/integration_tests.yml
- '**.py'
- '**.ipynb'
- poetry.lock
- pyproject.toml
- '**.rst'
- '**.md'
pull_request:
branches:
- main
paths:
- .pre-commit-config.yaml
- .github/workflows/code_checks.yml
- .github/workflows/integration_tests.yml
- '**.py'
- '**.ipynb'
- poetry.lock
- pyproject.toml
- '**.rst'
- '**.md'

jobs:
integration-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Install poetry
run: python3 -m pip install --upgrade pip && python3 -m pip install poetry
- uses: actions/[email protected]
with:
python-version: '3.9'
- name: Install dependencies and check code
run: |
poetry env use '3.9'
source $(poetry env info --path)/bin/activate
poetry install --with test
pytest -m integration_test
30 changes: 30 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: publish package

on:
release:
types: [published]

jobs:
deploy:
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/mmlearn
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Install apt dependencies
run: |
sudo apt-get update
sudo apt-get install libcurl4-openssl-dev libssl-dev
- uses: actions/[email protected]
- name: Install poetry
run: python3 -m pip install --upgrade pip && python3 -m pip install poetry
- uses: actions/[email protected]
with:
python-version: '3.9'
- name: Build package
run: poetry build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
131 changes: 131 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# 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

# Sphinx documentation
docs/_build/

# 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/

# pycharm
.idea/

# vscode
.vscode/

# wandb
wandb/

# hydra
outputs/

# slurm
*slurm-*
60 changes: 60 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0 # Use the ref you want to point at
hooks:
- id: trailing-whitespace
- id: check-ast
- id: check-builtin-literals
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
args: [--fix=lf]
- id: detect-private-key
- id: check-yaml
- id: check-toml

- repo: https://github.com/python-poetry/poetry
rev: 1.8.3
hooks:
- id: poetry-check
args: [--lock]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.7
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
types_or: [ python, pyi, jupyter ]
- id: ruff-format
types_or: [ python, pyi, jupyter ]

- repo: https://github.com/crate-ci/typos
rev: v1.23.6
hooks:
- id: typos
args: []

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.1
hooks:
- id: mypy
entry: python3 -m mypy --show-error-codes --pretty --config-file pyproject.toml
types: [python]
exclude: "tests"

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.8.7
hooks:
- id: nbqa-ruff
args: [--fix, --exit-non-zero-on-fix]

- repo: local
hooks:
- id: pytest
name: pytest
language: system
entry: python3 -m pytest -m "not integration_test"
pass_filenames: false
always_run: true
Loading

0 comments on commit 76e8c1b

Please sign in to comment.