Skip to content

Commit 76e8c1b

Browse files
committed
Initial commit
0 parents  commit 76e8c1b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+13738
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
### Describe the bug
11+
A clear and concise description of what the bug is.
12+
13+
### To Reproduce
14+
Code snippet or clear steps to reproduce the behaviour.
15+
16+
### Expected behavior
17+
A clear and concise description of what you expected to happen.
18+
19+
### Screenshots
20+
If applicable, add screenshots to help explain your problem.
21+
22+
### Version
23+
- Version info such as v0.1.0
24+
25+
### Additional context
26+
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blank_issues_enabled: false
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
### Is your feature request related to a problem? Please describe.
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
### Describe the solution you'd like
14+
A clear and concise description of what you want to happen.
15+
16+
### Describe alternatives you've considered
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
### Additional context
20+
Add any other context or screenshots about the feature request here.

.github/pull_request_template.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# PR Type
2+
[Feature | Fix | Documentation | Refactor | Other]
3+
4+
# Short Description
5+
Add a short description of what is in this PR.
6+
7+
# Tests Added
8+
Describe the tests that have been added to ensure the codes correctness, if applicable.

.github/workflows/code_checks.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: code checks
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- .pre-commit-config.yaml
9+
- .github/workflows/code_checks.yml
10+
- '**.py'
11+
- poetry.lock
12+
- pyproject.toml
13+
- '**.ipynb'
14+
pull_request:
15+
branches:
16+
- main
17+
paths:
18+
- .pre-commit-config.yaml
19+
- .github/workflows/code_checks.yml
20+
- '**.py'
21+
- poetry.lock
22+
- pyproject.toml
23+
- '**.ipynb'
24+
25+
jobs:
26+
run-code-check:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/[email protected]
30+
- name: Install and configure Poetry
31+
uses: snok/install-poetry@v1
32+
with:
33+
virtualenvs-create: true
34+
virtualenvs-in-project: true
35+
- uses: actions/[email protected]
36+
with:
37+
python-version: '3.9'
38+
cache: 'poetry'
39+
- name: Install dependencies and check code
40+
run: |
41+
poetry env use '3.9'
42+
source .venv/bin/activate
43+
poetry install --with test --all-extras
44+
pre-commit run --all-files
45+
- name: pip-audit (gh-action-pip-audit)
46+
uses: pypa/[email protected]
47+
with:
48+
virtual-environment: .venv/
49+
ignore-vulns: GHSA-cqh9-jfqr-h9jj
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: integration tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- .pre-commit-config.yaml
9+
- .github/workflows/code_checks.yml
10+
- .github/workflows/integration_tests.yml
11+
- '**.py'
12+
- '**.ipynb'
13+
- poetry.lock
14+
- pyproject.toml
15+
- '**.rst'
16+
- '**.md'
17+
pull_request:
18+
branches:
19+
- main
20+
paths:
21+
- .pre-commit-config.yaml
22+
- .github/workflows/code_checks.yml
23+
- .github/workflows/integration_tests.yml
24+
- '**.py'
25+
- '**.ipynb'
26+
- poetry.lock
27+
- pyproject.toml
28+
- '**.rst'
29+
- '**.md'
30+
31+
jobs:
32+
integration-tests:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/[email protected]
36+
- name: Install poetry
37+
run: python3 -m pip install --upgrade pip && python3 -m pip install poetry
38+
- uses: actions/[email protected]
39+
with:
40+
python-version: '3.9'
41+
- name: Install dependencies and check code
42+
run: |
43+
poetry env use '3.9'
44+
source $(poetry env info --path)/bin/activate
45+
poetry install --with test
46+
pytest -m integration_test

