Skip to content

Commit 396847e

Browse files
authored
Merge pull request #16 from Clariteia/0.0.1
0.0.1
2 parents 0410d13 + 62bfd82 commit 396847e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2363
-160
lines changed

.github/workflows/python-docs.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
name: Publish Python Package Documentation
5+
6+
on:
7+
release:
8+
types: [ created ]
9+
10+
jobs:
11+
deploy:
12+
runs-on: ubuntu-latest
13+
container: python:3.9-buster
14+
15+
steps:
16+
- name: Check out repository code
17+
uses: actions/checkout@v2
18+
19+
- name: Install Poetry
20+
uses: snok/install-poetry@v1.1.4
21+
22+
- name: Install dependencies
23+
run: make install
24+
25+
- name: Generate documentation
26+
run: make docs
27+
28+
- name: Deploy documentation
29+
uses: peaceiris/actions-gh-pages@v3
30+
with:
31+
github_token: ${{ secrets.GITHUB_TOKEN }}
32+
publish_dir: docs/_build/html

.github/workflows/python-publish.yml

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,27 @@
44
name: Upload Python Package
55

66
on:
7-
release:
8-
types: [created]
7+
release:
8+
types: [ created ]
99

1010
jobs:
11-
deploy:
12-
runs-on: ubuntu-latest
13-
steps:
14-
- uses: actions/checkout@v2
15-
- name: Set up Python
16-
uses: actions/setup-python@v2
17-
with:
18-
python-version: '3.x'
19-
- name: Install dependencies
20-
run: |
21-
python -m pip install --upgrade pip
22-
pip install setuptools wheel twine
23-
- name: Build and publish
24-
env:
25-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
26-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
27-
run: |
28-
python setup.py sdist bdist_wheel
29-
twine upload dist/*
11+
deploy:
12+
runs-on: ubuntu-latest
13+
container: python:3.9-buster
14+
15+
steps:
16+
17+
- name: Check out repository code
18+
uses: actions/checkout@v2
19+
20+
- name: Install Poetry
21+
uses: snok/install-poetry@v1.1.4
22+
23+
- name: Install dependencies
24+
run: make install
25+
26+
- name: Publish package
27+
run: make release
28+
env:
29+
POETRY_HTTP_BASIC_PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
30+
POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}

.github/workflows/python-tests.yml

Lines changed: 48 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,51 @@
11
on: push
22

33
jobs:
4-
build:
5-
runs-on: ubuntu-latest
6-
container: python:3.9
7-
8-
steps:
9-
- name: Check out repository code
10-
uses: actions/checkout@v2
11-
12-
- name: Install dependencies
13-
run: |
14-
python -m pip install --upgrade pip
15-
if [ -f requirements_dev.txt ]; then pip install -r requirements_dev.txt; fi
16-
python setup.py install
17-
18-
- name: Test with pytest
19-
run: |
20-
make test
21-
22-
- name: Generate coverage report
23-
run: |
24-
make coverage
25-
26-
- name: Codecov
27-
uses: codecov/codecov-action@v1.3.1
28-
with:
29-
token: ${{ secrets.CODECOV_TOKEN }}
30-
files: ./coverage.xml
31-
fail_ci_if_error: true
4+
build:
5+
runs-on: ubuntu-latest
6+
container: python:3.9-buster
7+
8+
# Service containers to run with `container-job`
9+
services:
10+
# Label used to access the service container
11+
redis:
12+
# Docker Hub image
13+
image: redis
14+
# Set health checks to wait until redis has started
15+
options: >-
16+
--health-cmd "redis-cli ping"
17+
--health-interval 10s
18+
--health-timeout 5s
19+
--health-retries 5
20+
env:
21+
DISCOVERY_SERVICE_DB_HOST: redis
22+
DISCOVERY_SERVICE_DB_PORT: 6379
23+
24+
steps:
25+
- name: Check out repository code
26+
uses: actions/checkout@v2
27+
28+
- name: Install Poetry
29+
uses: snok/install-poetry@v1.1.4
30+
31+
- name: Install dependencies
32+
run: make install
33+
34+
- name: Lint package
35+
run: make lint
36+
37+
- name: Test package with coverage
38+
run: make coverage
39+
40+
- name: Publish coverage
41+
uses: codecov/codecov-action@v1.3.1
42+
with:
43+
token: ${{ secrets.CODECOV_TOKEN }}
44+
files: ./coverage.xml
45+
fail_ci_if_error: true
46+
47+
- name: Generate documentation
48+
run: make docs
49+
50+
- name: Generate build
51+
run: make dist

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,11 @@ ENV/
104104
# IDE settings
105105
.vscode/
106106

107+
# Intellij IDEa / PyCharm / etc.
107108
.idea
109+
110+
# lmdb database
111+
*.mdb
112+
113+
# Sphinx Api Documentation
114+
docs/api

.pre-commit-config.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
default_stages: [ commit ]
2+
repos:
3+
- repo: local
4+
hooks:
5+
- id: install
6+
pass_filenames: false
7+
name: Install depencies
8+
entry: make install
9+
language: system
10+
11+
- id: reformat
12+
pass_filenames: false
13+
name: Reformat package
14+
entry: make reformat
15+
language: system
16+
17+
- id: lint
18+
pass_filenames: false
19+
name: Lint package
20+
entry: make lint
21+
language: system
22+
23+
- id: test
24+
pass_filenames: false
25+
name: Test package
26+
entry: make test
27+
language: system
28+
29+
- id: docs
30+
pass_filenames: false
31+
name: Generate documentation
32+
entry: make docs
33+
language: system
34+
35+
- id: build
36+
pass_filenames: false
37+
entry: make dist
38+
name: Generate build
39+
language: system

.restyled.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
enabled: true
3+
exclude:
4+
- "**/*.md"
5+
- ".idea/**/*"
6+
- "docs/**/*"
7+
- "**/*.in"
8+
- "Makefile"
9+
- ".github/workflows/**/*"
10+
restylers:
11+
- name: black
12+
image: restyled/restyler-black:v19.10b0
13+
command:
14+
- black
15+
arguments: ["--line-length", "120"]
16+
include:
17+
- "**/*.py"
18+
interpreters:
19+
- python
20+
- name: isort
21+
image: restyled/restyler-isort:v5.8.0
22+
command:
23+
- isort
24+
arguments: []
25+
include:
26+
- "**/*.py"
27+
interpreters:
28+
- python

