8000 Release v1.0 by jacebrowning · Pull Request #83 · flask-api/flask-api · GitHub
[go: up one dir, main page]

Skip to content

Release v1.0 #83

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Aug 29, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update CI tooling
  • Loading branch information
jacebrowning committed Aug 21, 2017
commit 05a0713f1a8ee26a54217ad7da9565a1e6aea32f
58 changes: 49 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,51 @@
.env/
.venv/
env/
dist/
htmlcov/
site/
.tox/
Flask_API.egg-info/
# Temporary Python files
*.pyc
*.egg-info
__pycache__
.coverage
.ipynb_checkpoints

# Temporary OS files
Icon*

# Temporary virtual environment files
/.cache/
/.venv/

# Temporary server files
.env
*.pid

# Generated documentation
/docs/gen/
/docs/apidocs/
/site/
/*.html
/*.rst
/docs/*.png

# Google Drive
*.gdoc
*.gsheet
*.gslides
*.gdraw

# Testing and coverage results
/.pytest/
/.coverage
/.coverage.*
/htmlcov/
/xmlreport/
/pyunit.xml
/tmp/
*.tmp

# Build and release directories
/build/
/dist/
*.spec

# Sublime Text
*.sublime-workspace

# Eclipse
.settings
39 changes: 22 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,37 @@
language: python
sudo: false

python:
- 2.7
- 3.3
- 3.4
- 3.5
- 2.7
- 3.3
- 3.4
- 3.5
- 3.6

env:
global:
- RANDOM_SEED=0
- PIPENV_NOSPIN=true
matrix:
- FLASK_VERSION=0.10.1
# TODO: enable when future release is available:
# http://flask.pocoo.org/docs/0.11/changelog/#version-0-10-2
# - FLASK_VERSION=0.10.2
- FLASK_VERSION=0.10.2
- FLASK_VERSION=0.11.0

before_install:
- pip install pipenv
- pip install pipenv~=5.0

install:
- pipenv install --dev --system
- pip install flask==${FLASK_VERSION} # override version for the build matrix
- pip install coverage==3.6
- pip install python-coveralls==2.4.0
- export PYTHONPATH=.
- make install

before_script: coverage erase
script:
- make check
- make test

script: ./runtests
after_success:
- pip install coveralls scrutinizer-ocular
- coveralls
- ocular

after_success: coverage report; coveralls
notifications:
email:
on_success: never
on_failure: never
211 changes: 200 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,34 +1,223 @@
# Project settings
PROJECT := Flask-API
PACKAGE := flask_api
REPOSITORY := flask-api/flask-api

# Project paths
PACKAGES := $(PACKAGE) tests
CONFIG := $(wildcard *.py)
MODULES := $(wildcard $(PACKAGE)/*.py)

# Python settings
PYTHON_MAJOR ?= 2
PYTHON_MINOR ?= 7

# System paths
PLATFORM := $(shell python -c 'import sys; print(sys.platform)')
ifneq ($(findstring win32, $(PLATFORM)), )
WINDOWS := true
SYS_PYTHON_DIR := C:\\Python$(PYTHON_MAJOR)$(PYTHON_MINOR)
SYS_PYTHON := $(SYS_PYTHON_DIR)\\python.exe
# https://bugs.launchpad.net/virtualenv/+bug/449537
export TCL_LIBRARY=$(SYS_PYTHON_DIR)\\tcl\\tcl8.5
else
ifneq ($(findstring darwin, $(PLATFORM)), )
MAC := true
else
LINUX := true
endif
SYS_PYTHON := python$(PYTHON_MAJOR)
ifdef PYTHON_MINOR
SYS_PYTHON := $(SYS_PYTHON).$(PYTHON_MINOR)
endif
endif

# Virtual environment paths
ENV := .venv
ifneq ($(findstring win32, $(PLATFORM)), )
BIN := $(ENV)/Scripts
ACTIVATE := $(BIN)/activate.bat
OPEN := cmd /c start
PYTHON := $(BIN)/python.exe
PIP := $(BIN)/pip.exe
else
BIN := $(ENV)/bin
ACTIVATE := . $(BIN)/activate
ifneq ($(findstring cygwin, $(PLATFORM)), )
OPEN := cygstart
else
OPEN := open
endif
PYTHON := $(BIN)/python
PIP := $(BIN)/pip
endif

# MAIN TASKS ###################################################################

SNIFFER := pipenv run sniffer

.PHONY: all
all: install

.PHONY: ci
ci: check test ## Run all tasks that determine CI status

.PHONY: watch
watch: install .clean-test ## Continuously run all CI tasks when files chanage
$(SNIFFER)

.PHONY: run ## Start the program
run: install
$(PYTHON) $(PACKAGE)/__main__.py

# PROJECT DEPENDENCIES #########################################################

export PIPENV_SHELL_COMPAT=true
export PIPENV_VENV_IN_PROJECT=true
export PIPENV_IGNORE_VIRTUALENVS=true

ENV := .venv
DEPENDENCIES := $(ENV)/.installed
PIP := $(ENV)/bin/pip
METADATA := *.egg-info

.PHONY: install
install: $(DEPENDENCIES)
install: $(DEPENDENCIES) $(METADATA)

$(DEPENDENCIES): $(PIP) Pipfile*
pipenv install --dev --ignore-hashes
pipenv install --dev
ifdef WINDOWS
@ echo "Manually install pywin32: https://sourceforge.net/projects/pywin32/files/pywin32"
else ifdef MAC
$(PIP) install pync MacFSEvents
else ifdef LINUX
$(PIP) install pyinotify
endif
@ touch $@

$(METADATA): $(PYTHON) setup.py
$(PYTHON) setup.py develop
@ touch $@

$(PIP):
pipenv --python=python3.6
$(PYTHON) $(PIP):
pipenv --python=$(SYS_PYTHON)
pipenv run pip --version

# CHECKS #######################################################################

FLAKE8 := pipenv run flake8

.PHONY: check
check: flake8 ## Run linters and static analysis

# VALIDATION TARGETS ###########################################################
.PHONY: flake8
flake8: install
$(FLAKE8) flask_api --ignore=E128,E501 --exclude=__init__.py

# TESTS ########################################################################

NOSE := pipenv run nosetests
COVERAGE := pipenv run coverage
COVERAGE_SPACE := pipenv run coverage.space

RANDOM_SEED ?= $(shell date +%s)

NOSE_OPTIONS := --with-doctest
ifndef DISABLE_COVERAGE
NOSE_OPTIONS += --with-coverage --cover-package=$(PACKAGE) --cover-erase --cover-html --cover-html-dir=htmlcov --cover-branches
endif

.PHONY: test
test: install ## Run tests and linters
pipenv run nosetests flask_api
pipenv run flake8 flask_api --ignore=E128,E501 --exclude=__init__.py
test: install ## Run unit and integration tests
$(NOSE) $(PACKAGE) $(NOSE_OPTIONS)
$(COVERAGE_SPACE) $(REPOSITORY) overall

.PHONY: read-coverage
read-coverage:
$(OPEN) coverage/index.html

# DOCUMENTATION ################################################################

MKDOCS := pipenv run mkdocs

MKDOCS_INDEX := site/index.html

.PHONY: doc
doc: mkdocs ## Generate documentation

.PHONY: mkdocs
mkdocs: install $(MKDOCS_INDEX)
$(MKDOCS_INDEX): mkdocs.yml docs/*.md
$(MKDOCS) build --clean --strict

.PHONY: mkdocs-live
mkdocs-live: mkdocs
eval "sleep 3; open http://127.0.0.1:8000" &
$(MKDOCS) serve

# RELEASE ######################################################################

TWINE := pipenv run twine

.PHONY: register
register: dist ## Register the project on PyPI
@ echo NOTE: your project must be registered manually
@ echo https://github.com/pypa/python-packaging-user-guide/issues/263
# TODO: switch to twine when the above issue is resolved
# $(TWINE) register dist/*.whl

.PHONY: upload
upload: .git-no-changes register ## Upload the current version to PyPI
$(TWINE) upload dist/*.*
$(OPEN) https://pypi.python.org/pypi/$(PROJECT)

.PHONY: .git-no-changes
.git-no-changes:
@ if git diff --name-only --exit-code; \
then \
echo Git working copy is clean...; \
else \
echo ERROR: Git working copy is dirty!; \
echo Commit your changes and try again.; \
exit -1; \
fi;

# CLEANUP ######################################################################

.PHONY: clean
clean:
clean: .clean-dist .clean-test .clean-doc .clean-build ## Delete all generated and temporary files

.PHONY: clean-all
clean-all: clean .clean-env .clean-workspace

.PHONY: .clean-build
.clean-build:
find $(PACKAGES) -name '*.pyc' -delete
find $(PACKAGES) -name '__pycache__' -delete
rm -rf *.egg-info

.PHONY: .clean-doc
.clean-doc:
rm -rf README.rst docs/apidocs *.html docs/*.png site

.PHONY: .clean-test
.clean-test:
rm -rf .cache .pytest .coverage htmlcov xmlreport

.PH 8000 ONY: .clean-dist
.clean-dist:
rm -rf *.spec dist build

.PHONY: .clean-env
.clean-env: clean
rm -rf $(ENV)

.PHONY: .clean-workspace
.clean-workspace:
rm -rf *.sublime-workspace

# HELP #########################################################################

.PHONY: help
help: all
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

.DEFAULT_GOAL := help
5 changes: 3 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Flask = "~=0.10.1"
[dev-packages]
nose = "*"
coverage = "~=3.7.1"
"coverage.space" = "*"
flake8 = "~=2.1"
mkdocs = "~=0.12"
tox = "~=2.0"
mkdocs = "==0.12"
sniffer = "*"
Loading
0