Skip to content

Commit c15de7a

Browse files
author
Zhixuan Lai
committed
Setup project
1 parent c798e3c commit c15de7a

File tree

107 files changed

+10442
-0
lines changed

Some content is hidden

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

107 files changed

+10442
-0
lines changed

.editorconfig

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
root = true
2+
3+
[*]
4+
tab_width = 4
5+
end_of_line = lf
6+
max_line_length = 88
7+
ij_visual_guides = 88
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.{js,py,html}]
12+
charset = utf-8
13+
14+
[*.md]
15+
trim_trailing_whitespace = false
16+
17+
[*.{yml,yaml}]
18+
indent_style = space
19+
indent_size = 2
20+
21+
[Makefile]
22+
indent_style = tab
23+
24+
[.flake8]
25+
indent_style = space
26+
indent_size = 2
27+
28+
[*.py]
29+
indent_style = space
30+
indent_size = 4
31+
ij_python_from_import_parentheses_force_if_multiline = true

.github/workflows/tests.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Testing iwf-python-sdk
2+
3+
on: push
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- name: Set up Python
11+
uses: actions/setup-python@v2
12+
with:
13+
python-version: '3.9'
14+
- name: Install deps
15+
uses: knowsuchagency/poetry-install@v1
16+
env:
17+
POETRY_VIRTUALENVS_CREATE: false
18+
- name: Run linters
19+
run: poetry run pre-commit run --show-diff-on-failure --color=always --all-files
20+
pytest:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v2
24+
- name: Set up Python
25+
uses: actions/setup-python@v2
26+
with:
27+
python-version: '3.9'
28+
- name: Install deps
29+
uses: knowsuchagency/poetry-install@v1
30+
env:
31+
POETRY_VIRTUALENVS_CREATE: false
32+
- name: Run pytest check
33+
run: poetry run pytest -vv --cov="iwf" .

.gitignore

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

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "iwf-idl"]
2+
path = iwf-idl
3+
url = https://github.com/indeedeng/iwf-idl

.openapi-python-client-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
project_name_override: iwf-api

.pre-commit-config.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
exclude: ^iwf-api/
4+
5+
repos:
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: v2.4.0
8+
hooks:
9+
- id: check-ast
10+
- id: trailing-whitespace
11+
- id: check-toml
12+
- id: end-of-file-fixer
13+
14+
- repo: https://github.com/asottile/add-trailing-comma
15+
rev: v2.1.0
16+
hooks:
17+
- id: add-trailing-comma
18+
19+
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
20+
rev: v2.1.0
21+
hooks:
22+
- id: pretty-format-yaml
23+
args:
24+
- --autofix
25+
- --preserve-quotes
26+
- --indent=2
27+
28+
- repo: https://github.com/hadialqattan/pycln
29+
rev: v1.1.0
30+
hooks:
31+
- id: pycln
32+
args: ["-a"]
33+
34+
- repo: https://github.com/ambv/black
35+
rev: 22.3.0
36+
hooks:
37+
- id: black
38+
language_version: python3
39+
40+
- repo: https://github.com/charliermarsh/ruff-pre-commit
41+
rev: "v0.0.267"
42+
hooks:
43+
- id: ruff
44+
45+
- repo: local
46+
hooks:
47+
48+
- id: isort
49+
name: isort
50+
entry: poetry run isort
51+
language: system
52+
types: [python]
53+
54+
- id: mypy
55+
name: Validate types with MyPy
56+
entry: poetry run mypy
57+
language: system
58+
types: [python]
59+
pass_filenames: false
60+
args:
61+
- "iwf"

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,22 @@ How does a user ask questions if they are stuck?
1616

1717
What does a user need to know if they want to start contributing? If this information is extensive, capture it in a CONTRIBUTING.md file and link to that file here.
1818

19+
Virtual environment setup:
20+
```bash
21+
poetry install
22+
```
23+
24+
Generate API client from IDL:
25+
```bash
26+
poetry add openapi-python-client
27+
poetry run openapi-python-client generate --path iwf-idl/iwf-sdk.yaml --config .openapi-python-client-config.yaml
28+
```
29+
30+
Lint
31+
```bash
32+
poetry run pre-commit run --show-diff-on-failure --color=always --all-files
33+
```
34+
1935
## Project Maintainers
2036

2137
Who are the project maintainers, and how can they be reached?

iwf-api/.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
__pycache__/
2+
build/
3+
dist/
4+
*.egg-info/
5+
.pytest_cache/
6+
7+
# pyenv
8+
.python-version
9+
10+
# Environments
11+
.env
12+
.venv
13+
14+
# mypy
15+
.mypy_cache/
16+
.dmypy.json
17+
dmypy.json
18+
19+
# JetBrains
20+
.idea/
21+
22+
/coverage.xml
23+
/.coverage

0 commit comments

Comments
 (0)