Skip to content

Commit 6aab106

Browse files
authored
Initial commit
0 parents  commit 6aab106

File tree

11 files changed

+492
-0
lines changed

11 files changed

+492
-0
lines changed

.flake8

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[flake8]
2+
max-line-length = 100
3+
exclude = .venv
4+
ignore =
5+
# disable, whitespace before ':' https://github.com/TCLResearchEurope/ctw-pre-commit-hooks/issues/3
6+
E203,
7+
# disable "too many leading '#' for block comment"
8+
E266,
9+
# disable "line break before binary operator" which clashes with black
10+
W503,
11+
# disable "invalid escape sequence"
12+
W605,

.github/pull_request_template.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Description
2+
3+
<!-- Please include a summary of the change and motivation for it. -->
4+
5+
# Secondary changes
6+
7+
<!-- If your PR includes other small changes like bugfixes and documentation
8+
improvements, mention them here. If not, feel free to delete this section
9+
or leave it blank. -->
10+
11+
# Outcome/Conclusion
12+
13+
<!-- If your PR includes experiments or other forms of research, briefly
14+
comment what the results of the experiment means for the future.
15+
16+
Example, if the PR is about trying out a new data augmentation technique:
17+
18+
"Using this form of data augmentation improved results for Logo CNN and
19+
Vachetta CNN, but not the other models. In particular, metrics got much worse
20+
for Coated Canvas."
21+
22+
Feel free to delete this section or leave it blank if it doesn't apply to your
23+
PR.
24+
-->
25+
26+
# Metrics
27+
28+
<!-- If your PR changes a model in a way that changes its evaluation
29+
metrics significantly, and you want to showcase the change in metrics,
30+
you can add a section here mentioning which model the metrics are
31+
related to.
32+
33+
Feel free to delete this section or leave it blank if it doesn't apply to your
34+
PR.
35+
-->

.github/workflows/style-checks.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Style check
2+
3+
on: push
4+
5+
jobs:
6+
style-check:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout repo
10+
uses: actions/checkout@v3
11+
12+
- name: Setup Python
13+
uses: actions/setup-python@v4
14+
15+
- name: Install Poetry
16+
uses: snok/install-poetry@v1
17+
with:
18+
virtualenvs-create: true
19+
virtualenvs-in-project: true
20+
21+
# Allow loading a cached venv created in a previous run if the lock file is identical
22+
- name: Load cached venv if it exists
23+
id: venv-cache
24+
uses: actions/cache@v3
25+
with:
26+
path: .venv
27+
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock', '**/pyproject.toml') }}
28+
29+
- name: Install dependencies
30+
if: steps.venv-cache.outputs.cache-hit != 'true'
31+
run: poetry install --no-interaction
32+
33+
- name: Check format with black
34+
run: poetry run black --check .
35+
36+
- name: Check style with flake8
37+
run: poetry run flake8 .
38+
39+
- name: Check import sorting with isort
40+
run: poetry run isort --check .

.gitignore

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
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+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# poetry
98+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102+
#poetry.lock
103+
104+
# pdm
105+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106+
#pdm.lock
107+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108+
# in version control.
109+
# https://pdm.fming.dev/#use-with-ide
110+
.pdm.toml
111+
112+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113+
__pypackages__/
114+
115+
# Celery stuff
116+
celerybeat-schedule
117+
celerybeat.pid
118+
119+
# SageMath parsed files
120+
*.sage.py
121+
122+
# Environments
123+
.env
124+
.venv
125+
env/
126+
venv/
127+
ENV/
128+
env.bak/
129+
venv.bak/
130+
131+
# Spyder project settings
132+
.spyderproject
133+
.spyproject
134+
135+
# Rope project settings
136+
.ropeproject
137+
138+
# mkdocs documentation
139+
/site
140+
141+
# mypy
142+
.mypy_cache/
143+
.dmypy.json
144+
dmypy.json
145+
146+
# Pyre type checker
147+
.pyre/
148+
149+
# pytype static type analyzer
150+
.pytype/
151+
152+
# Cython debug symbols
153+
cython_debug/
154+
155+
# PyCharm
156+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158+
# and can be added to the global gitignore or merged into this file. For a more nuclear
159+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160+
#.idea/
161+
162+
**/.DS_Store

.vscode/extensions.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"recommendations": [
3+
"ms-python.python",
4+
"ms-python.isort",
5+
"ms-python.flake8",
6+
"ms-python.black-formatter",
7+
"njpwerner.autodocstring",
8+
]
9+
}

.vscode/settings.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
//
3+
// Set correct python path to venv's one
4+
//
5+
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
6+
//
7+
// Very optional: type checking. Remove the line if your project doesn't really use or respect
8+
// type hints. You should give it a try, though. They're great.
9+
//
10+
"python.analysis.typeCheckingMode": "basic",
11+
//
12+
// Hide .venv from explorer and searchbar
13+
//
14+
"files.watcherExclude": {
15+
"**/.venv/**": true
16+
},
17+
"files.exclude": {
18+
"**/.venv/": true
19+
},
20+
"search.exclude": {
21+
"**/.venv/": true
22+
},
23+
//
24+
// Linting and formatting
25+
//
26+
"editor.formatOnSave": true,
27+
"editor.codeActionsOnSave": {
28+
"source.organizeImports": true
29+
},
30+
"black-formatter.importStrategy": "fromEnvironment",
31+
"isort.importStrategy": "fromEnvironment",
32+
"flake8.importStrategy": "fromEnvironment",
33+
"isort.args": ["--settings-path", "${workspaceFolder}/pyproject.toml"],
34+
"flake8.args": ["--config=${workspaceFolder}/.flake8"],
35+
"editor.rulers": [
36+
100 // if changing line length, also do it in .flake8 and pyproject.toml's [tool.black] section
37+
],
38+
"editor.wordWrapColumn": 100,
39+
"files.trimFinalNewlines": true,
40+
"files.trimTrailingWhitespace": true,
41+
//
42+
// Jupyter
43+
//
44+
"jupyter.notebookFileRoot": "${workspaceFolder}",
45+
"jupyter.interactiveWindow.textEditor.executeSelection": true,
46+
// TODO: this setting is showing a deprecation warning. Maybe we should drop it?
47+
"jupyter.generateSVGPlots": true,
48+
}

0 commit comments

Comments
 (0)