Skip to content

Commit

Permalink
add linting, sync some files with nf-core. try better container setup
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVCaron committed Jan 11, 2024
1 parent 3dcc3fe commit e7dc8cd
Show file tree
Hide file tree
Showing 11 changed files with 122 additions and 4 deletions.
37 changes: 36 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,43 @@
},
"customizations": {
"vscode": {
"settings": {
"pythonIndent.keepHangingBracketOnLine": true,
"pythonIndent.trimLinesWithOnlyWhitespace": true,
"python.createEnvironment.trigger": "off",
"python.languageServer": "Pylance",
"python.missingPackage.severity": "Warning",
"python.poetryPath": "/root/.local/bin/poetry",
"python.terminal.activateEnvInCurrentTerminal": true,
"python.terminal.focusAfterLaunch": true,
"python.testing.promptToConfigure": false,
"python.analysis.autoFormatStrings": true,
"python.analysis.autoImportCompletions": true,
"python.analysis.completeFunctionParens": true,
"python.analysis.exclude": [
"${workspaceFolder}/.dvc",
"${workspaceFolder}/.pytest_cache",
"${workspaceFolder}/.test_data",
"${workspaceFolder}/.vscode",
"${workspaceFolder}/nf-scil-extensions",
"**/__pycache__",
"${workspaceFolder}/.git"
],
"python.analysis.ignore": [
"${workspaceFolder}/.dvc",
"${workspaceFolder}/.pytest_cache",
"${workspaceFolder}/.test_data",
"${workspaceFolder}/.vscode",
"${workspaceFolder}/nf-scil-extensions",
"**/__pycache__",
"${workspaceFolder}/.git"
],
"python.analysis.importFormat": "relative",
"python.analysis.logLevel": "Warning"
},
"extensions": [
"AlexVCaron.nf-scil-extensions"
"AlexVCaron.nf-scil-extensions",
"ms-python.autopep8"
]
}
},
Expand Down
8 changes: 5 additions & 3 deletions .devcontainer/setup_container.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env bash

poetry install
mkdir /nf-scil-poetry-venv
ln -s /nf-scil-poetry-venv .venv
#poetry install --no-root
#echo "export PROFILE=docker" >> ~/.bashrc

echo "poetry shell" >> ~/.bashrc
echo "export PROFILE=docker" >> ~/.bashrc
#
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_size = 4
indent_style = space

[*.{md,yml,yaml,html,css,scss,js,cff}]
indent_size = 2
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.pytest_cache/
.work/
.venv/
.nextflow*
*.pyc
*.vsix
Expand Down
13 changes: 13 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
repos:
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v2.7.1"
hooks:
- id: prettier
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
email_template.html
adaptivecard.json
slackreport.json
docs/api/_build
testing
nf_core/module-template/modules/meta.yml
nf_core/module-template/tests/test.yml
1 change: 1 addition & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
printWidth: 120
8 changes: 8 additions & 0 deletions .requirements.nf-core
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
black
isort
myst_parser
pytest-cov
pytest-datafiles
responses
Sphinx
sphinx-rtd-theme
2 changes: 2 additions & 0 deletions poetry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[virtualenvs]
in-project = true
6 changes: 6 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[pytest]
filterwarnings =
ignore::pytest.PytestRemovedIn8Warning:_pytest.nodes:140
testpaths =
tests
python_files = test_*.py
30 changes: 30 additions & 0 deletions sync-nf-core.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

nfcore_ver="$(poetry show nf-core | sed -n 's/\s*version\s\+:\s\+\([0-9.]\+\).*/\1/p')"
echo "version : $nfcore_ver"

wget -O /workspaces/nf-scil/.pre-commit-config.yaml \
https://github.com/nf-core/tools/raw/$nfcore_ver/.pre-commit-config.yaml

wget -O /workspaces/nf-scil/.editorconfig \
https://github.com/nf-core/tools/raw/$nfcore_ver/.editorconfig

wget -O /workspaces/nf-scil/.prettierignore \
https://github.com/nf-core/tools/raw/$nfcore_ver/.prettierignore

wget -O /workspaces/nf-scil/.prettierrc.yml \
https://github.com/nf-core/tools/raw/$nfcore_ver/.prettierrc.yml

wget -O /workspaces/nf-scil/pytest.ini \
https://github.com/nf-core/tools/raw/$nfcore_ver/pytest.ini

wget -O /workspaces/nf-scil/.requirements.nf-core.new \
https://github.com/nf-core/tools/raw/$nfcore_ver/requirements-dev.txt

touch .requirements.nf-core
cat .requirements.nf-core | xargs poetry remove
cat .requirements.nf-core.new | xargs poetry add
mv .requirements.nf-core.new .requirements.nf-core
poetry lock

pre-commit install --install-hooks

0 comments on commit e7dc8cd

Please sign in to comment.