-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
161 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,3 +127,11 @@ dmypy.json | |
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# IDE | ||
.idea/* | ||
|
||
# System | ||
.DS_Store | ||
MANIFEST | ||
*.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM python:3.6-alpine | ||
|
||
COPY requirements.txt ./ | ||
|
||
RUN pip install -r requirements.txt | ||
|
||
Add /src /app | ||
|
||
WORKDIR /app | ||
|
||
CMD ["python", "app.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
Python Seed App | ||
=============== | ||
|
||
Inspired by `MarshalJoe <https://github.com/MarshalJoe>`__ | ||
|
||
This is a simple skeleton for a generic Python (3.6) app. It comes | ||
loaded with: | ||
|
||
- Project automation with | ||
`tox <https://tox.readthedocs.io/en/latest/>`__ | ||
- Test with `pytest <https://pytest.readthedocs.io/en/latest/>`__ | ||
- Style with `pylint <https://pylint.readthedocs.io/en/latest/>`__ | ||
|
||
As well a ``.gitignore``, ``.pylintrc`` config file, and simple | ||
directory structure employing the ``src`` pattern. | ||
|
||
Setup | ||
----- | ||
|
||
Using Docker: | ||
|
||
.. code:: bash | ||
# build the image: | ||
docker build -t seed-app . | ||
# Run image: | ||
docker run -it seed-app | ||
Testing | ||
------- | ||
|
||
To find out more info about the testing configuration, check out the | ||
``tox.ini`` file. | ||
Use the ``dev-requirements.txt`` for libraries only used for tests or dev. | ||
|
||
.. code:: bash | ||
# Run the test suite | ||
tox | ||
# Run the linter: | ||
tox -e lint | ||
# Runt the coverage on the src module | ||
pytest -e coverage | ||
Misc Notes | ||
---------- | ||
|
||
- Make sure and edit the package title in ``setup.py`` to reflect your | ||
app name | ||
- If you have issue with tox and ``ModuleNotFoundError``, try set | ||
``recreate`` to ``True`` in ``tox.ini``. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
tox | ||
pytest | ||
pytest-cov | ||
pylint |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from setuptools import setup, find_packages | ||
|
||
with open('README.rst') as file: | ||
long_description = file.read() | ||
|
||
with open('requirements.txt') as file: | ||
requirements = file.read().split("\n") | ||
|
||
setup( | ||
name='python_see_app', | ||
version='0.1', | ||
description='', | ||
long_description=long_description, | ||
keywords='', | ||
url='', | ||
author='', | ||
author_email='', | ||
classifiers=[ | ||
'Development Status :: 3 - Alpha', | ||
'Programming Language :: Python :: 3.6', | ||
], | ||
packages=find_packages(), | ||
install_requires=requirements, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import os | ||
|
||
ROOT_PATH = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from src import ROOT_PATH | ||
|
||
|
||
def hello(): | ||
return "Hello World!" | ||
|
||
|
||
def root_path(): | ||
return ROOT_PATH | ||
|
||
|
||
if __name__ == "__main__": | ||
print(hello()) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import unittest | ||
|
||
from src.app import hello, root_path | ||
|
||
|
||
class ParserTest(unittest.TestCase): | ||
|
||
def setUp(self): | ||
print("\nSet up - Before each test") | ||
|
||
def test_hello_world(self): | ||
self.assertEqual("Hello World!", hello()) | ||
|
||
def test_root_path(self): | ||
self.assertTrue("python-seed-app" in root_path()) | ||
|
||
def tearDown(self): | ||
print("Tear Down - After each Test\n") | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[tox] | ||
minversion = 2.0 | ||
envlist = py36 | ||
skipsdist = True | ||
|
||
[testenv] | ||
commands = pytest {posargs} | ||
deps = -r requirements.txt | ||
-r dev-requirements.txt | ||
recreate = False | ||
passenv = * | ||
|
||
[testenv:coverage] | ||
commands = pytest --cov=src tests/ | ||
deps = -r requirements.txt | ||
-r dev-requirements.txt | ||
recreate = True # To put to False once your requirements stops changing | ||
passenv = * | ||
|
||
[testenv:lint] | ||
basepython=python3.6 | ||
deps = -r requirements.txt | ||
-r dev-requirements.txt | ||
commands=pylint src |