Skip to content

Commit aa37ef4

Browse files
authored
Merge pull request #329 from microsoft/feature/kiota-python
Merge sources into one repo
2 parents 8040917 + 6da0197 commit aa37ef4

File tree

310 files changed

+24857
-244
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

310 files changed

+24857
-244
lines changed

.github/workflows/build.yml

Lines changed: 57 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,33 @@ on:
88
push:
99
branches: [main]
1010
pull_request:
11-
branches: [main, dev]
11+
branches: [main]
1212
workflow_call:
1313

1414
jobs:
1515
build:
1616
runs-on: ubuntu-latest
1717
timeout-minutes: 40
1818
strategy:
19-
max-parallel: 5
19+
max-parallel: 10
2020
matrix:
2121
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
22+
library :
23+
- name: "kiota_abstractions"
24+
path: "./packages/abstractions"
25+
- name: "kiota_authentication_azure"
26+
path: "./packages/authentication/azure"
27+
- name: "kiota_http"
28+
path: "./packages/http/httpx"
29+
- name: "kiota_serialization_form"
30+
path: "./packages/serialization/form"
31+
- name: "kiota_serialization_json"
32+
path: "./packages/serialization/json"
33+
- name: "kiota_serialization_text"
34+
path: "./packages/serialization/text"
35+
- name: "kiota_serialization_multipart"
36+
path: "./packages/serialization/multipart"
37+
2238
steps:
2339
- name: Checkout
2440
uses: actions/checkout@v4
@@ -27,31 +43,62 @@ jobs:
2743
with:
2844
python-version: ${{ matrix.python-version }}
2945
- name: Install dependencies
46+
working-directory: ${{ matrix.library.path }}
3047
run: |
31-
python -m pip install --upgrade pip
32-
pip install -r requirements-dev.txt
48+
python -m pip install --upgrade poetry
49+
poetry install
3350
- name: Check code format
51+
working-directory: ${{ matrix.library.path }}
3452
run: |
35-
yapf -dr kiota_abstractions
53+
poetry run yapf -dr ${{ matrix.library.name }}
3654
- name: Check import order
55+
working-directory: ${{ matrix.library.path }}
3756
run: |
38-
isort kiota_abstractions
57+
poetry run isort ${{ matrix.library.name }}
3958
- name: Lint with Pylint
59+
working-directory: ${{ matrix.library.path }}
4060
run: |
41-
pylint kiota_abstractions --disable=W --rcfile=.pylintrc
61+
poetry run pylint ${{ matrix.library.name }} --disable=W --rcfile=.pylintrc
4262
- name: Static type checking with Mypy
63+
working-directory: ${{ matrix.library.path }}
4364
run: |
44-
mypy kiota_abstractions
65+
poetry run mypy ${{ matrix.library.name }}
4566
- name: Run the tests
67+
working-directory: ${{ matrix.library.path }}
4668
run: |
47-
pytest
69+
poetry run pytest
70+
71+
validation-workflow-with-generated-code:
72+
runs-on: ubuntu-latest
73+
timeout-minutes: 40
74+
strategy:
75+
max-parallel: 10
76+
matrix:
77+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
4878

79+
steps:
80+
- name: Checkout
81+
uses: actions/checkout@v4
82+
- name: Set up Python ${{ matrix.python-version }}
83+
uses: actions/setup-python@v5
84+
with:
85+
python-version: ${{ matrix.python-version }}
86+
- name: Install dependencies
87+
working-directory: "./tests/validation"
88+
run: |
89+
python -m pip install --upgrade poetry
90+
poetry install
91+
- name: Static type checking with Mypy
92+
working-directory: "./tests/validation"
93+
run: |
94+
poetry run mypy validation
95+
4996

5097
# The check-python-version-matrix returns success if all matrix jobs in build are successful; otherwise, it returns a failure.
5198
# Use this as a PR status check for GitHub Policy Service instead of individual matrix entry checks.
5299
check-python-version-matrix:
53100
runs-on: ubuntu-latest
54-
needs: [build]
101+
needs: [build,validation-workflow-with-generated-code]
55102
if: always()
56103
steps:
57104
- name: All build matrix options are successful

