Skip to content
This repository has been archived by the owner on Sep 18, 2019. It is now read-only.

Commit

Permalink
Add Makefile and setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
grewn0uille committed Feb 8, 2018
1 parent 6da89ae commit 883e1d4
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
46 changes: 46 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
include Makefile.config
-include Makefile.custom.config

all: install serve

install:
test -d $(VENV) || virtualenv -p python3.6 $(VENV)
$(PIP) install --upgrade --no-cache pip setuptools -e .[test]

install-dev:
$(PIP) install --upgrade devcore

update-db:
$(VENV)/bin/alembic upgrade head

install-db:
$(FLASK) drop_db
$(VENV)/bin/alembic upgrade head

clean:
rm -fr dist

clean-install: clean
rm -fr $(VENV)
rm -fr *.egg-info

lint:
$(PYTEST) --no-cov --flake8 -m flake8
$(PYTEST) --no-cov --isort -m isort

check-python: lint

check-outdated:
$(PIP) list --outdated --format=columns

check: check-python check-outdated

build:

env:
$(RUN)

run:
env FLASK_DEBUG=1 $(VENV)/bin/flask run

serve: run
12 changes: 12 additions & 0 deletions Makefile.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export PROJECT_NAME = sherlog

export FLASK_APP = $(PROJECT_NAME)
export FLASK_CONFIG ?= application.cfg
export FLASK_DEBUG ?= 1

# Python env
VENV = $(PWD)/.env
PIP = $(VENV)/bin/pip
PYTHON = $(VENV)/bin/python
PYTEST = $(VENV)/bin/py.test
FLASK = $(VENV)/bin/flask
32 changes: 32 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env python

import sys

from setuptools import find_packages, setup

needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv)
pytest_runner = ['pytest-runner'] if needs_pytest else []

tests_requirements = [
'pytest',
'pytest-cov',
'pytest-factoryboy',
'pytest-flake8',
'pytest-isort',
]

setup(
name='sherlog',
author='Kozea',
packages=find_packages(exclude=['*.eggs']),
include_package_data=True,
install_requires=[
'alembic',
'flask',
'sqlalchemy',
'unrest',
],
setup_requires=pytest_runner,
tests_require=tests_requirements,
extras_require={'test': tests_requirements}
)

0 comments on commit 883e1d4

Please sign in to comment.