forked from Azure/azure-sdk-for-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Template Project (Azure#4159)
* added the project. updated the setup to mirror the stuff a bit better. need to sync with Laurent to make certain this doesn't get built with the real stuff? * progress on template project. swapping away from markdown and starting to mirror the azure/<projectname>/<submodule> folder expressions. * much closer to what the template project should look like * keeping test template simple * getting closer. Tests probably should get updated * adding a bunch of settings * tests are now reflecting coverage properly * test being excluded properly now * removing extraneous comments * removing extraneous requirements file * removed references to compatibility. actually calling package code in test. responding to a couple other comments on the PR * addressing a couple comments. testing properly, swapping to markdown for readme * updating a comment in sdb_packing.toml to have proper grammar * small update to a comment in template setup * adding an additional comment to the test * adding reference to azure-packaging in the wiki
- Loading branch information
Showing
11 changed files
with
134 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
include *.md | ||
include azure/__init__.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,20 @@ | ||
[![Build Status](https://dev.azure.com/azure-sdk/public/_apis/build/status/azure-sdk-for-python.client?branchName=master)](https://dev.azure.com/azure-sdk/public/_build/latest?definitionId=46?branchName=master) | ||
|
||
# Azure Template Package | ||
|
||
This template package matches necessary patterns that the development team has established to create a unified sdk functional from Python 2.7 onwards. The packages contained herein can be installed singly or as part of the `azure` namespace. Any other introductory text should go here. | ||
|
||
This package has been tested with Python 2.7, 3.4, 3.5, 3.6 and 3.7. | ||
|
||
For a more complete set of Azure libraries, see the [azure](https://pypi.python.org/pypi/azure) bundle package. | ||
|
||
|
||
# Usage | ||
|
||
< This section should describe how to build your code and run the tests. > | ||
|
||
This readme (with some setup in ops) should eventually be ingested to [docs.microsoft.com](https://docs.microsoft.com/). | ||
|
||
# Provide Feedback | ||
|
||
If you encounter any bugs or have suggestions, please file an issue in the [Issues](<https://github.com/Azure/azure-sdk-for-python/issues>) section of the project. |
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 @@ | ||
__path__ = __import__('pkgutil').extend_path(__path__, __name__) |
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,5 @@ | ||
from .version import VERSION | ||
from .template_code import template_main | ||
|
||
__all__ = ['template_main'] | ||
__version__ = VERSION |
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 @@ | ||
def template_main(): | ||
print("Package code.") | ||
return True |
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,2 @@ | ||
# matches SEMVER | ||
VERSION = "0.0.1" |
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 @@ | ||
-e ../azure-sdk-tools |
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,9 @@ | ||
[packaging] | ||
auto_update = true | ||
package_name = "azure-template" | ||
package_pprint_name = "Template Package" | ||
is_stable = false | ||
is_arm = false | ||
|
||
# Package owners should uncomment and set this doc id. | ||
# package_doc_id = "<your doc id>" |
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,2 @@ | ||
[bdist_wheel] | ||
universal=1 |
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,74 @@ | ||
from setuptools import setup, find_packages | ||
import os | ||
from io import open | ||
import re | ||
|
||
# example setup.py Feel free to copy the entire "azure-template" folder into a package folder named | ||
# with "azure-<yourpackagename>". Ensure that the below arguments to setup() are updated to reflect | ||
# your package. | ||
|
||
# this setup.py is set up in a specific way to keep the azure* and azure-mgmt-* namespaces WORKING all the way | ||
# up from python 2.7. Reference here: https://github.com/Azure/azure-sdk-for-python/wiki/Azure-packaging | ||
|
||
PACKAGE_NAME = "azure-template" | ||
PACKAGE_PPRINT_NAME = "Template Package" | ||
|
||
# a-b-c => a/b/c | ||
package_folder_path = PACKAGE_NAME.replace('-', '/') | ||
# a-b-c => a.b.c | ||
namespace_name = PACKAGE_NAME.replace('-', '.') | ||
|
||
# Version extraction inspired from 'requests' | ||
with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: | ||
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', | ||
fd.read(), re.MULTILINE).group(1) | ||
if not version: | ||
raise RuntimeError('Cannot find version information') | ||
|
||
with open('README.md', encoding='utf-8') as f: | ||
long_description = f.read() | ||
|
||
setup( | ||
name=PACKAGE_NAME, | ||
version=version, | ||
description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), | ||
|
||
# ensure that these are updated to reflect the package owners' information | ||
long_description=long_description, | ||
url='https://github.com/Azure/azure-sdk-for-python', | ||
author='Microsoft Corporation', | ||
author_email='azuresdkengsysadmins@microsoft.com', | ||
|
||
license='MIT License', | ||
# ensure that the development status reflects the status of your package | ||
classifiers=[ | ||
'Development Status :: 3 - Alpha', | ||
|
||
'Programming Language :: Python', | ||
'Programming Language :: Python :: 2', | ||
'Programming Language :: Python :: 2.7', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.4', | ||
'Programming Language :: Python :: 3.5', | ||
'Programming Language :: Python :: 3.6', | ||
'Programming Language :: Python :: 3.7', | ||
'License :: OSI Approved :: MIT License', | ||
], | ||
packages=find_packages(exclude=[ | ||
'tests', | ||
# Exclude packages that will be covered by PEP420 or nspkg | ||
'azure' | ||
]), | ||
install_requires=[ | ||
'peppercorn' | ||
#,'msrest>=0.5.0' | ||
#,'azure-common~=1.1' | ||
], | ||
extras_require={ | ||
":python_version<'3.0'": ['azure-nspkg'], | ||
}, | ||
project_urls={ | ||
'Bug Reports': 'https://github.com/Azure/azure-sdk-for-python/issues', | ||
'Source': 'https://github.com/Azure/azure-sdk-python', | ||
} | ||
) |
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,15 @@ | ||
# Testing Azure Packages has some additional complication/reading required. | ||
# Reference https://github.com/Azure/azure-sdk-for-python/wiki/Contributing-to-the-tests | ||
# Pytest should be leveraged to test your project. | ||
|
||
from devtools_testutils import AzureMgmtTestCase | ||
from azure.template import template_main | ||
|
||
# this test case highlights that there are some additional Test capabilities present in devtools_testutils | ||
# as a package owner you are not required to use these. Standard PyTest implementation will work. | ||
class TemplateTest(AzureMgmtTestCase): | ||
def setUp(self): | ||
super(TemplateTest, self).setUp() | ||
|
||
def test_case_default(self): | ||
self.assertEqual(template_main(), True) |