.github/workflows/publish.yml

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,34 +18,37 @@ jobs:
1818
if: startsWith(github.ref, 'refs/tags/v')
1919
environment: pypi_prod
2020
needs: [build]
21+
env:
22+
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
2123
steps:
2224
- name: Checkout code
2325
uses: actions/checkout@v4
2426
- name: Set up Python
2527
uses: actions/setup-python@v5
2628
with:
2729
python-version: 3.12
28-
- name: Install flit
30+
- name: Install dependencies
2931
run: |
30-
pip install flit
31-
- name: Publish the distibution to PyPI
32-
run: flit publish
33-
env:
34-
FLIT_INDEX_URL: https://upload.pypi.org/legacy/
35-
FLIT_USERNAME: __token__
36-
FLIT_PASSWORD: ${{ secrets. PYPI_API_TOKEN }}
37-
38-
release:
39-
name: Create release
40-
runs-on: ubuntu-latest
41-
needs: [publish]
42-
steps:
43-
- name: Checkout
44-
uses: actions/checkout@v4
45-
- name: Extract release notes
46-
id: extract-release-notes
47-
uses: ffurrer2/extract-release-notes@v2
48-
- name: Create release
49-
env:
50-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51-
run: gh release create --notes '${{ steps.extract-release-notes.outputs.release_notes }}' --title ${{ github.ref_name }} ${{ github.ref_name }}
32+
python -m pip install --upgrade poetry
33+
- name: Publish kiota_abstractions to PyPI
34+
run: poetry publish --build
35+
working-directory: "./packages/abstractions"
36+
- name: Publish kiota_authentication_azure to PyPI
37+
run: poetry publish --build
38+
working-directory: "./packages/authentication/azure"
39+
- name: Publish kiota_http to PyPI
40+
run: poetry publish --build
41+
working-directory: "./packages/http/httpx"
42+
- name: Publish kiota_serialization_form to PyPI
43+
run: poetry publish --build
44+
working-directory: "./packages/serialization/form"
45+
- name: Publish kiota_serialization_json to PyPI
46+
run: poetry publish --build
47+
working-directory: "./packages/serialization/json"
48+
- name: Publish kiota_serialization_text to PyPI
49+
run: poetry publish --build
50+
working-directory: "./packages/serialization/text"
51+
- name: Publish kiota_serialization_multipart to PyPI
52+
run: poetry publish --build
53+
working-directory: "./packages/serialization/multipart"
54+

.release-please-manifest.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"packages/abstractions": "1.3.4",
3+
"packages/authentication/azure": "1.3.4",
4+
"packages/http/httpx": "1.3.4",
5+
"packages/serialization/json": "1.3.4",
6+
"packages/serialization/form": "1.3.4",
7+
"packages/serialization/text": "1.3.4",
8+
"packages/serialization/multipart": "1.3.4"
9+
}

