Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge sources into one repo #329

Merged
merged 42 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
d28b49d
WIP: consistent abstractions project.
andrueastman Sep 8, 2024
5b0ed83
add authentication project
andrueastman Sep 9, 2024
424c151
add http package
andrueastman Sep 9, 2024
dd3472c
add json serialization package
andrueastman Sep 9, 2024
0dc8a32
add form serialization
andrueastman Sep 9, 2024
34efc40
add multipart package
andrueastman Sep 9, 2024
260342a
add text serialization library
andrueastman Sep 9, 2024
68d8ca9
test workflows
andrueastman Sep 9, 2024
2bc6a18
use path
andrueastman Sep 9, 2024
db2dd38
remove lock files
andrueastman Sep 9, 2024
17acde0
align configs
andrueastman Sep 9, 2024
0203e83
more validations
andrueastman Sep 9, 2024
fe9acfc
fix typo
andrueastman Sep 9, 2024
f1124eb
todo validate missing imports
andrueastman Sep 9, 2024
a928f96
fix typo
andrueastman Sep 9, 2024
5782dce
fixing failing multipart lib
andrueastman Sep 9, 2024
74af29b
add missing dev dependency
andrueastman Sep 9, 2024
eb817e7
use relative path project imports
andrueastman Sep 9, 2024
7ec7701
setup publishing workflow
andrueastman Sep 9, 2024
08bc61b
Merge main into feature/kiota-python
andrueastman Sep 10, 2024
1f879d7
Merge main into feature/kiota-python
andrueastman Sep 11, 2024
2227122
resolve typing errors in the project
andrueastman Sep 13, 2024
ede3732
format code
andrueastman Sep 13, 2024
d371499
Merge main into feature/kiota-python
andrueastman Sep 23, 2024
b02c779
Merge branch 'feature/kiota-python' into andrueastman/resolvetypinger…
andrueastman Sep 23, 2024
6465520
adds validation with generated project
andrueastman Sep 23, 2024
a6f130d
Merge pull request #340 from microsoft/andrueastman/addgenerationVali…
andrueastman Sep 23, 2024
6e0e396
pr review feedback
andrueastman Sep 25, 2024
6842de0
feat: setup release please.
andrueastman Oct 7, 2024
da8e453
Merge pull request #331 from microsoft/andrueastman/resolvetypingerrors
andrueastman Oct 8, 2024
33b779d
chore: formating for very long lines
andrueastman Oct 8, 2024
5411d15
Merge pull request #344 from microsoft/andrueastman/resolveVersioning
andrueastman Oct 8, 2024
ddab7a4
chore: run formatting tool for the repo
andrueastman Oct 8, 2024
fad4205
sync sources.
andrueastman Oct 8, 2024
ec48153
Merge pull request #345 from microsoft/andrueastman/syncSources
baywet Oct 8, 2024
90c5510
chore: cleanup readme
andrueastman Oct 9, 2024
93ce2b0
add common validation check
andrueastman Oct 9, 2024
412d8b9
Merge branch 'main' into feature/kiota-python
andrueastman Oct 14, 2024
505c5b9
sync sources for https://github.com/microsoft/kiota-http-python/pull/434
andrueastman Oct 14, 2024
8a41b73
Merge pull request #351 from microsoft/andrueastman/syncSources
andrueastman Oct 14, 2024
0461225
Merge remote-tracking branch 'origin/main' into feature/kiota-python
andrueastman Oct 14, 2024
6da0197
resolve missed typing issue.
andrueastman Oct 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
67 changes: 57 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,33 @@ on:
push:
branches: [main]
pull_request:
branches: [main, dev]
branches: [main]
workflow_call:

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 40
strategy:
max-parallel: 5
max-parallel: 10
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
library :
- name: "kiota_abstractions"
path: "./packages/abstractions"
- name: "kiota_authentication_azure"
path: "./packages/authentication/azure"
- name: "kiota_http"
path: "./packages/http/httpx"
- name: "kiota_serialization_form"
path: "./packages/serialization/form"
- name: "kiota_serialization_json"
path: "./packages/serialization/json"
- name: "kiota_serialization_text"
path: "./packages/serialization/text"
- name: "kiota_serialization_multipart"
path: "./packages/serialization/multipart"

steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -27,31 +43,62 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
working-directory: ${{ matrix.library.path }}
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
python -m pip install --upgrade poetry
poetry install
- name: Check code format
working-directory: ${{ matrix.library.path }}
run: |
yapf -dr kiota_abstractions
poetry run yapf -dr ${{ matrix.library.name }}
- name: Check import order
working-directory: ${{ matrix.library.path }}
run: |
isort kiota_abstractions
poetry run isort ${{ matrix.library.name }}
- name: Lint with Pylint
working-directory: ${{ matrix.library.path }}
run: |
pylint kiota_abstractions --disable=W --rcfile=.pylintrc
poetry run pylint ${{ matrix.library.name }} --disable=W --rcfile=.pylintrc
- name: Static type checking with Mypy
working-directory: ${{ matrix.library.path }}
run: |
mypy kiota_abstractions
poetry run mypy ${{ matrix.library.name }}
- name: Run the tests
working-directory: ${{ matrix.library.path }}
run: |
pytest
poetry run pytest

validation-workflow-with-generated-code:
runs-on: ubuntu-latest
timeout-minutes: 40
strategy:
max-parallel: 10
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
working-directory: "./tests/validation"
run: |
python -m pip install --upgrade poetry
poetry install
- name: Static type checking with Mypy
working-directory: "./tests/validation"
run: |
poetry run mypy validation


# The check-python-version-matrix returns success if all matrix jobs in build are successful; otherwise, it returns a failure.
# Use this as a PR status check for GitHub Policy Service instead of individual matrix entry checks.
check-python-version-matrix:
runs-on: ubuntu-latest
needs: [build]
needs: [build,validation-workflow-with-generated-code]
if: always()
steps:
- name: All build matrix options are successful
Expand Down
49 changes: 26 additions & 23 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,37 @@ jobs:
if: startsWith(github.ref, 'refs/tags/v')
environment: pypi_prod
needs: [build]
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install flit
- name: Install dependencies
run: |
pip install flit
- name: Publish the distibution to PyPI
run: flit publish
env:
FLIT_INDEX_URL: https://upload.pypi.org/legacy/
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets. PYPI_API_TOKEN }}

release:
name: Create release
runs-on: ubuntu-latest
needs: [publish]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract release notes
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v2
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create --notes '${{ steps.extract-release-notes.outputs.release_notes }}' --title ${{ github.ref_name }} ${{ github.ref_name }}
python -m pip install --upgrade poetry
- name: Publish kiota_abstractions to PyPI
run: poetry publish --build
working-directory: "./packages/abstractions"
- name: Publish kiota_authentication_azure to PyPI
run: poetry publish --build
working-directory: "./packages/authentication/azure"
- name: Publish kiota_http to PyPI
run: poetry publish --build
working-directory: "./packages/http/httpx"
- name: Publish kiota_serialization_form to PyPI
run: poetry publish --build
working-directory: "./packages/serialization/form"
- name: Publish kiota_serialization_json to PyPI
run: poetry publish --build
working-directory: "./packages/serialization/json"
- name: Publish kiota_serialization_text to PyPI
run: poetry publish --build
working-directory: "./packages/serialization/text"
- name: Publish kiota_serialization_multipart to PyPI
run: poetry publish --build
working-directory: "./packages/serialization/multipart"

9 changes: 9 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"packages/abstractions": "1.3.4",
"packages/authentication/azure": "1.3.4",
"packages/http/httpx": "1.3.4",
"packages/serialization/json": "1.3.4",
"packages/serialization/form": "1.3.4",
"packages/serialization/text": "1.3.4",
"packages/serialization/multipart": "1.3.4"
}
143 changes: 143 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@

# Contributing to Kiota Java

Kiota Python is a mono-repo containing source code for the following packages:

