Skip to content

Add func.__version__ dunder method (PEP 440) #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions azure/functions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@
# Middlewares
'WsgiMiddleware',
)

__version__ = '1.2.0'
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from setuptools import setup
from azure.functions import __version__


setup(
name='azure-functions',
version='1.2.0',
version=__version__,
description='Azure Functions for Python',
author='Microsoft Corporation',
author_email='[email protected]',
Expand Down
10 changes: 10 additions & 0 deletions tests/test_code_quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import subprocess
import sys
import unittest
import re
import azure.functions as func


ROOT_PATH = pathlib.Path(__file__).parent.parent
Expand Down Expand Up @@ -47,3 +49,11 @@ def test_flake8(self):
output = ex.output.decode()
raise AssertionError(
f'flake8 validation failed:\n{output}') from None

def test_library_version(self):
# PEP 440 Parsing version strings with regular expressions
is_valid = re.match(
r'^([1-9][0-9]*!)?(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))'
r'*((a|b|rc)(0|[1-9][0-9]*))?(\.post(0|[1-9][0-9]*))'
r'?(\.dev(0|[1-9][0-9]*))?$', func.__version__) is not None
self.assertTrue(is_valid, '__version__ field must be canonical')