24
loading...
This website collects cookies to deliver better user experience
python3 -m devopsenv .
source ./devopsvenv/bin/activate
git clone <your git repo.git>
Select a name for your top python package
Chose a meaningful, but short (best a one-word). I am to create a python package called "animalsounds"
Now we can create subpackages. I am going to create different animals as its subpackages (for example dog, cat etc). Its functionality can be retrieved as animalsounds.dog..
from .functions import *
def makesound():
return "Woof! Woof!"
def makesound():
return "Meow! Meow!"
import pytest
import animalsounds.dog as d
import animalsounds.cat as c
def test_doghi():
dogres = d.makesound()
assert isinstance(dogres, str)
def test_cathi():
catres = c.makesound()
assert isinstance(catres, str)
python3 -m pytest <Path to test folder>
include README.md LICENSE
[metadata]
license_files = LICENSE
[bdist_wheel]
universal=1
.pypirc – This is an important file. Leave this file empty for now.
requirements.txt – In this file we will add all the packages that needs to be installed prior to our package, or that our package is dependent on. Add the following:
pip
pytest
wheel
twine
setuptools
from setuptools import setup, find_packages
with open('README.md') as f:
long_description = f.read()
setup(
name = 'animalsounds', # How you named your package folder (TSIClient)
packages = ['animalsounds'], # Chose the same as "name"
version = '1.0.0', # Start with a small number and increase it with every change you make
license='MIT', # Chose a license from here: https://help.github.com/articles/licensing-a-repository
long_description=long_description,
long_description_content_type='text/markdown', # This is important!
author = 'Vivek Raja P S', # Type in your name
author_email = '[email protected]', # Type in your E-Mail
url = 'https://github.com/Vivek0712/azure-devops-pypackage', # Provide either the link to your github or to your website
#download_url = 'https://github.com/RaaLabs/TSIClient/archive/v_0.7.tar.gz', # If you create releases through Github, then this is important
keywords = ['Azure', 'DevOps', 'Python'], # Keywords that define your package best
packages = find_packages("src", exclude=["test"]),
classifiers=[
'Development Status :: 3 - Alpha', # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package
'Intended Audience :: Developers', # Define that your audience are developers
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License', # Again, pick a license
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.9',
],
)
Review - Review if all the configurations are made properly.
And finally Run the pipeline.
Connect
pip install twine
twine upload -r <Artifact Feed Name> --config-file $(PYPIRC_PATH) d:\a\r1\a\<Build Pipeline Name>\dist\dist\*