Skip to content
This repository was archived by the owner on Sep 19, 2023. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
42 changes: 42 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Checks

on: [push, pull_request]

jobs:
tests:
name: Tests
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

- name: Cache
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

- name: Lint
run: poetry run flake8

- name: Type check
run: poetry run mypy .

- name: Run tests
run: poetry run pytest .
16 changes: 16 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Publish to PyPI

on:
push:
tags:
- 'v*.*.*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build and publish to pypi
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}
23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
repos:
- repo: local
hooks:
- id: flake8
name: flake8
entry: poetry run flake8
types: [python]
language: system
stages: [push, commit]
- id: mypy
name: mypy
entry: poetry run mypy
types: [python]
language: system
stages: [push, commit]
- id: pytest
name: pytest
entry: poetry run pytest
types: [python]
language: system
pass_filenames: false
always_run: true
stages: [push, commit]
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,32 @@ ue-schedule <schedule_id>
You can install dependencies in a virtualenv with poetry

```bash
# create virtualenv, install dependencies and switch to the virtualenv
poetry install

# switch to the virtualenv
poetry shell
```

#### Linting and testing
```bash
# to lint and typecheck, in the root directory run:
flakehell lint
mypy .

# To run tests, run:
pytest

# there is a pre-commit hook that lints, typechecks and runs tests
# you can run it manually on all files with
pre-commit run -a
```

### Usage

```python
from ue_schedule import Schedule

# initialize the downloader
s = Schedule(schedule_id)
schedule = Schedule("<schedule id here>")

# get event list
schedule.get_events()
Expand Down
Loading