CONTRIBUTING.md

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
2+
# Contributing to Kiota Java
3+
4+
Kiota Python is a mono-repo containing source code for the following packages:
5+
6+
- 'microsoft-kiota-abstractions'
7+
- 'microsoft-kiota-authentication-azure'
8+
- 'microsoft-kiota-http'
9+
- 'microsoft-kiota-serialization-form'
10+
- 'microsoft-kiota-serialization-json'
11+
- 'microsoft-kiota-serialization-text'
12+
- 'microsoft-kiota-serialization-multipart'
13+
14+
Kiota Python is open to contributions. There are a couple of different recommended paths to get contributions into the released version of this library.
15+
16+
__NOTE__ A signed a contribution license agreement is required for all contributions, and is checked automatically on new pull requests. Please read and sign [the agreement](https://cla.microsoft.com/) before starting any work for this repository.
17+
18+
## File issues
19+
20+
The best way to get started with a contribution is to start a dialog with the owners of this repository. Sometimes features will be under development or out of scope for this SDK and it's best to check before starting work on contribution. Discussions on bugs and potential fixes could point you to the write change to make.
21+
22+
## Submit pull requests for bug fixes and features
23+
24+
Feel free to submit a pull request with a linked issue against the __main__ branch. The main branch will be updated frequently.
25+
26+
## Commit message format
27+
28+
To support our automated release process, pull requests are required to follow the [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/)
29+
format.
30+
Each commit message consists of a __header__, an optional __body__ and an optional __footer__. The header is the first line of the commit and
31+
MUST have a __type__ (see below for a list of types) and a __description__. An optional __scope__ can be added to the header to give extra context.
32+
33+
```
34+
<type>[optional scope]: <short description>
35+
<BLANK LINE>
36+
<optional body>
37+
<BLANK LINE>
38+
<optional footer(s)>
39+
```
40+
41+
The recommended commit types used are:
42+
43+
- __feat__ for feature updates (increments the _minor_ version)
44+
- __fix__ for bug fixes (increments the _patch_ version)
45+
- __perf__ for performance related changes e.g. optimizing an algorithm
46+
- __refactor__ for code refactoring changes
47+
- __test__ for test suite updates e.g. adding a test or fixing a test
48+
- __style__ for changes that don't affect the meaning of code. e.g. formatting changes
49+
- __docs__ for documentation updates e.g. ReadMe update or code documentation updates
50+
- __build__ for build system changes (gradle updates, external dependency updates)
51+
- __ci__ for CI configuration file changes e.g. updating a pipeline
52+
- __chore__ for miscallaneous non-sdk changesin the repo e.g. removing an unused file
53+
Adding a an exclamation mark after the commit type (`feat!`) or footer with the prefix __BREAKING CHANGE:__ will cause an increment of the _major_ version.
54+
55+
## Working with source locally
56+
57+
To support the mono-repo structure and release processes, the individual projects leverage [poetry](https://python-poetry.org/) for package management.
58+
59+
Therefore, to validate,lint and manage packages, you would need to install poetry for easier management of the source.
60+
61+
```shell
62+
python -m pip install --upgrade poetry
63+
```
64+
65+
### Running validations in individual projects
66+
67+
To install dependencies, run the command below in the directory of the project you are working on.
68+
69+
```shell
70+
poetry install
71+
```
72+
73+
To fix the code format to align to linting rules setup using `yapf`, run the command below in the directory of the project you are working on.
74+
75+
```shell
76+
poetry run yapf -ir {projectName}
77+
```
78+
79+
To check the code format to align to linting rules setup using `yapf`, run the command below in the directory of the project you are working on.
80+
81+
```shell
82+
poetry run yapf -dr {projectName}
83+
```
84+
85+
To lint the code using `pylint`, run the command below in the directory of the project you are working on.
86+
87+
```shell
88+
poetry run pylint {projectName} --disable=W --rcfile=.pylintrc
89+
```
90+
91+
To run the tests using `pytest`, run the command below in the directory of the project you are working on.
92+
93+
```shell
94+
poetry run pylint pytest
95+
```
96+
97+
To run type checking using `mypy` , run the command below in the directory of the project you are working on.
98+
99+
```shell
100+
poetry run mypy {projectName}
101+
```
102+
103+
### Running validations across all projects
104+
105+
To help with validation of validations across all projects, you can leverage the [powershell script](./kiota-python.ps1) at the root of repository. The script will handle the above scenarios by changing directories and running the relevant command across all the projects in the mono repo.
106+
107+
To install dependencies across all projects, run the following in a powershell shell from the repository root.
108+
109+
```shell
110+
.\kiota-python.ps1 install-deps
111+
```
112+
113+
To fix the code format to align to linting rules setup using `yapf` across all projects, run the following in a powershell shell from the repository root.
114+
115+
```shell
116+
.\kiota-python.ps1 format
117+
```
118+
119+
To check the code format to align to linting rules setup using `yapf` across all projects, run the following in a powershell shell from the repository root.
120+
121+
```shell
122+
.\kiota-python.ps1 check-format
123+
```
124+
125+
To lint the code using `pylint` across all projects, run the following in a powershell shell from the repository root.
126+
127+
```shell
128+
.\kiota-python.ps1 lint
129+
```
130+
131+
To run the tests using `pytest` across all projects, run the following in a powershell shell from the repository root.
132+
133+
```shell
134+
.\kiota-python.ps1 test
135+
```
136+
137+
To run type checking using `mypy` across all projects, run the following in a powershell shell from the repository root.
138+
139+
```shell
140+
.\kiota-python.ps1 check-types
141+
```
142+
143+
__TIP__ Running `.\kiota-python.ps1 test` should give a hint of all available commands you can pass to the script to run across projects which can be configured this in [this file](.\projects-config.json).

Makefile

Lines changed: 0 additions & 12 deletions
This file was deleted.

README.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,32 @@
1-
# Microsoft Kiota Abstractions Library for Python
2-
[![PyPI version](https://badge.fury.io/py/microsoft-kiota-abstractions.svg)](https://badge.fury.io/py/microsoft-kiota-abstractions)
3-
[![CI Actions Status](https://github.com/microsoft/kiota-abstractions-python/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/microsoft/kiota-abstractions-python/actions)
4-
[![Downloads](https://pepy.tech/badge/microsoft-kiota-abstractions)](https://pepy.tech/project/microsoft-kiota-abstractions)
1+
# Kiota Libraries for python
52

6-
The Microsoft Kiota abstractions library for Python is the python package defining the basic constructs Kiota projects need once an SDK has been generated from an OpenAPI definition.
3+
The Kiota libraries define the basic constructs for Kiota projects needed once an SDK has been generated from an OpenAPI definition and provide default implementations.
74

8-
A [Kiota](https://github.com/microsoft/kiota) generated project will need a reference to the abstraction package to build and run.
5+
A [Kiota](https://github.com/microsoft/kiota) generated project will need a reference to the libraries to build and execute by providing default implementations for serialization, authentication and http transport.
96

107
Read more about Kiota [here](https://github.com/microsoft/kiota/blob/main/README.md).
118

12-
## Using the Abstractions Library
9+
## Build Status
1310

14-
In order to use this library, install the package by running:
11+
[![CI Actions Status](https://github.com/microsoft/kiota-python/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/microsoft/kiota-python/actions)
1512

16-
```cmd
17-
pip install microsoft-kiota-abstractions
18-
```
13+
## Libraries
14+
15+
| Library | Pypi Release | Changelog |
16+
|---------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------|
17+
| [Abstractions](./packages/abstractions/README.md) | [![PyPI version](https://badge.fury.io/py/microsoft-kiota-abstractions.svg)](https://badge.fury.io/py/microsoft-kiota-abstractions) | [Changelog](./packages/abstractions/CHANGELOG.md) |
18+
| [Authentication - Azure](./packages/authentication/azure/README.md) | [![PyPI version](https://badge.fury.io/py/microsoft-kiota-authentication-azure.svg)](https://badge.fury.io/py/microsoft-kiota-authentication-azure) | [Changelog](./packages/authentication/azure/CHANGELOG.md) |
19+
| [Http - HttpClientLibrary](./packages/http/httpx/README.md) | [![PyPI version](https://badge.fury.io/py/microsoft-kiota-http.svg)](https://badge.fury.io/py/microsoft-kiota-http) | [Changelog](./packages/http/httpx/CHANGELOG.md) |
20+
| [Serialization - JSON](./packages/serialization/json/README.md) | [![PyPI version](https://badge.fury.io/py/microsoft-kiota-serialization-json.svg)](https://badge.fury.io/py/microsoft-kiota-serialization-json) | [Changelog](./packages/serialization/json/CHANGELOG.md) |
21+
| [Serialization - FORM](./packages/serialization/form/README.md) | [![PyPI version](https://badge.fury.io/py/microsoft-kiota-serialization-form.svg)](https://badge.fury.io/pymicrosoft-kiota-serialization-form) | [Changelog](./packages/serialization/form/CHANGELOG.md) |
22+
| [Serialization - TEXT](./packages/serialization/text/README.md) | [![PyPI version](https://badge.fury.io/py/microsoft-kiota-serialization-text.svg)](https://badge.fury.io/py/microsoft-kiota-serialization-text) | [Changelog](./packages/serialization/text/CHANGELOG.md) |
23+
| [Serialization - MULTIPART](./packages/serialization/multipart/README.md) | [![PyPI version](https://badge.fury.io/py/microsoft-kiota-serialization-multipart.svg)](https://badge.fury.io/py/microsoft-kiota-multipart) | [Changelog](./packages/serialization/multipart/CHANGELOG.md) |
1924

2025
## Contributing
2126

2227
This project welcomes contributions and suggestions. Most contributions require you to agree to a
2328
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
24-
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
29+
the rights to use your contribution. For details, visit <https://cla.opensource.microsoft.com>.
2530

2631
When you submit a pull request, a CLA bot will automatically determine whether you need to provide
2732
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
@@ -33,8 +38,8 @@ contact [[email protected]](mailto:[email protected]) with any additio
3338

3439
## Trademarks
3540

36-
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
37-
trademarks or logos is subject to and must follow
41+
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
42+
trademarks or logos is subject to and must follow
3843
[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
3944
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
4045
Any use of third-party trademarks or logos are subject to those third-party's policies.

0 commit comments

Comments
 (0)