- 'microsoft-kiota-abstractions'
- 'microsoft-kiota-authentication-azure'
- 'microsoft-kiota-http'
- 'microsoft-kiota-serialization-form'
- 'microsoft-kiota-serialization-json'
- 'microsoft-kiota-serialization-text'
- 'microsoft-kiota-serialization-multipart'

Kiota Python is open to contributions. There are a couple of different recommended paths to get contributions into the released version of this library.

__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.

## File issues

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.

## Submit pull requests for bug fixes and features

Feel free to submit a pull request with a linked issue against the __main__ branch. The main branch will be updated frequently.

## Commit message format

To support our automated release process, pull requests are required to follow the [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/)
format.
Each commit message consists of a __header__, an optional __body__ and an optional __footer__. The header is the first line of the commit and
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.

```
<type>[optional scope]: <short description>
<BLANK LINE>
<optional body>
<BLANK LINE>
<optional footer(s)>
```

The recommended commit types used are:

- __feat__ for feature updates (increments the _minor_ version)
- __fix__ for bug fixes (increments the _patch_ version)
- __perf__ for performance related changes e.g. optimizing an algorithm
- __refactor__ for code refactoring changes
- __test__ for test suite updates e.g. adding a test or fixing a test
- __style__ for changes that don't affect the meaning of code. e.g. formatting changes
- __docs__ for documentation updates e.g. ReadMe update or code documentation updates
- __build__ for build system changes (gradle updates, external dependency updates)
- __ci__ for CI configuration file changes e.g. updating a pipeline
- __chore__ for miscallaneous non-sdk changesin the repo e.g. removing an unused file
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.

## Working with source locally

To support the mono-repo structure and release processes, the individual projects leverage [poetry](https://python-poetry.org/) for package management.

Therefore, to validate,lint and manage packages, you would need to install poetry for easier management of the source.

```shell
python -m pip install --upgrade poetry
```

### Running validations in individual projects

To install dependencies, run the command below in the directory of the project you are working on.

```shell
poetry install
```

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.

```shell
poetry run yapf -ir {projectName}
```

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.

```shell
poetry run yapf -dr {projectName}
```

To lint the code using `pylint`, run the command below in the directory of the project you are working on.

```shell
poetry run pylint {projectName} --disable=W --rcfile=.pylintrc
```

To run the tests using `pytest`, run the command below in the directory of the project you are working on.

```shell
poetry run pylint pytest
```

To run type checking using `mypy` , run the command below in the directory of the project you are working on.

```shell
poetry run mypy {projectName}
```

### Running validations across all projects

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.

To install dependencies across all projects, run the following in a powershell shell from the repository root.

```shell
.\kiota-python.ps1 install-deps
```

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.

```shell
.\kiota-python.ps1 format
```

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.

```shell
.\kiota-python.ps1 check-format
```

To lint the code using `pylint` across all projects, run the following in a powershell shell from the repository root.

```shell
.\kiota-python.ps1 lint
```

To run the tests using `pytest` across all projects, run the following in a powershell shell from the repository root.

```shell
.\kiota-python.ps1 test
```

To run type checking using `mypy` across all projects, run the following in a powershell shell from the repository root.

```shell
.\kiota-python.ps1 check-types
```

__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).
12 changes: 0 additions & 12 deletions Makefile

This file was deleted.

33 changes: 19 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
# Microsoft Kiota Abstractions Library for Python
[![PyPI version](https://badge.fury.io/py/microsoft-kiota-abstractions.svg)](https://badge.fury.io/py/microsoft-kiota-abstractions)
[![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)
[![Downloads](https://pepy.tech/badge/microsoft-kiota-abstractions)](https://pepy.tech/project/microsoft-kiota-abstractions)
# Kiota Libraries for python

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.
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.

A [Kiota](https://github.com/microsoft/kiota) generated project will need a reference to the abstraction package to build and run.
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.

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

## Using the Abstractions Library
## Build Status

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

```cmd
pip install microsoft-kiota-abstractions
```
## Libraries

| Library | Pypi Release | Changelog |
|---------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------|
| [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) |
| [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) |
| [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) |
| [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) |
| [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) |
| [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) |
| [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) |

## Contributing

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

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

## Trademarks

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