Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streaming datasets V2 #2

Merged
merged 37 commits into from
Aug 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
f28a97e
Initial commit.
knighton Aug 4, 2022
d2221b3
Fix missing reqts.
knighton Aug 8, 2022
c151af5
Fix (can be None).
knighton Aug 8, 2022
aca60fd
Fix (typo).
knighton Aug 8, 2022
ed0bd4d
Fix (typing annotations).
knighton Aug 8, 2022
3b5b861
Fix (missing reqts).
knighton Aug 8, 2022
ba06615
Run isort.
knighton Aug 8, 2022
ec22fc3
Import Dataset from (streaming.base -> streaming).
knighton Aug 8, 2022
a6c2258
.github/actions/, .github/workflows/
knighton Aug 9, 2022
a1347a5
makefile, pyproject.toml
knighton Aug 9, 2022
eaa3efe
setup.py
knighton Aug 9, 2022
efb9720
Make lint/style.
knighton Aug 9, 2022
1b43821
Fix (install_requires).
knighton Aug 9, 2022
36d443c
Type -> type.
knighton Aug 9, 2022
3a6a3f8
Typing.
knighton Aug 9, 2022
715b7c1
Docstring clarity.
knighton Aug 9, 2022
1d441c5
Guard private.
knighton Aug 9, 2022
2cd80ce
Same for hashing.
knighton Aug 9, 2022
bcfae34
Public/private.
knighton Aug 9, 2022
2e4a47f
abstractmethod, more public/private.
knighton Aug 9, 2022
2b35f1d
ABC.
knighton Aug 9, 2022
db693c4
classmethod abstractmethod.
knighton Aug 9, 2022
94c537a
Move test.py.
knighton Aug 9, 2022
8206600
Torch deps.
knighton Aug 9, 2022
c48f091
Fix (deps).
knighton Aug 9, 2022
05c0bf4
Fix (style).
knighton Aug 9, 2022
54083e0
Pull out example.
knighton Aug 9, 2022
7ac387c
Update README.md
knighton Aug 9, 2022
add0f61
Do the others.
knighton Aug 9, 2022
2e72074
Typing (undo PEP 585).
knighton Aug 9, 2022
3e6ff4f
Fix (s//g).
knighton Aug 9, 2022
9b42307
Fix (__init__.py).
knighton Aug 9, 2022
d352337
Fix (pytest).
knighton Aug 9, 2022
74bf805
Pyright.
knighton Aug 9, 2022
3ee0d2e
Pyright.
knighton Aug 9, 2022
dc1ce77
Fix setup.py.
knighton Aug 10, 2022
732bcb1
Lint.
knighton Aug 10, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/actions/isort/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: ISort
description: Sort imports
inputs:
working_directory:
required: true
description: Root of the repo. Should be set to GITHUB_WORKSPACE
args:
description: ISort args
default: ". -c -v"
required: false
runs:
using: composite
steps:
- name: Install ISort
shell: bash
working-directory: ${{ inputs.working_directory }}
run: |
set -ex
pip install isort
- name: Run ISort
shell: bash
working-directory: ${{ inputs.working_directory }}
env:
ISORT_ARGS: ${{ inputs.args }}
run: |
set -ex
isort ${ISORT_ARGS}
21 changes: 21 additions & 0 deletions .github/actions/pyright/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Pyright
inputs:
working_directory:
required: true
description: Directory containing the Makefile
runs:
using: composite
steps:
- name: Install Pyright
shell: bash
working-directory: ${{ inputs.working_directory }}
run: |
set -ex
sudo npm install -g pyright

- name: Run Pyright
shell: bash
working-directory: ${{ inputs.working_directory }}
run: |
set -ex
pyright
27 changes: 27 additions & 0 deletions .github/actions/yapf/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: YAPF
description: Format with YAPF
inputs:
working_directory:
required: true
description: Root of the repo. Should be set to GITHUB_WORKSPACE
args:
description: YAPF args
default: "-drp ."
required: false
runs:
using: composite
steps:
- name: Install YAPF
shell: bash
working-directory: ${{ inputs.working_directory }}
run: |
set -ex
pip install yapf
- name: Run YAPF
shell: bash
working-directory: ${{ inputs.working_directory }}
env:
YAPF_ARGS: ${{ inputs.args }}
run: |
set -ex
yapf ${YAPF_ARGS}
38 changes: 38 additions & 0 deletions .github/workflows/formatting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

name: Formatting
on:
pull_request: {}
workflow_dispatch: {}
defaults:
run:
working-directory: .
jobs:
formatting:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Cache pip
uses: actions/cache@v2
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py', 'requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Setup
run: |
set -ex
python -m pip install --upgrade pip wheel
python -m pip install -e .[dev]
- uses: ./.github/actions/yapf
with:
working_directory: ${{ github.workspace }}
- uses: ./.github/actions/isort
with:
working_directory: "${{ github.workspace }}"
47 changes: 47 additions & 0 deletions .github/workflows/install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: streaming-install
on:
push:
branches:
- main
- release/*
pull_request:
branches:
- main
- release/*
workflow_dispatch: {}
jobs:
streaming-Pip-Install:
timeout-minutes: 10
runs-on: ubuntu-latest
strategy:
matrix:
python_version:
- "3.8"
- "3.9"
install_version:
- ""
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version }}
- name: Cache pip
uses: actions/cache@v2
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Setup
run: |
set -exuo pipefail
python -m pip install --upgrade pip wheel
python -m pip install .${{ matrix.install_version }}
- name: Run import
id: tests
run: |
set -exuo pipefail
python -c "import streaming"
34 changes: 34 additions & 0 deletions .github/workflows/pyright.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Pyright
on:
pull_request: {}
workflow_dispatch: {}
defaults:
run:
working-directory: .
jobs:
pyright:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Cache pip
uses: actions/cache@v2
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py', 'extra-requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Setup
run: |
set -ex
python -m pip install --upgrade pip wheel
python -m pip install -e .[dev]
- uses: ./.github/actions/pyright
with:
working_directory: ${{ github.workspace }}
33 changes: 33 additions & 0 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Pytest
on:
pull_request: {}
workflow_dispatch: {}
jobs:
pytest:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Cache pip
uses: actions/cache@v2
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Setup
run: |
set -ex
python -m pip install --upgrade pip wheel
python -m pip install -e .[dev]
- name: Run Tests
id: tests
run: |
set -ex
python3 -m pytest
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,6 @@ dmypy.json

# Pyre type checker
.pyre/

*.swo
*.swp
25 changes: 25 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# several pytest settings
PYTHON ?= python # Python command
PYTEST ?= pytest # Pytest command
PYRIGHT ?= pyright # Pyright command. Pyright must be installed seperately -- e.g. `node install -g pyright`
EXTRA_ARGS ?= # extra arguments for pytest

dirs := streaming tests examples

# run this to autoformat your code
style:
$(PYTHON) -m isort $(dirs)
$(PYTHON) -m yapf -rip $(dirs)
$(PYTHON) -m docformatter -ri $(dirs)

# this only checks for style & pyright, makes no code changes
lint:
$(PYTHON) -m isort -c --diff $(dirs)
$(PYTHON) -m yapf -dr $(dirs)
$(PYTHON) -m docformatter -r $(dirs)
$(PYRIGHT) $(dirs)

test:
$(PYTHON) -m $(PYTEST) $(EXTRA_ARGS)

.PHONY: test lint style
Loading