зеркало из https://github.com/Azure/benchpress.git
Create an installable benchpress python module. Configure dev container. Update documentation on how to use Python module
This commit is contained in:
Родитель
4ccab42ad8
Коммит
5572ced9ed
|
@ -42,7 +42,8 @@
|
|||
|
||||
// Python
|
||||
"ms-python.python",
|
||||
"ms-python.vscode-pylance"
|
||||
"ms-python.vscode-pylance",
|
||||
"njpwerner.autodocstring"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
@ -53,9 +54,10 @@
|
|||
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
// Installs:
|
||||
// 1. Mega Linter
|
||||
// 2. Pester
|
||||
"postCreateCommand": "npm install -g mega-linter-runner && pwsh -command Install-Module -Name Pester -Force -SkipPublisherCheck",
|
||||
// 1. Mega Linter
|
||||
// 2. Pester
|
||||
// 3. Configures benchpress Python module
|
||||
"postCreateCommand": "npm install -g mega-linter-runner && pwsh -command Install-Module -Name Pester -Force -SkipPublisherCheck && pip install --editable ./framework/python/",
|
||||
|
||||
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
||||
"remoteUser": "vscode",
|
||||
|
|
|
@ -6,6 +6,15 @@ This guide walks you through the process of starting development on *Benchpress*
|
|||
If you’re using [Visual Studio Code](https://code.visualstudio.com/) as your IDE of choice, then this project contains all of the necessary configurations to bootstrap your development environment. See the section on [Development environment setup within VS Code
|
||||
](#development-environment-setup-within-vs-code)
|
||||
|
||||
### Development environment setup within VS Code
|
||||
Visual Studio Code supports compilation and development on a container known as [Dev Containers](https://code.visualstudio.com/docs/remote/containers).
|
||||
|
||||
If you’re using VS Code, please install see the installation guide to install Docker and VS Code extension: https://code.visualstudio.com/docs/remote/containers#_installation
|
||||
|
||||
Then launch the environment by opening the command pallete <kbd>Shift</kbd>+<kbd>Command</kbd>+<kbd>P</kbd> (Mac) / <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Windows/Linux) and running `Dev Containers: Open Folder in Container`
|
||||
|
||||
The Dev Container configuration also contains VS Code extensions for linting/formatting/testing/compilation.
|
||||
|
||||
### Development dependencies
|
||||
Depending on the feature/language you are working on, you may need to download and install language-specific packages, e.g., Python 3.
|
||||
|
||||
|
@ -17,12 +26,9 @@ List of requirements on development machine:
|
|||
- PowerShell 8
|
||||
- Python 3
|
||||
|
||||
#### Python setup
|
||||
From the root directory, execute to install benchpress as a referenceable module:
|
||||
|
||||
### Development environment setup within VS Code
|
||||
Visual Studio Code supports compilation and development on a container known as [Dev Containers](https://code.visualstudio.com/docs/remote/containers).
|
||||
> pip install --editable ./framework/python/
|
||||
|
||||
If you’re using VS Code, please install see the installation guide to install Docker and VS Code extension: https://code.visualstudio.com/docs/remote/containers#_installation
|
||||
|
||||
Then launch the environment by opening the command pallete <kbd>Shift</kbd>+<kbd>Command</kbd>+<kbd>P</kbd> (Mac) / <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Windows/Linux) and running `Dev Containers: Open Folder in Container`
|
||||
|
||||
The Dev Container configuration also contains VS Code extensions for linting/formatting/testing/compilation.
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
print("Hello world")
|
|
@ -0,0 +1,3 @@
|
|||
[build-system]
|
||||
requires = ["setuptools"]
|
||||
build-backend = "setuptools.build_meta"
|
|
@ -0,0 +1,19 @@
|
|||
[metadata]
|
||||
name = benchpress
|
||||
version = 0.0.1
|
||||
author = Uffaz Nathaniel
|
||||
url = https://github.com/Azure/benchpress
|
||||
description = Testing framework for Azure deployment features by using Bicep.
|
||||
keywords = azure, bicep, arm, iac, testing
|
||||
|
||||
[options]
|
||||
package_dir=
|
||||
=src
|
||||
zip_safe = True
|
||||
include_package_data = True
|
||||
install_requires =
|
||||
protobuf == 4.21.9
|
||||
pytest
|
||||
|
||||
[options.packages.find]
|
||||
where=src
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
|
||||
from .calculator import add
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
|
||||
def add(num1: int, num2: int) -> int:
|
||||
"""Adds two numbers together and returns their results
|
||||
|
||||
Args:
|
||||
num1 (int): The first number to add
|
||||
num2 (int): The second number to add
|
||||
|
||||
Returns:
|
||||
int: The computed result of `num1 + num2`
|
||||
"""
|
||||
return num1 + num2
|
|
@ -1,18 +0,0 @@
|
|||
# Python Program to find the area of triangle
|
||||
|
||||
a = 5
|
||||
b = 6
|
||||
c = 7
|
||||
|
||||
# Uncomment below to take inputs from the user
|
||||
# a = float(input('Enter first side: '))
|
||||
# b = float(input('Enter second side: '))
|
||||
# c = float(input('Enter third side: '))
|
||||
|
||||
# calculate the semi-perimeter
|
||||
s = (a + b + c) / 2
|
||||
|
||||
# calculate the area
|
||||
area = (s * (s-a) * (s-b) * (s-c)) ** 0.5
|
||||
print('The area of the triangle is: ' + area)
|
||||
print('test')
|
|
@ -0,0 +1,8 @@
|
|||
from benchpress import add
|
||||
|
||||
|
||||
def test_add():
|
||||
"""
|
||||
Test benchpress's add method
|
||||
"""
|
||||
assert add(1, 2) == 3
|
Загрузка…
Ссылка в новой задаче