Skip to content

Commit 0902b79

Browse files
Cli (#1)
1 parent 88b1c1d commit 0902b79

25 files changed

+1661
-1
lines changed

.devcontainer/Dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.148.1/containers/python-3/.devcontainer/base.Dockerfile
2+
3+
# [Choice] Python version: 3, 3.9, 3.8, 3.7, 3.6
4+
ARG VARIANT="3"
5+
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
6+
7+
# [Option] Install Node.js
8+
ARG INSTALL_NODE="true"
9+
ARG NODE_VERSION="lts/*"
10+
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
11+
12+
# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image.
13+
# COPY requirements.txt /tmp/pip-tmp/
14+
# RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
15+
# && rm -rf /tmp/pip-tmp
16+
17+
# [Optional] Uncomment this section to install additional OS packages.
18+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
19+
# && apt-get -y install --no-install-recommends <your-package-list-here>
20+
21+
# [Optional] Uncomment this line to install global node packages.
22+
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1

.devcontainer/devcontainer.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "Python 3",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"context": "..",
6+
"args": {
7+
// Update 'VARIANT' to pick a Python version: 3, 3.6, 3.7, 3.8, 3.9
8+
"VARIANT": "3.8",
9+
// Options
10+
"INSTALL_NODE": "true",
11+
"NODE_VERSION": "lts/*"
12+
}
13+
},
14+
15+
// Set *default* container specific settings.json values on container create.
16+
"settings": {
17+
"terminal.integrated.shell.linux": "/bin/bash",
18+
"python.pythonPath": "/usr/local/bin/python",
19+
"python.linting.enabled": true,
20+
"python.linting.pylintEnabled": true,
21+
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
22+
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
23+
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
24+
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
25+
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
26+
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
27+
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
28+
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
29+
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
30+
},
31+
32+
// Add the IDs of extensions you want installed when the container is created.
33+
"extensions": [
34+
"ms-python.python"
35+
],
36+
37+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
38+
// "forwardPorts": [],
39+
40+
// Use 'postCreateCommand' to run commands after the container is created.
41+
// "postCreateCommand": "pip3 install --user -r requirements.txt",
42+
43+
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
44+
"remoteUser": "vscode"
45+
}

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
- OS: [e.g. iOS]
28+
- Browser [e.g. chrome, safari]
29+
- Version [e.g. 22]
30+
31+
**Smartphone (please complete the following information):**
32+
- Device: [e.g. iPhone6]
33+
- OS: [e.g. iOS8.1]
34+
- Browser [e.g. stock browser, safari]
35+
- Version [e.g. 22]
36+
37+
**Additional context**
38+
Add any other context about the problem here.
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/workflows/publish-to-pypi.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Publish to PYPI
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
build-n-publish:
7+
runs-on: ubuntu-18.04
8+
steps:
9+
- uses: actions/checkout@master
10+
- uses: actions/setup-python@v2
11+
- run: pip install poetry
12+
- run: poetry build
13+
- uses: pypa/gh-action-pypi-publish@master
14+
with:
15+
password: ${{ secrets.PYPI_PASSWORD }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Test Publish to PYPI
2+
on: [pull_request]
3+
jobs:
4+
build-n-publish:
5+
runs-on: ubuntu-18.04
6+
steps:
7+
- uses: actions/checkout@master
8+
- uses: actions/setup-python@v2
9+
- run: pip install poetry
10+
- name: Set poetry version to dev
11+
run: |
12+
build_version="$(poetry version -s).dev$(date +%s)"
13+
poetry version $build_version
14+
- run: poetry build
15+
- name: Publish distribution to Test PyPI
16+
uses: pypa/gh-action-pypi-publish@master
17+
with:
18+
password: ${{ secrets.TEST_PYPI_PASSWORD }}
19+
repository_url: https://test.pypi.org/legacy/

.github/workflows/test.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Pytest
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
pytest:
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
cfg:
14+
- os: ubuntu-latest
15+
python-version: "3.7"
16+
- os: ubuntu-latest
17+
python-version: "3.8"
18+
- os: ubuntu-latest
19+
python-version: "3.9"
20+
- os: macos-latest
21+
python-version: "3.7"
22+
pytest-opts: "-m 'not docker'"
23+
- os: macos-latest
24+
python-version: "3.8"
25+
pytest-opts: "-m 'not docker'"
26+
- os: macos-latest
27+
python-version: "3.9"
28+
pytest-opts: "-m 'not docker'"
29+
30+
runs-on: ${{ matrix.cfg.os }}
31+
steps:
32+
- uses: actions/checkout@v2
33+
- uses: actions/setup-python@v2
34+
with:
35+
python-version: ${{ matrix.cfg.python-version }}
36+
- run: pip install poetry
37+
- run: poetry install
38+
- uses: pre-commit/[email protected]
39+
with:
40+
extra_args: --verbose --all-files
41+
42+
- run: poetry run pytest ${{ matrix.cfg.pytest-opts }}

.gitignore

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
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+
.DS_store
132+
typeshed
133+
134+
trash
135+
**/_build
136+
137+
.vscode
138+
139+
_whaler

.pre-commit-config.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v3.3.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- repo: https://github.com/kynan/nbstripout
7+
rev: master
8+
hooks:
9+
- id: nbstripout
10+
- repo: https://github.com/ambv/black
11+
rev: stable
12+
hooks:
13+
- id: black
14+
files: '(src|tests).*py'
15+
- repo: https://github.com/PyCQA/isort
16+
rev: 5.6.4
17+
hooks:
18+
- id: isort
19+
args: ["-m", "3", "--tc"]
20+
- repo: local
21+
hooks:
22+
- id: poetry
23+
name: sync setup.py with poetry
24+
entry: |
25+
bash -c ' \
26+
V=$(poetry version -s);
27+
poetry build && tar -xvf dist/whaler-$V.tar.gz -C dist && diff dist/whaler-$V/setup.py setup.py \
28+
|| cp dist/whaler-$V/setup.py setup.py \
29+
'
30+
language: system
31+
pass_filenames: false
32+
files: pyproject.toml|poetry.lock
33+
- repo: local
34+
hooks:
35+
- id: install typeshed
36+
name: typeshed
37+
entry: bash -c 'git clone -q https://github.com/python/typeshed.git || (cd typeshed && git checkout 9af49c0)'
38+
language: system
39+
pass_filenames: false
40+
- repo: local
41+
hooks:
42+
- id: pyright
43+
name: pyright
44+
entry: poetry run pyright
45+
language: node
46+
pass_filenames: false
47+
types: [python]
48+
additional_dependencies: ["[email protected]"]

0 commit comments

Comments
 (0)