-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from aviramha/wip
First version?
- Loading branch information
Showing
14 changed files
with
913 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[flake8] | ||
max-line-length = 120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.