Skip to content

Commit

Permalink
Basic GET functionality for coop info (bcgov#31)
Browse files Browse the repository at this point in the history
Basic GET functionality for coop info.
  • Loading branch information
katiemcgoff authored Apr 15, 2019
1 parent 84a73d1 commit 71c4ef3
Show file tree
Hide file tree
Showing 48 changed files with 2,250 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,5 @@ venv.bak/

# IDE
/**/.vscode
*/.idea/*

3 changes: 3 additions & 0 deletions colin-api/.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
##while read -r line; do export $line; echo $line; done < .env
source venv/bin/activate
source .env
13 changes: 13 additions & 0 deletions colin-api/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright © 2018 Province of British Columbia

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
5 changes: 5 additions & 0 deletions colin-api/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include requirements/prod.txt
include config.py
include logging.conf
include LICENSE
include README.md
153 changes: 153 additions & 0 deletions colin-api/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
.PHONY: license
.PHONY: setup clean clean-build clean-pyc clean-test

.PHONY: docker-setup network build start qa style safety test test-travis flake8 \
isort isort-save stop docker-clean logs
.PHONY: mac-cov pylint flake8

SHELL:=/bin/bash
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
current_dir := $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))
current_abs_dir := $(patsubst %/,%,$(dir $(mkfile_path)))

#################################################################################
# COMMANDS #
#################################################################################
clean: clean-build clean-pyc clean-test
rm -rf venv/

clean-build:
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +

clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +

clean-test:
find . -name '.pytest_cache' -exec rm -fr {} +
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/

setup: clean venv/bin/activate install-dev

venv/bin/activate: requirements/prod.txt requirements/dev.txt
rm -rf venv/
test -f venv/bin/activate || python3 -m venv $(current_abs_dir)/venv
. venv/bin/activate ;\
pip install --upgrade pip ;\
pip install -Ur requirements/prod.txt ;\
pip freeze | sort > requirements.txt ;\
pip install -Ur requirements/dev.txt
touch venv/bin/activate # update so it's as new as requirements/prod.txt

.PHONY: install-dev
install-dev: venv/bin/activate
. venv/bin/activate ; \
pip install -e .

.PHONY: activate
activate: venv/bin/activate
. venv/bin/activate

.PHONY: local-test
local-test: venv/bin/activate
. venv/bin/activate ; \
pytest

.PHONY: local-coverage
local-coverage: venv/bin/activate
. venv/bin/activate ; \
coverage run -m pytest

.PHONY: coverage-report
coverage-report: local-coverage
. venv/bin/activate ; \
coverage report ; \
coverage html

## Run the coverage report and display in a browser window
mac-cov: install-dev coverage-report
open -a "Google Chrome" htmlcov/index.html

## run pylint on the package and tests
pylint:
pylint --rcfile=setup.cfg \
--load-plugins=pylint_flask \
--disable=C0301,W0511 \
src/colin_api

## run flake8 on the package and tests
flake8:
flake8 src/colin_api tests

## Verify source code license headers.
license:
./scripts/verify_license_headers.sh src/colin_api tests

#################################################################################
# Self Documenting Commands #
#################################################################################

.DEFAULT_GOAL := show-help

# Inspired by <http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html>
# sed script explained:
# /^##/:
# * save line in hold space
# * purge line
# * Loop:
# * append newline + line to hold space
# * go to next line
# * if line starts with doc comment, strip comment character off and loop
# * remove target prerequisites
# * append hold space (+ newline) to line
# * replace newline plus comments by `---`
# * print line
# Separate expressions are necessary because labels cannot be delimited by
# semicolon; see <http://stackoverflow.com/a/11799865/1968>
.PHONY: show-help
show-help:
@echo "$$(tput bold)Available rules:$$(tput sgr0)"
@echo
@sed -n -e "/^## / { \
h; \
s/.*//; \
:doc" \
-e "H; \
n; \
s/^## //; \
t doc" \
-e "s/:.*//; \
G; \
s/\\n## /---/; \
s/\\n/ /g; \
p; \
}" ${MAKEFILE_LIST} \
| LC_ALL='C' sort --ignore-case \
| awk -F '---' \
-v ncol=$$(tput cols) \
-v indent=19 \
-v col_on="$$(tput setaf 6)" \
-v col_off="$$(tput sgr0)" \
'{ \
printf "%s%*s%s ", col_on, -indent, $$1, col_off; \
n = split($$2, words, " "); \
line_length = ncol - indent; \
for (i = 1; i <= n; i++) { \
line_length -= length(words[i]) + 1; \
if (line_length <= 0) { \
line_length = ncol - indent - length(words[i]) - 1; \
printf "\n%*s ", -indent, " "; \
} \
printf "%s ", words[i]; \
} \
printf "\n"; \
}' \
| more $(shell test $(shell uname) = Darwin && echo '--no-init --raw-control-chars')
67 changes: 67 additions & 0 deletions colin-api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)


# Application Name

BC Registries Legal Entities COLIN API

## Technology Stack Used
* Python, Flask

## Third-Party Products/Libraries used and the the License they are covert by

## Project Status
As of 2019-04-09 in Development

## Documnentation

GitHub Pages (https://guides.github.com/features/pages/) are a neat way to document you application/project.

## Security

TBD

## Files in this repository

```
openshift/ - OpenShift-specific files
├── scripts - helper scripts
└── templates - application templates
```

## Deployment (Local Development)

* Developer Workstation Requirements/Setup
* Application Specific Setup

## Deployment (OpenShift)

See (openshift/Readme.md)

## Getting Help or Reporting an Issue

To report bugs/issues/feature requests, please file an [issue](../../issues).

## How to Contribute

If you would like to contribute, please see our [CONTRIBUTING](./CONTRIBUTING.md) guidelines.

Please note that this project is released with a [Contributor Code of Conduct](./CODE_OF_CONDUCT.md).
By participating in this project you agree to abide by its terms.

## License

Copyright 2018 Province of British Columbia

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Loading

0 comments on commit 71c4ef3

Please sign in to comment.