Skip to content

Commit

Permalink
Merge pull request #1 from aviramha/wip
Browse files Browse the repository at this point in the history
First version?
  • Loading branch information
aviramha authored Nov 16, 2020
2 parents d448c4a + e7b42d9 commit 7086c93
Show file tree
Hide file tree
Showing 14 changed files with 913 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
max-line-length = 120
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release
on:
push:
tags:
- '*.*.*'


jobs:
tests:
strategy:
matrix:
python-version: [3.8, 3.9]
platform: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Setup Poetry
run: |
python -m pip install --upgrade pip
pip install --pre poetry
- name: Setup Cache
uses: actions/cache@v2
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-pip-${{ matrix.platform }}-${{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.platform }}-${{ matrix.python-version }}
- name: Install dependencies
run: |
poetry install
- name: Publish
run: |
make publish
45 changes: 45 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Test capara

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

jobs:
tests:
strategy:
matrix:
python-version: [3.8, 3.9]
platform: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Setup Poetry
run: |
python -m pip install --upgrade pip
pip install --pre poetry
- name: Setup Cache
uses: actions/cache@v2
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-pip-${{ matrix.platform }}-${{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.platform }}-${{ matrix.python-version }}
- name: Install dependencies
run: |
poetry install
- name: Install Rust && maturin
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y
source $HOME/.cargo/env
pip install maturin
rustup component add clippy
rustup component add rustfmt
- name: Test
run: |
make
169 changes: 169 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,172 @@ Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdiskpoetry.lock
.vscode
poetry.lock
.cargo
13 changes: 13 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "capara"
version = "0.1.0"
edition = "2018"
authors = ["Aviram Hassan <[email protected]>"]

[lib]
name = "capara"
crate-type = ["cdylib"]

[dependencies.pyo3]
git = "https://github.com/pyo3/pyo3"
features = ["extension-module"]
109 changes: 109 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
POETRY ?= poetry

all: lint-check build test

build:
@$(POETRY) run maturin develop

.PHONY: install-poetry
install-poetry:
@curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python

.PHONY: install-deps
install-deps:
@$(POETRY) install -vv

.PHONY: install
install: install-poetry install-deps

.PHONY: lint-black
lint-black:
@echo "\033[92m< linting using black...\033[0m"
@$(POETRY) run black .
@echo "\033[92m> done\033[0m"
@echo

.PHONY: lint-flake8
lint-flake8:
@echo "\033[92m< linting using flake8...\033[0m"
@$(POETRY) run flake8 capara tests
@echo "\033[92m> done\033[0m"
@echo

.PHONY: lint-isort
lint-isort:
@echo "\033[92m< linting using isort...\033[0m"
@$(POETRY) run isort --recursive .
@echo "\033[92m> done\033[0m"
@echo

.PHONY: lint-mypy
lint-mypy:
@echo "\033[92m< linting using mypy...\033[0m"
@$(POETRY) run mypy --ignore-missing-imports --follow-imports=silent capara tests
@echo "\033[92m> done\033[0m"
@echo

.PHONY: lint-cargo-fmt
lint-cargo-fmt:
@echo "\033[92m< linting using cargo-fmt...\033[0m"
cargo fmt
@echo "\033[92m> done\033[0m"
@echo

.PHONY: lint
lint: lint-cargo-fmt lint-black lint-flake8 lint-isort lint-mypy

.PHONY: lint-check-black
lint-check-black:
@echo "\033[92m< linting using black...\033[0m"
@$(POETRY) run black --check --diff .
@echo "\033[92m> done\033[0m"
@echo

.PHONY: lint-check-flake8
lint-check-flake8:
@echo "\033[92m< linting using flake8...\033[0m"
@$(POETRY) run flake8 capara tests
@echo "\033[92m> done\033[0m"
@echo

.PHONY: lint-check-isort
lint-check-isort:
@echo "\033[92m< linting using isort...\033[0m"
@$(POETRY) run isort --check-only --diff --recursive .
@echo "\033[92m> done\033[0m"
@echo

.PHONY: lint-check-mypy
lint-check-mypy:
@echo "\033[92m< linting using mypy...\033[0m"
@$(POETRY) run mypy --ignore-missing-imports --follow-imports=silent capara tests
@echo "\033[92m> done\033[0m"
@echo

.PHONY: lint-check-clippy
lint-check-clippy:
@echo "\033[92m< linting using clippy...\033[0m"
cargo clippy
@echo "\033[92m> done\033[0m"
@echo

.PHONY: lint-check-rustfmt
lint-check-rustfmt:
@echo "\033[92m< linting using cargo fmt...\033[0m"
cargo fmt --all -- --check
@echo "\033[92m> done\033[0m"
@echo

.PHONY: lint-check
lint-check: lint-check-clippy lint-check-rustfmt lint-check-black lint-check-flake8 lint-check-isort lint-check-mypy

.PHONY: test
test:
@$(POETRY) run pytest


.PHONY: publish
publish:
@$(POETRY) publish --username=$(PYPI_USERNAME) --password=$(PYPI_PASSWORD) --build
Loading

0 comments on commit 7086c93

Please sign in to comment.