Skip to content

Commit

Permalink
Merge pull request #1 from goodwanghan/setup
Browse files Browse the repository at this point in the history
Setup
  • Loading branch information
Han Wang authored Mar 24, 2020
2 parents b8a3442 + 98fe7d3 commit a5f734e
Show file tree
Hide file tree
Showing 14 changed files with 239 additions and 1 deletion.
28 changes: 28 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Lint

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: make devenv
- name: Lint
run: make lint
28 changes: 28 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Publish

on:
release:
types: [created]

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install dependencies
run: make devenv
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
make package
twine upload dist/*
28 changes: 28 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Test

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: make devenv
- name: Test
run: make test
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/

.vscode
tmp
38 changes: 38 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
default_language_version:
python: python3

exclude: ^tests/
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.5.0
hooks:
- id: check-ast
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-vcs-permalinks
- id: flake8
types: [python]
additional_dependencies:
- flake8-bugbear
- flake8-builtins
# - flake8-docstrings # TODO: add back!
# - flake8-rst-docstrings
- flake8-comprehensions
- flake8-tidy-imports
- pycodestyle
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.770
hooks:
- id: mypy
- repo: https://github.com/ambv/black
rev: stable
hooks:
- id: black
types: [python]
language_version: python3
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Han Wang

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.
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.PHONY: help clean dev docs package test

help:
@echo "The following make targets are available:"
@echo " devenv create venv and install all deps for dev env (assumes python3 cmd exists)"
@echo " dev install all deps for dev env (assumes venv is present)"
@echo " docs create pydocs for all relveant modules (assumes venv is present)"
@echo " package package for pypi"
@echo " test run all tests with coverage (assumes venv is present)"

devenv:
python3 -m venv venv
. venv/bin/activate
pip3 install -r requirements.txt

dev:
pip3 install -r requirements.txt

docs:
$(MAKE) -C docs html

lint:
pre-commit run --all-files

package:
rm -rf dist/*
python3 setup.py sdist
python3 setup.py bdist_wheel

test:
python3 -bb -m pytest tests/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# fugue
# Fugue
An abstraction layer for distributed computation
Empty file added fugue/__init__.py
Empty file.
15 changes: 15 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.

# test requirements
pre-commit
mypy
flake8
autopep8
pylint
pytest
pytest-cov
pytest-mock

# publish to pypi
wheel
twine
8 changes: 8 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[metadata]
description-file = README.md

[tool:pytest]
addopts =
--cov=fugue
--cov-report=term-missing:skip-covered
-vvv
36 changes: 36 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from setuptools import setup, find_packages

VERSION = "0.0.1"

with open("README.md") as f:
LONG_DESCRIPTION = f.read()

setup(
name="fugue",
version=VERSION,
packages=find_packages(),
description="An abstraction layer for distributed computation",
long_description=LONG_DESCRIPTION,
long_description_content_type="text/markdown",
license="MIT",
author="Han Wang",
author_email="[email protected]",
keywords="distributed spark sql",
url="http://github.com/goodwanghan/fugue",
install_requires=["pandas"],
extras_require={},
classifiers=[
# "3 - Alpha", "4 - Beta" or "5 - Production/Stable"
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries :: Python Modules",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3 :: Only",
],
python_requires=">=3",
)
Empty file added tests/__init__.py
Empty file.
2 changes: 2 additions & 0 deletions tests/test_dummy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def test_dummy():
assert 1 == 1

0 comments on commit a5f734e

Please sign in to comment.