.github/workflows/publish.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: publish package
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
deploy:
9+
name: Upload release to PyPI
10+
runs-on: ubuntu-latest
11+
environment:
12+
name: pypi
13+
url: https://pypi.org/p/mmlearn
14+
permissions:
15+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
16+
steps:
17+
- name: Install apt dependencies
18+
run: |
19+
sudo apt-get update
20+
sudo apt-get install libcurl4-openssl-dev libssl-dev
21+
- uses: actions/[email protected]
22+
- name: Install poetry
23+
run: python3 -m pip install --upgrade pip && python3 -m pip install poetry
24+
- uses: actions/[email protected]
25+
with:
26+
python-version: '3.9'
27+
- name: Build package
28+
run: poetry build
29+
- name: Publish package
30+
uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Sphinx documentation
59+
docs/_build/
60+
61+
# PyBuilder
62+
target/
63+
64+
# Jupyter Notebook
65+
.ipynb_checkpoints
66+
67+
# IPython
68+
profile_default/
69+
ipython_config.py
70+
71+
# pyenv
72+
.python-version
73+
74+
# pipenv
75+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
76+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
77+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
78+
# install all needed dependencies.
79+
#Pipfile.lock
80+
81+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
82+
__pypackages__/
83+
84+
# Celery stuff
85+
celerybeat-schedule
86+
celerybeat.pid
87+
88+
# SageMath parsed files
89+
*.sage.py
90+
91+
# Environments
92+
.env
93+
.venv
94+
env/
95+
venv/
96+
ENV/
97+
env.bak/
98+
venv.bak/
99+
100+
# Spyder project settings
101+
.spyderproject
102+
.spyproject
103+
104+
# Rope project settings
105+
.ropeproject
106+
107+
# mkdocs documentation
108+
/site
109+
110+
# mypy
111+
.mypy_cache/
112+
.dmypy.json
113+
dmypy.json
114+
115+
# Pyre type checker
116+
.pyre/
117+
118+
# pycharm
119+
.idea/
120+
121+
# vscode
122+
.vscode/
123+
124+
# wandb
125+
wandb/
126+
127+
# hydra
128+
outputs/
129+
130+
# slurm
131+
*slurm-*

.pre-commit-config.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.6.0 # Use the ref you want to point at
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: check-ast
7+
- id: check-builtin-literals
8+
- id: check-docstring-first
9+
- id: check-executables-have-shebangs
10+
- id: debug-statements
11+
- id: end-of-file-fixer
12+
- id: mixed-line-ending
13+
args: [--fix=lf]
14+
- id: detect-private-key
15+
- id: check-yaml
16+
- id: check-toml
17+
18+
- repo: https://github.com/python-poetry/poetry
19+
rev: 1.8.3
20+
hooks:
21+
- id: poetry-check
22+
args: [--lock]
23+
24+
- repo: https://github.com/astral-sh/ruff-pre-commit
25+
rev: v0.5.7
26+
hooks:
27+
- id: ruff
28+
args: [--fix, --exit-non-zero-on-fix]
29+
types_or: [ python, pyi, jupyter ]
30+
- id: ruff-format
31+
types_or: [ python, pyi, jupyter ]
32+
33+
- repo: https://github.com/crate-ci/typos
34+
rev: v1.23.6
35+
hooks:
36+
- id: typos
37+
args: []
38+
39+
- repo: https://github.com/pre-commit/mirrors-mypy
40+
rev: v1.11.1
41+
hooks:
42+
- id: mypy
43+
entry: python3 -m mypy --show-error-codes --pretty --config-file pyproject.toml
44+
types: [python]
45+
exclude: "tests"
46+
47+
- repo: https://github.com/nbQA-dev/nbQA
48+
rev: 1.8.7
49+
hooks:
50+
- id: nbqa-ruff
51+
args: [--fix, --exit-non-zero-on-fix]
52+
53+
- repo: local
54+
hooks:
55+
- id: pytest
56+
name: pytest
57+
language: system
58+
entry: python3 -m pytest -m "not integration_test"
59+
pass_filenames: false
60+
always_run: true

0 commit comments

Comments
 (0)