new: Programming language recommendations; First: Azure DevOps Pipeline.

This commit is contained in:
Christian Fravi 2025-01-22 16:49:45 +01:00
parent 786deb0e7d
commit cf6223b80a

View file

@ -0,0 +1,89 @@
# Programming language recommendations
## Azure DevOps Pipeline
The following programming languages are included in the comparison:
- [C# (.NET)](https://learn.microsoft.com/dotnet/csharp/)
- Shell Scripting [Bash](https://www.gnu.org/software/bash/) / [Zsh](https://www.zsh.org)
- [Python](https://www.python.org)
- [JavaScript](https://ecma-international.org/publications-and-standards/standards/ecma-262/) / [TypeScript](https://www.typescriptlang.org)
- [Ruby](https://www.ruby-lang.org)
- [Go](https://go.dev)
- [PowerShell](https://learn.microsoft.com/powershell/)
- [Java](https://www.java.com)
### Comparsion of the most important points
| Point | C# | Shell | Python | JS | Ruby | Go | PS | Java |
| ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |
| Data processing (JSON) | Built-in | Built-in | Built-in | Built-in | Built-in | Built-in | Built-in | Libraries |
| Data presentation (PDF) | Libraries | Not natively | Libraries | Libraries | Libraries | Libraries | Libraries | Libraries |
| Other data processing | Libraries | Not natively | Libraries | Libraries | Libraries | Libraries | Libraries | Libraries |
| Availability of Extensions | Many | Few | Many | Many | Many | Few | Many | Many |
| Simplicity in YAML | Moderate | High | Moderate | Moderate | Moderate | High | High | Moderate |
| Must be Compiled | Yes | No | No | No | No | Yes | No | Yes |
| Cross-Platform | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Simple Installation of Dependencies | Moderate | High | High | High | Moderate | High | High | Moderate |
### Recommended Language: [Python](https://www.python.org)
Python wins in all categories. The most benefits compared to the other languages:
- **Data Handling**: pull data, parse it, and then format it.
- **Document Generation**: The libraries for data presentation are fast and simple.
- **Dependencies**: are easy handled with requirments.txt.
- **Virtual Environments**: allows different Python versions to be used in the same pipeline.
- **REST APIs**: can be simple used with the Pythons requests library.
### Example Workflows for Python
#### Install Dependencies
Use a pipeline task to install Python (if not already on the agent) and the required libraries.
```yaml
- task: UsePythonVersion@0
inputs:
versionSpec: '3.x'
- script: |
pip install requests python-docx reportlab jinja2
```
#### Fetch Work Items
Write a Python script to call the Azure DevOps REST API to retrieve Work Items.
```python
import requests
# Example: Get Work Items from Azure DevOps
devops_organization_url = "https://dev.azure.com/YOUR_ORG"
project = "YOUR_PROJECT"
api_version = "6.0"
query_id = "YOUR_QUERY_ID"
response = requests.get(
f"{devops_organization_url}/{project}/_apis/wit/wiql/{query_id}?api-version={api_version}",
auth=('PAT_USERNAME', 'PAT_TOKEN') # or use other Auth methods
)
work_items_data = response.json()
```
#### Generate Compliance Documents
Convert the retrieved data into the document format of your choice.
```python
from docx import Document
from docx.shared import Inches
document = Document()
document.add_heading('Compliance Report', level=1)
for item in work_items_data["workItems"]:
document.add_heading(f'Work Item ID: {item["id"]}', level=2)
# Additional data insertion here...
document.save('ComplianceReport.docx')
```