Skip to content

Commit

Permalink
Latest development (#3)
Browse files Browse the repository at this point in the history
* docs init

* docs for concurrency

* method as metaclass instead of wrapper

* serializer docs update

* pandas method docs

* polars method docs

* pandas serializer docs

* polars serializer docs

* mkdocs dependencies

* prefect serializer type and method discriminators

* versioneer and build

* build fix

* github test and release workflows

* fixed index page

* mit license

* workflow pipenv dependency fix
  • Loading branch information
dominictarro authored Jun 16, 2023
1 parent f1165c7 commit d97a5d3
Show file tree
Hide file tree
Showing 30 changed files with 1,487 additions and 271 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
* text=autosrc/prefecto/_version.py export-subst
80 changes: 80 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Build & Release

on:
push:
tags:
- "v*"

jobs:
build-release:
name: Build Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.7

- name: Install packages
run: |
python -m pip install --upgrade pip build
python -m pip install pipenv
pipenv install --dev --skip-lock
- name: Build a binary wheel and a source tarball
run: |
python -m build --sdist --wheel --outdir dist/
- name: Publish build artifacts
uses: actions/upload-artifact@v3
with:
name: built-package
path: "./dist"

publish-release:
name: Publish release to PyPI
needs: [build-release]
environment: "prod"
runs-on: ubuntu-latest

steps:
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: built-package
path: './dist'

- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}
verbose: true

build-and-publish-docs:
name: Build and publish docs
needs: [build-release, publish-release]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: pip
cache-dependency-path: Pipfile

- name: Build docs
run: |
python -m pip install --upgrade pip pyOpenSSL pipenv
pipenv install --dev --skip-lock
mkdocs build
- name: Publish docs
uses: JamesIves/[email protected]
with:
branch: docs
folder: site
42 changes: 42 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Static analysis

on: [pull_request]

permissions:
contents: read

# Limit concurrency by workflow/branch combination.
#
# For pull request builds, pushing additional changes to the
# branch will cancel prior in-progress and pending builds.
#
# For builds triggered on a branch push, additional changes
# will wait for prior builds to complete before starting.
#
# https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
pre-commit-checks:
name: Pre-commit checks
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
persist-credentials: false

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install pre-commit
run: |
pip install pre-commit
- name: Run pre-commit
run: |
pre-commit run --show-diff-on-failure --color=always --all-files
42 changes: 42 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Tests

on: [pull_request]

jobs:
run-tests:
name: Run Tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
fail-fast: false
steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: Pipfile

- name: Install dependencies
run: |
python -m pip install --upgrade pip pipenv
pipenv install --dev --skip-lock
- name: Run tests
env:
PREFECT_SERVER_DATABASE_CONNECTION_URL: "sqlite+aiosqlite:///./collection-tests.db"
run: |
prefect server database reset -y
coverage run --branch -m pytest tests -vv
coverage report
- name: Run mkdocs build
run: |
mkdocs build --verbose --clean
7 changes: 0 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,3 @@ repos:
- id: interrogate
args: [-vv]
pass_filenames: false
- repo: local
hooks:
- name: pytest
id: pytest
language: system
entry: make run-tests
stages: [push]
2 changes: 0 additions & 2 deletions Makefile

This file was deleted.

4 changes: 4 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ black = "*"
isort = "*"
pytest = "*"
interrogate = "*"
mkdocs = "*"
mkdocstrings = {extras = ["python"], version = "*"}
versioneer = "*"
coverage = "*"

[requires]
python_version = "3.11"
Expand Down
Binary file added docs/assets/pacha-prefecto.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions docs/batch_task.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# BatchTask

::: src.prefecto.concurrency.BatchTask
options:
members:
- map
5 changes: 5 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Prefecto

![Pacha papi](./assets/pacha-prefecto.jpeg)

A handy helper for [Prefect](https://www.prefect.io/) development.
23 changes: 23 additions & 0 deletions docs/license.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# License

MIT License

Copyright (c) 2023 Dominic Tarro

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
10 changes: 10 additions & 0 deletions docs/serializers/extended_serializer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# ExtendedSerializer

Type: `ext`

::: src.prefecto.serializers.core.ExtendedSerializer
options:
members:
- get_method
- dumps
- loads
5 changes: 5 additions & 0 deletions docs/serializers/functions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Functions

## get_method

::: src.prefecto.serializers.core.get_method
7 changes: 7 additions & 0 deletions docs/serializers/method.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Method

::: src.prefecto.serializers.core.Method
options:
members:
- read
- write
67 changes: 67 additions & 0 deletions docs/serializers/pandas/methods.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Methods

`Method` classes for serializing `pandas.DataFrame`.

## CSV

Discriminator: `pandas.csv`

::: src.prefecto.serializers.pandas.CSV
options:
show_source: true

## Excel

Discriminator: `pandas.excel`

::: src.prefecto.serializers.pandas.Excel
options:
show_source: true

## Feather

Discriminator: `pandas.feather`

::: src.prefecto.serializers.pandas.Feather
options:
show_source: true

## JSON

Discriminator: `pandas.json`

::: src.prefecto.serializers.pandas.JSON
options:
show_source: true

## JSONL

Discriminator: `pandas.jsonl`

::: src.prefecto.serializers.pandas.JSONL
options:
show_source: true

## Parquet

Discriminator: `pandas.parquet`

::: src.prefecto.serializers.pandas.Parquet
options:
show_source: true

## Pickle

Discriminator: `pandas.pickle`

::: src.prefecto.serializers.pandas.Pickle
options:
show_source: true

## TSV

Discriminator: `pandas.tsv`

::: src.prefecto.serializers.pandas.TSV
options:
show_source: true
7 changes: 7 additions & 0 deletions docs/serializers/pandas/pandas_serializer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# PandasSerializer

Type: `pandas`

::: src.prefecto.serializers.pandas.PandasSerializer
options:
show_source: true
51 changes: 51 additions & 0 deletions docs/serializers/polars/methods.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Methods

`Method` classes for serializing `polars.DataFrame`.

## CSV

Discriminator: `polars.csv`

::: src.prefecto.serializers.polars.CSV
options:
show_source: true

## Excel

Discriminator: `polars.excel`

::: src.prefecto.serializers.polars.Excel
options:
show_source: true

## JSON

Discriminator: `polars.json`

::: src.prefecto.serializers.polars.JSON
options:
show_source: true

## NDJSON

Discriminator: `polars.ndjson`

::: src.prefecto.serializers.polars.NDJSON
options:
show_source: true

## Parquet

Discriminator: `polars.parquet`

::: src.prefecto.serializers.polars.Parquet
options:
show_source: true

## TSV

Discriminator: `polars.tsv`

::: src.prefecto.serializers.polars.TSV
options:
show_source: true
7 changes: 7 additions & 0 deletions docs/serializers/polars/polars_serializer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# PolarsSerializer

Type: `polars`

::: src.prefecto.serializers.polars.PolarsSerializer
options:
show_source: true
Loading

0 comments on commit d97a5d3

Please sign in to comment.