Skip to content

Commit f025f1f

Browse files
committed
Init project
0 parents  commit f025f1f

13 files changed

Lines changed: 489 additions & 0 deletions

.github/workflows/python-test.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# This workflow will install Python dependencies, run tests and lint with a single version of Python
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: Python test
5+
6+
on:
7+
push:
8+
branches:
9+
- "**" # Triggers on commits to all branches
10+
pull_request:
11+
branches:
12+
- "**" # Runs on all pull requests
13+
14+
jobs:
15+
build:
16+
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Set up Python 3.10
22+
uses: actions/setup-python@v3
23+
with:
24+
python-version: "3.10"
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install flake8 pytest
29+
pip install .
30+
- name: Lint with flake8
31+
run: |
32+
# stop the build if there are Python syntax errors or undefined names
33+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
34+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
35+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
36+
- name: Test with pytest
37+
run: |
38+
pytest

.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+
# 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+
target/
76+
77+
# Jupyter Notebook
78+
.ipynb_checkpoints
79+
80+
# IPython
81+
profile_default/
82+
ipython_config.py
83+
84+
# pyenv
85+
.python-version
86+
87+
# pipenv
88+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91+
# install all needed dependencies.
92+
#Pipfile.lock
93+
94+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
95+
__pypackages__/
96+
97+
# Celery stuff
98+
celerybeat-schedule
99+
celerybeat.pid
100+
101+
# SageMath parsed files
102+
*.sage.py
103+
104+
# Environments
105+
.env
106+
.venv
107+
env/
108+
venv/
109+
ENV/
110+
env.bak/
111+
venv.bak/
112+
113+
# Spyder project settings
114+
.spyderproject
115+
.spyproject
116+
117+
# Rope project settings
118+
.ropeproject
119+
120+
# mkdocs documentation
121+
/site
122+
123+
# mypy
124+
.mypy_cache/
125+
.dmypy.json
126+
dmypy.json
127+
128+
# Pyre type checker
129+
.pyre/
130+
131+
output/

.pre-commit-config.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: check-added-large-files
6+
- id: check-case-conflict
7+
- id: check-merge-conflict
8+
- id: check-symlinks
9+
- id: check-yaml
10+
- id: debug-statements
11+
- id: end-of-file-fixer
12+
- id: mixed-line-ending
13+
- id: requirements-txt-fixer
14+
- id: trailing-whitespace
15+
- repo: https://github.com/psf/black
16+
rev: 23.3.0
17+
hooks:
18+
- id: black
19+
language_version: python3.10
20+
- repo: https://github.com/PyCQA/isort
21+
rev: 5.12.0
22+
hooks:
23+
- id: isort
24+
name: isort (python)
25+
additional_dependencies: ["toml"]
26+
- repo: https://github.com/hadialqattan/pycln
27+
rev: v1.2.5
28+
hooks:
29+
- id: pycln
30+
args: [--config=pyproject.toml]
31+
stages: [manual]

.vscode/settings.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"editor.formatOnSave": true,
3+
"editor.formatOnPaste": true,
4+
"files.trimTrailingWhitespace": true,
5+
"files.autoSave": "onFocusChange",
6+
"git.autofetch": true,
7+
"[jsonc]": {
8+
"editor.defaultFormatter": "vscode.json-language-features"
9+
},
10+
"[python]": {
11+
"editor.defaultFormatter": "ms-python.black-formatter"
12+
},
13+
"python.formatting.provider": "black",
14+
"python.testing.unittestEnabled": false,
15+
"python.testing.pytestEnabled": true,
16+
"pylint.args": [
17+
"--rcfile=pyproject.toml"
18+
],
19+
"black-formatter.args": [
20+
"--config=pyproject.toml"
21+
],
22+
"flake8.args": [
23+
"--toml-config=pyproject.toml"
24+
],
25+
"isort.args": [
26+
"--settings-path=pyproject.toml"
27+
]
28+
}

Makefile

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
.PHONY: help install lint clean test
2+
3+
# You can specify exact version of python3 or venv name as environment variable
4+
PYTHON_VERSION?=python3.10
5+
VENV_NAME?=venv
6+
7+
SRC_DIR=brain
8+
9+
VENV_BIN=$(shell pwd)/${VENV_NAME}/bin
10+
VENV_ACTIVATE=. $(VENV_NAME)/bin/activate
11+
12+
PYTHON=${VENV_NAME}/bin/python3
13+
14+
15+
.DEFAULT: help
16+
help:
17+
@echo "Make file commands:"
18+
@echo " make install"
19+
@echo " Prepare complete development environment"
20+
@echo " make lint"
21+
@echo " Run pylint and flake8"
22+
@echo " make test"
23+
@echo " Run python tests of algorithm"
24+
@echo " make clean"
25+
@echo " Clean repository"
26+
27+
install:
28+
# sudo apt -y install build-essential $(PYTHON_VERSION) $(PYTHON_VERSION)-dev $(PYTHON_VERSION)-distutils
29+
${PYTHON_VERSION} -m pip install -U pip
30+
${PYTHON_VERSION} -m pip install virtualenv
31+
make venv
32+
${VENV_ACTIVATE}; pre-commit install
33+
${PYTHON} -m pip install -e .
34+
35+
36+
# Runs when the file changes
37+
venv: $(VENV_NAME)/bin/activate
38+
$(VENV_NAME)/bin/activate: requirements.txt requirements-dev.txt
39+
test -d $(VENV_NAME) || $(PYTHON_VERSION) -m virtualenv -p $(PYTHON_VERSION) $(VENV_NAME)
40+
${PYTHON} -m pip install -U pip
41+
${PYTHON} -m pip install -r requirements.txt -r requirements-dev.txt
42+
touch $(VENV_NAME)/bin/activate
43+
44+
clean:
45+
find . -name '*.pyc' -exec rm --force {} +
46+
rm -rf $(VENV_NAME) *.eggs *.egg-info dist build docs/_build .cache
47+
48+
test:
49+
${PYTHON} -m pytest --cov=$(SRC_DIR)
50+
51+
lint:
52+
${PYTHON} -m flake8 --toml-config=pyproject.toml $(SRC_DIR)
53+
${PYTHON} -m pylint --rcfile=pyproject.toml $(SRC_DIR)

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# World Quant Brain
2+
3+
Code for creating and submitting alphas for World Quant Brain
4+
5+
## Set-up
6+
7+
Install **Python 3.10** or above and install necessary dependencies:
8+
9+
```bash
10+
pip install -r requirements.txt -r requirements-dev.txt
11+
# Install learning_mf package in editable mode
12+
pip install -e .
13+
```
14+
15+
After that you can open and run jupyter notebooks in [`notebooks/`](./notebooks/) folder.
16+
17+
### Make file
18+
19+
As an alternative you can use the Makefile to set up the environment. The following command
20+
21+
```bash
22+
make install
23+
```
24+
25+
will create virtual environment in `venv/` folder and install all required packages.
26+
27+
## Development
28+
29+
For development of code and commiting into git repository, run following command before making any commits:
30+
31+
```bash
32+
pre-commit install
33+
```

brain/__init__.py

Whitespace-only changes.

brain/main.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"""Main module of the project."""
2+
3+
4+
def main():
5+
print("Test")
6+
7+
8+
if __name__ == "__main__":
9+
main()

0 commit comments

Comments
 (0)