Skip to content

Commit b7239e9

Browse files
authored
Refactor project (#1)
* feat: update project
1 parent 3980bd9 commit b7239e9

Some content is hidden

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

59 files changed

+3045
-2010
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
- OS: [e.g. iOS]
28+
- Browser [e.g. chrome, safari]
29+
- Version [e.g. 22]
30+
31+
**Smartphone (please complete the following information):**
32+
- Device: [e.g. iPhone6]
33+
- OS: [e.g. iOS8.1]
34+
- Browser [e.g. stock browser, safari]
35+
- Version [e.g. 22]
36+
37+
**Additional context**
38+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Fixes # [refer the issue number]
2+
3+
Changes proposed in this PR:
4+
- [Updated X functionality]
5+
- [Refactor X class]

.github/workflows/python-package.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Python package
5+
6+
on:
7+
push:
8+
branches: [ master ]
9+
pull_request:
10+
branches: [ master ]
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
python-version: [3.6, 3.7, 3.8]
18+
steps:
19+
- uses: actions/checkout@v2
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v2
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install pipenv
28+
pipenv install --dev --system
29+
- name: Test with pytest
30+
run: |
31+
python setup.py test
32+
- name: Run mypy
33+
continue-on-error: true
34+
run: |
35+
mypy consulate
36+
- name: Lint with flake8
37+
run: |
38+
# stop the build if there are Python syntax errors or undefined names
39+
flake8 consulate --show-source --statistics
40+
- name: Lint with pylint
41+
run: |
42+
pylint --rcfile=pylintrc consulate
43+
- name: Security safety
44+
run: |
45+
safety check
46+
- name: Security bandit
47+
run: |
48+
bandit -r consulate/

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ cover
1212
docs/_build
1313
MANIFEST
1414
venv
15+
htmlcov

.travis.yml

Lines changed: 14 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,18 @@
1-
sudo: required
2-
3-
services:
4-
- docker
5-
61
language: python
7-
8-
env:
9-
global:
10-
- PATH=$HOME/.local/bin:$PATH
11-
- AWS_DEFAULT_REGION=us-east-1
12-
- secure: "GxBrm8hKFLazshbB3c+rQUQYHAim/rm8KtBXz6uNWRvsccAK6otc5Wcz01kj679d9C9L3I/G6/wCxfgglQp3YMGKlLT+jHQpOMdDauEdeKvaUuPh3hDQBPSAUhIpycgxz9AghdWqOQGkpQQqNW9UZRC42SW2eIyWFIlQf6W31Vc="
13-
- secure: "YdDXZGAOp1WZenhfZnHhL9cOeUQbvZZOr8FWWJoJz3EdTbf6jE2UuK4HU6CgoYDpfFlc7geah2xARr/2rkN716Rz4ZzeHBtNXfwqqQRWRLkB8J73Nowmm+6J+skv6meJyCHtcHalpv7pAH5QPn3zMK2EAogdcDJmd5GSVBjwPoo="
14-
15-
stages:
16-
- test
17-
- name: upload coverage
18-
- name: deploy
19-
if: tag IS present
20-
2+
python:
3+
- "3.8"
214
install:
22-
- pip install awscli
23-
- pip install -r requires/testing.txt
24-
- python setup.py develop
25-
26-
before_script:
27-
- ./bootstrap
28-
- source build/test-environment
29-
30-
script: nosetests
31-
5+
- python -m pip install --upgrade pip
6+
- pip install --upgrade setuptools coveralls pipenv
7+
- pipenv lock --dev --requirements > requirements.txt
8+
- pip install -r requirements.txt
9+
script:
10+
- coverage erase
11+
- python setup.py test
3212
after_success:
33-
- aws s3 cp .coverage "s3://com-gavinroy-travis/consulate/$TRAVIS_BUILD_NUMBER/.coverage.${TRAVIS_PYTHON_VERSION}"
13+
- coverage combine
14+
- coveralls
3415

35-
jobs:
36-
include:
37-
- python: 2.7
38-
- python: 3.4
39-
- python: 3.5
40-
- python: 3.6
41-
- python: pypy
42-
- python: pypy3
43-
- stage: upload coverage
44-
if: repo IS gmr/consulate
45-
sudo: false
46-
services: []
47-
python: 3.6
48-
install:
49-
- pip install awscli coverage codecov
50-
before_script: true
51-
script:
52-
- mkdir coverage
53-
- aws s3 cp --recursive s3://com-gavinroy-travis/consulate/$TRAVIS_BUILD_NUMBER/
54-
coverage
55-
- cd coverage
56-
- coverage combine
57-
- cd ..
58-
- mv coverage/.coverage .
59-
- coverage report
60-
after_success: codecov
61-
- stage: deploy
62-
sudo: false
63-
if: repo IS gmr/consulate
64-
python: 3.6
65-
services: []
66-
install: true
67-
before_script: true
68-
script: true
69-
after_success: true
70-
deploy:
71-
distributions: sdist bdist_wheel
72-
provider: pypi
73-
user: crad
74-
on:
75-
tags: true
76-
all_branches: true
77-
password:
78-
secure: "W3mHi2tzX34KcN82tdVPZwS0RHBGkI2Cy/df18ehsVKoOzWzQvaQKh2Jh1LIBOvdZCyih+KltmMNT8ounqUd+ql6kBFd0kotQk3C3x5R5KlpbhQ4BNKp++grs+iycPwK6qnJISypt2d3ykJNgqUgfBI0p+7XVpMkBY0GIXGNcvk="
16+
notifications:
17+
email:
18+

CONTRIBUTING.md

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,3 @@
11
# Contributing
22

3-
## Test Coverage
4-
5-
To contribute to Consulate, please make sure that any new features or changes
6-
to existing functionality **include test coverage**.
7-
8-
*Pull requests that add or change code without coverage have a much lower chance
9-
of being accepted.*
10-
11-
## Prerequisites
12-
13-
Consulate test suite has a couple of requirements:
14-
15-
* Dependencies from [requires/testing.txt](requires/testing.txt) are installed
16-
* Local Docker and [docker-compose](https://docs.docker.com/compose/)
17-
18-
## Installing Dependencies
19-
20-
You may want to develop in a virtual environment. This is usually done inside the source
21-
repository, and `.gitignore` is configured to ignore a virtual environment in `env`.
22-
23-
```bash
24-
python3 -m venv env
25-
source env/bin/activate
26-
```
27-
28-
To install the dependencies needed to run Consulate tests, use
29-
30-
```bash
31-
pip install -r requires/testing.txt
32-
```
33-
34-
## Starting the test dependency
35-
36-
Prior to running tests, ensure that Consul is running via Docker using:
37-
38-
```bash
39-
./bootstrap
40-
```
41-
42-
This script uses [docker-compose](https://docs.docker.com/compose/) to launch a Consul server container that is
43-
pre-configured for the tests. In addition, it configures `build/test-environment` that is loaded
44-
by the tests with configuration information for connecting to Consul.
45-
46-
## Running Tests
47-
48-
To run all test suites, run:
49-
50-
nosetests
51-
52-
## Code Formatting
53-
54-
Please format your code using [yapf](http://pypi.python.org/pypi/yapf)
55-
with ``pep8`` style prior to issuing your pull request. In addition, run
56-
``flake8`` to look for any style errors prior to submitting your PR.
57-
58-
Both are included when the test requirements are installed. If you are fixing
59-
formatting for existing code, please separate code-reformatting commits from
60-
functionality changes.
3+
See this [webpage](https://python-microservices.github.io/contributing/)

Pipfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[[source]]
2+
name = "pypi"
3+
url = "https://pypi.org/simple"
4+
verify_ssl = true
5+
6+
[dev-packages]
7+
py-ms-consulate = {editable = true,extras = ["tests"],path = "."}
8+
9+
[packages]
10+
py-ms-consulate = {editable = true, extras = ["unixsocket"],path = "."}
11+
12+
[pipenv]
13+
allow_prereleases = true

0 commit comments

Comments
 (0)