Skip to content

Commit 0a2c263

Browse files
authored
🐛 Update __init__.py
- use default snake_case formatting - use spaces (4) for indentation - add template module docs
1 parent 8e92cf9 commit 0a2c263

1 file changed

Lines changed: 25 additions & 15 deletions

File tree

pkg-name/__init__.py

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,33 @@
11
# -*- encoding: utf-8 -*-
22

3-
__author__ = 'Debmalya Pramanik'
4-
__copyright__ = f"Copyright (c) [year] {__author__}"
3+
"""
4+
Python GIT & Docker Template for PyPI Package
55
6-
# __status__ = ""
7-
# __docformat__ = ""
6+
The package provides a template repository to create a python package,
7+
that can be seamlessly deployed on PyPI and configured via GIT and
8+
Docker for added capabilities.
89
9-
# Let's Check for the Dependencies
10-
hardDependencies = ['numpy'] # remove/update from setup.py
11-
missingDependencies = []
10+
@author: Debmalya Pramanik
11+
@copywright: 2021; Debmalya Pramanik
12+
"""
1213

13-
for dependency in hardDependencies:
14-
try:
15-
__import__(dependency)
16-
except ImportError:
17-
missingDependencies.append(dependency)
14+
# ? package follows https://peps.python.org/pep-0440/
15+
# ? https://python-semver.readthedocs.io/en/latest/advanced/convert-pypi-to-semver.html
16+
__version__ = "v0.0.1.dev0"
1817

19-
if missingDependencies:
20-
raise ImportError('Required Dependencies {}'.format(missingDependencies))
18+
# ! let's check for package hard dependencies which must be available
19+
hard_dependencies = [] # all should be available in ../requirements.txt
20+
missing_dependencies = []
21+
22+
for dependency in hard_dependencies:
23+
try:
24+
__import__(dependency)
25+
except ImportError as e:
26+
missing_dependencies.append(e.name)
27+
28+
# ! raise an error during import if any hard package is missing
29+
if missing_dependencies:
30+
raise ImportError(f"Missing hard dependencies: {", ".join(missing_dependencies)}")
2131

2232
# init-time Option Registrations
23-
from .api import *
33+
from .api import *

0 commit comments

Comments
 (0)