HISTORY.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
History
22
=======
33

4-
0.0.1 (2021-05-16)
4+
0.0.1 (2021-05-21)
55
------------------
66

7-
* First release on PyPI.
7+
* Added REST Interface for:
8+
* subscription
9+
* unsubscription
10+
* microservice health status update
11+
* periodic service for microservice health status check
12+
* Redis integration

MANIFEST.in

Lines changed: 0 additions & 9 deletions
This file was deleted.

Makefile

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ BROWSER := python -c "$$BROWSER_PYSCRIPT"
2626
help:
2727
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
2828

29-
clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts
29+
clean: clean-build clean-pyc clean-test clean-env
3030

3131
clean-build: ## remove build artifacts
3232
rm -fr build/
@@ -47,38 +47,46 @@ clean-test: ## remove test and coverage artifacts
4747
rm -fr htmlcov/
4848
rm -fr .pytest_cache
4949

50+
clean-env:
51+
rm -fr .env/
52+
5053
lint: ## check style with flake8
51-
flake8 minos tests
54+
poetry run flake8
5255

5356
test: ## run tests quickly with the default Python
54-
pytest
57+
poetry run pytest
5558

5659
test-all: ## run tests on every Python version with tox
57-
tox
60+
poetry run tox
5861

5962
coverage: ## check code coverage quickly with the default Python
60-
coverage run --source minos -m pytest
61-
coverage report -m
62-
coverage xml
63+
poetry run coverage run --source minos -m pytest
64+
poetry run coverage report -m
65+
poetry run coverage xml
66+
## $(BROWSER) htmlcov/index.html
67+
68+
reformat: ## check code coverage quickly with the default Python
69+
poetry run black --line-length 120 minos tests
70+
poetry run isort --recursive minos tests
6371

6472
docs: ## generate Sphinx HTML documentation, including API docs
65-
rm -f docs/discovery_service.rst
73+
rm -f docs/minos_discovery.rst
6674
rm -f docs/modules.rst
67-
sphinx-apidoc -o docs/ discovery_service
68-
$(MAKE) -C docs clean
69-
$(MAKE) -C docs html
70-
$(BROWSER) docs/_build/html/index.html
75+
poetry run sphinx-apidoc -o docs/api minos
76+
poetry run $(MAKE) -C docs clean
77+
poetry run $(MAKE) -C docs html
7178

7279
servedocs: docs ## compile the docs watching for changes
7380
watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .
7481

7582
release: dist ## package and upload a release
76-
twine upload dist/*
83+
poetry publish
7784

7885
dist: clean ## builds source and wheel package
79-
python setup.py sdist
80-
python setup.py bdist_wheel
86+
poetry build
8187
ls -l dist
8288

83-
install: clean ## install the package to the active Python's site-packages
84-
python setup.py install
89+
install:
90+
poetry install
91+
92+
full-install: clean install

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
=================
21
Discovery Service
32
=================
43

5-
Minos Boilerplate contains all the boilerplate you need to create a Minos Python package.
4+
Minos API Gateway Discovery Service
65

76
Credits
87
-------

0 commit comments

Comments
 (0)