Skip to content

Commit

Permalink
feat: move to poetry and remove setuptools
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmet2mir committed Feb 5, 2021
1 parent a07a3a8 commit b402e7c
Show file tree
Hide file tree
Showing 10 changed files with 1,611 additions and 335 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# top-most EditorConfig file
root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 4

[Makefile]
indent_style = tab
15 changes: 3 additions & 12 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,14 @@ jobs:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f qa/requirements.txt ]; then pip install -r qa/requirements.txt; fi
make init
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --exclude src/exabgp/vendoring/ --exclude build/ --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
make syntax
- name: Self Testing
run: |
./qa/bin/parsing
./qa/bin/functional run
./sbin/exabgp decode ./etc/exabgp/api-open.conf FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:003C:02:0000001C4001010040020040030465016501800404000000C840050400000064000000002001010101
env exabgp_log_enable=false nosetests --with-coverage ./tests/*_test.py
make test
# - name: Coveralls
# run: |
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,7 @@ __pycache__/

develop-eggs
eggs
fake-eggs
fake-eggs
init
artifacts
requirements.txt
81 changes: 81 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
PYTHON_CMD ?= python
PIP_CMD ?= pip

# set local bin in PATH for poetry
export PATH := $(HOME)/.local/bin:$(PATH)

all: init_poetryx test rpm

# lists all available targets
list:
@sh -c "$(MAKE) -p no_targets__ | \
awk -F':' '/^[a-zA-Z0-9][^\$$#\/\\t=]*:([^=]|$$)/ {\
split(\$$1,A,/ /);for(i in A)print A[i]\
}' | grep -v '__\$$' | grep -v 'make\[1\]' | grep -v 'Makefile' | sort"

# required for list
no_targets__:

init:
@echo "Target init"
$(PIP_CMD) show -q poetry || $(PIP_CMD) install --user poetry
poetry install
poetry version --no-ansi
touch init

fmt:
@echo "Target fmt"
poetry run black src tests

poetry.lock:
@echo "Target poetry.lock"
poetry lock
poetry version --no-ansi

test: poetry.lock
@echo "Target test"
./qa/bin/parsing
./qa/bin/functional run
./sbin/exabgp decode ./etc/exabgp/api-open.conf FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:003C:02:0000001C4001010040020040030465016501800404000000C840050400000064000000002001010101
env exabgp_log_enable=false nosetests --with-coverage ./tests/*_test.py

syntax: poetry.lock
@echo "Target syntax"
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 . --exclude src/exabgp/vendoring/ --exclude build/ --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
poetry run bandit -r src

build: poetry.lock
@echo "Target build"
poetry version --no-ansi
poetry build

publish:
@echo "Target publish to pypi"
poetry publish

pex: build
@echo "Target pex"
mkdir -p artifacts/binaries

poetry run dephell deps convert --envs main

poetry run pex exabgp \
--find-links=dist/ \
--entry-point="exabgp.application.main:main" \
--requirement=requirements.txt \
--output-file=artifacts/binaries/exabgp \
--wheel \
--manylinux=manylinux2014

clean:
@echo "Target clean"
git clean -fdx

clean-venv:
@echo "Target clean-venv"
@poetry env remove $$(poetry env list --no-ansi | tail -n 1 | cut -d' ' -f1)

.PHONY: all list fmt docs test syntax build pex clean clean-venv
Loading

0 comments on commit b402e7c

Please sign in to comment.