Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f9bd276

Browse files
authoredSep 12, 2021
feat: replaced pipenv to poetry. Updated dependencies (#337)
* feat: replaced pipenv to poetry. Updated dependencies * docs: updated README
1 parent e3b6dee commit f9bd276

File tree

13 files changed

+3023
-1361
lines changed

13 files changed

+3023
-1361
lines changed
 

‎.github/workflows/python-package.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,17 @@ jobs:
2626
- name: Install dependencies
2727
run: |
2828
python -m pip install --upgrade pip
29-
pip install pipenv
30-
pipenv lock --dev --requirements > requirements.txt
31-
pip install -r requirements.txt
29+
pip install poetry
30+
poetry install --no-interaction --no-root
31+
env:
32+
POETRY_VIRTUALENVS_CREATE: false
3233
- name: Test with pytest
3334
run: |
34-
python setup.py test
35+
pytest --cov=project --cov=tests tests/
3536
- name: Run mypy
3637
continue-on-error: true
3738
run: |
38-
mypy microservices-scaffold
39+
mypy project
3940
- name: Lint with flake8
4041
run: |
4142
# stop the build if there are Python syntax errors or undefined names

‎Pipfile

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

‎Pipfile.lock

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

‎README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,34 @@ microservices with Python which handles cross-cutting concerns:
2020

2121
## Quickstart
2222

23+
We recommended use [Poetry](https://python-poetry.org/docs/) to install the dependencies
24+
25+
Start with poetry
26+
```shell
27+
pip install --user poetry
28+
poetry update
29+
poetry run python manage.py
30+
```
31+
32+
Start with a virtualenv
33+
```shell
34+
pip install -r requirements.txt
35+
python manage.py
36+
```
37+
38+
39+
Open `http://127.0.0.1:5000/ui/` and play with swagger
40+
2341
See our [quickstart webpage](https://python-microservices.github.io/scaffold/quickstart/)
2442

43+
# Dependencies
44+
45+
Updated dependencies in a requirements.txt with:
46+
47+
```shell
48+
poetry export --dev -f requirements.txt --output requirements.txt
49+
```
50+
2551
# How To contribute
2652

2753
We appreciate opening issues and pull requests to make PyMS even more stable & useful! See [This doc](CONTRIBUTING.md)

‎manage.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# encoding: utf-8
2-
from flask_script import Manager
3-
42
from project.app import MyMicroservice
53

64

@@ -15,7 +13,5 @@ def create_app():
1513

1614
app = create_app()
1715

18-
manager = Manager(app)
19-
2016
if __name__ == '__main__':
21-
manager.run()
17+
app.run()

‎poetry.lock

Lines changed: 2192 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎project/serializers/serializers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
from marshmallow import fields
2-
from marshmallow_sqlalchemy import ModelSchema
2+
from marshmallow_sqlalchemy import SQLAlchemySchema
33

44
from project.models.models import Film, Actor
55

66

7-
class ActorSchema(ModelSchema):
7+
class ActorSchema(SQLAlchemySchema):
88
class Meta:
99
model = Actor
1010
fields = ('id', 'name', 'surname')
1111

1212

13-
class FilmSchema(ModelSchema):
13+
class FilmSchema(SQLAlchemySchema):
1414
cast = fields.Nested(ActorSchema, many=True)
1515
pubDate = fields.String(required=True, data_key='pub_date', attribute="pub_date")
1616

‎pyproject.toml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,57 @@
1+
[tool.poetry]
2+
name = "MS-Scaffold"
3+
version = "2.3.0"
4+
description = "Python Miscroservice barebone"
5+
readme = "README.md"
6+
homepage = "https://python-microservices.github.io/"
7+
documentation = "https://python-microservices.github.io/"
8+
repository = "https://github.com/python-microservices/microservices-scaffold"
9+
license = "GPL-3.0-only"
10+
authors = ["avara1986 <a.vara.1986@gmail.com>"]
11+
classifiers = [
12+
"Development Status :: 6 - Mature",
13+
"Framework :: Flask",
14+
"Intended Audience :: Developers",
15+
"Intended Audience :: System Administrators",
16+
"Natural Language :: English",
17+
"Operating System :: OS Independent",
18+
"Programming Language :: Python",
19+
"Programming Language :: Python :: 3",
20+
"Programming Language :: Python :: 3 :: Only",
21+
"Programming Language :: Python :: 3.6",
22+
"Programming Language :: Python :: 3.7",
23+
"Programming Language :: Python :: 3.8",
24+
"Programming Language :: Python :: 3.9",
25+
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
26+
"Topic :: Internet :: WWW/HTTP",
27+
"Topic :: Software Development :: Libraries :: Application Frameworks",
28+
"Topic :: Software Development :: Libraries :: Python Modules",
29+
]
30+
31+
[tool.poetry.dependencies]
32+
python = ">=3.6.2,<4.0"
33+
Flask-SQLAlchemy = "==2.5.1"
34+
SQLAlchemy = "==1.4.23"
35+
py-ms = {extras = ["all"], version = "==2.8.0"}
36+
marshmallow = "==3.13.0"
37+
marshmallow-sqlalchemy = ">=0.26.1"
38+
importlib-metadata = "==2.1.1"
39+
cryptography = "<3.4.8"
40+
41+
[tool.poetry.dev-dependencies]
42+
requests-mock = "^1.9.3"
43+
coverage = ">=5.5"
44+
pytest = ">=5.4.3"
45+
pytest-cov = ">=2.12.1"
46+
pylint = ">=2.10.2"
47+
flake8 = "*"
48+
tox = ">=3.24.3"
49+
bandit = "*"
50+
safety = "*"
51+
pre-commit = ">=2.15.0"
52+
black = ">=21.8b0"
53+
mypy = ">=0.790"
54+
155
[tool.black]
256
line-length = 120
357
include = '\.pyi?$'

‎requirements-dev.txt

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

‎requirements.txt

Lines changed: 726 additions & 6 deletions
Large diffs are not rendered by default.

‎setup.cfg

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
[aliases]
2-
test=pytest
1+
[metadata]
2+
name = MS-Scaffold
3+
author = attr:project.__author__
4+
author_email = attr:project.__email__
5+
version = attr:project.__version__
6+
description = Python Miscroservice barebone
7+
long_description = file: README.md, LICENSE
38

4-
[tool:pytest]
5-
addopts = --cov=project --cov=tests tests/

‎setup.py

Lines changed: 3 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,5 @@
1-
# -*- coding: utf-8 -*-
21
# Copyright (c) 2018 by Alberto Vara <a.vara.1986@gmail.com>
3-
import codecs
4-
import os
2+
import setuptools
53

6-
from setuptools import setup, find_packages
7-
8-
version = __import__("project").__version__
9-
author = __import__("project").__author__
10-
author_email = __import__("project").__email__
11-
12-
if os.path.exists("README.rst"):
13-
long_description = codecs.open("README.rst", "r", "utf-8").read()
14-
else:
15-
long_description = "https://github.com/python-microservices/microservices-scaffold"
16-
17-
setup(
18-
name="MS-Scaffold",
19-
version=version,
20-
author=author,
21-
author_email=author_email,
22-
description="Python Miscroservice barebone",
23-
long_description=long_description,
24-
classifiers=[
25-
"Development Status :: 6 - Mature",
26-
"Environment :: Console",
27-
"Intended Audience :: Developers",
28-
"Intended Audience :: System Administrators",
29-
"Natural Language :: English",
30-
"License :: OSI Approved :: GPL License",
31-
"Operating System :: OS Independent",
32-
"Programming Language :: Python",
33-
"Programming Language :: Python :: 3.5",
34-
"Programming Language :: Python :: 3.6",
35-
],
36-
python_requires=">=3.5",
37-
license="GPLv3",
38-
platforms=["any"],
39-
keywords="python, microservices",
40-
url="https://github.com/python-microservices/microservices-scaffold",
41-
packages=find_packages(
42-
exclude=[
43-
"*.tests",
44-
"*.tests.*",
45-
"tests.*",
46-
"tests",
47-
"*.examples",
48-
"*.examples.*",
49-
"examples.*",
50-
"examples",
51-
]
52-
),
53-
setup_requires=[
54-
"pytest-runner>=2.0,<3dev",
55-
],
56-
include_package_data=True,
57-
)
4+
if __name__ == "__main__":
5+
setuptools.setup()

‎tox.ini

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
[tox]
2-
envlist=py36,py37,pylint,flake8,safety,bandit,docs
2+
envlist=py36,py37,py38,pylint,flake8,safety,bandit
33

44
[travis]
55
python =
66
3.6: py36
7-
3.7: py37,pylint,flake8,bandit,docs
8-
3.8: py38
7+
3.7: py37
8+
3.8: py38,pylint,flake8,bandit
99

1010
[testenv]
11-
deps = pipenv
1211
commands_pre=
13-
pipenv install --dev --ignore-pipfile
12+
poetry install --no-interaction --no-root
1413
commands=
15-
python setup.py test
14+
pytest --cov=project --cov=tests tests/
1615
[testenv:py36]
1716
basepython = python3.6
1817
[testenv:py37]

0 commit comments

Comments
 (0)
Please sign in to comment.