Skip to content

Task/refactor packaging #144

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

Merged
merged 4 commits into from
Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
pipenv run isort .
- name: Lint with Pylint
run: |
pipenv run pylint msgraph --disable=W --rcfile=.pylintrc
pipenv run pylint src --disable=W --rcfile=.pylintrc
- name: Test with pytest
run: |
pipenv run pytest
Expand Down
27 changes: 14 additions & 13 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v1
uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.8
- name: Install flit
python-version: 3.9
- name: Install dependencies
run: |
pip install flit
- name: Publish the distibution to PyPI
if: github.repository == 'microsoftgraph/msgraph-sdk-python-core'
run: flit publish
env:
FLIT_INDEX_URL: https://upload.pypi.org/legacy/
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
4 changes: 3 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ microsoft-kiota-authentication-azure = "==0.1.0"
httpx = {version = "==0.23.0", extras = ["http2"]}

[dev-packages] # Packages required to develop the application
flit = "==3.7.1"
setuptools = "==65.5.1"
build = "==0.9.0"
bumpver = "==2022.1119"
pylint = "==2.15.4"
mypy = "==0.982"
yapf = "==0.32.0"
Expand Down
258 changes: 164 additions & 94 deletions Pipfile.lock

Large diffs are not rendered by default.

10 changes: 0 additions & 10 deletions msgraph/core/__init__.py

This file was deleted.

34 changes: 27 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
[build-system]
requires = ["flit_core >=3.2,<4"]
build-backend = "flit_core.buildapi"
requires = ["setuptools>=65.5.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "msgraph-core"
version = "0.2.2"
authors = [{name = "Microsoft", email = "[email protected]"}]
description = "Core component of the Microsoft Graph Python SDK"
dependencies = [
"microsoft-kiota-abstractions >=0.1.0",
"microsoft-kiota-http >=0.1.0",
"httpx[http2] >=0.23.0",
]
requires-python = ">=3.6"
license = {file = "LICENSE"}
readme = "README.md"
keywords = ["msgraph", "openAPI", "Microsoft", "Graph"]
Expand All @@ -23,19 +26,18 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"License :: OSI Approved :: MIT License",
]
dynamic = ["version", "description"]

[project.optional-dependencies]
dev = ["yapf", "bumpver", "isort", "pylint", "pytest", "mypy"]

[project.urls]
homepage = "https://github.com/microsoftgraph/msgraph-sdk-python-core#readme"
repository = "https://github.com/microsoftgraph/msgraph-sdk-python-core"
documentation = "https://github.com/microsoftgraph/msgraph-sdk-python-core/docs"

[tool.flit.module]
name = "msgraph"

[tool.mypy]
warn_unused_configs = true
files = "msgraph"
files = "src"
ignore_missing_imports = true

[tool.yapf]
Expand All @@ -46,3 +48,21 @@ column_limit = 100

[tool.isort]
profile = "hug"

[tool.pytest.ini_options]
pythonpath = [
"src"
]

[tool.bumpver]
current_version = "0.2.2"
version_pattern = "MAJOR.MINOR.PATCH"
commit_message = "bump version {old_version} -> {new_version}"
commit = true
tag = false
push = false

[tool.bumpver.file_patterns]
"pyproject.toml" = ['current_version = "{version}"', 'version = "{version}"']
"src/msgraph_core/__init__.py" = ["{version}"]

5 changes: 4 additions & 1 deletion msgraph/__init__.py → src/msgraph_core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"""
Core component of the Microsoft Graph Python SDK consisting of HTTP/Graph Client and a configurable middleware pipeline (Preview).
"""
from .core import SDK_VERSION
from ._constants import SDK_VERSION
from ._enums import APIVersion, NationalClouds
from .base_graph_request_adapter import BaseGraphRequestAdapter
from .graph_client_factory import GraphClientFactory

__version__ = SDK_VERSION
File renamed without changes.
File renamed without changes.
9 changes: 3 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import httpx
import pytest
from kiota_abstractions.authentication import AnonymousAuthenticationProvider
from kiota_authentication_azure.azure_identity_access_token_provider import (
AzureIdentityAccessTokenProvider,
)

from msgraph.core import APIVersion, NationalClouds
from msgraph.core.graph_client_factory import GraphClientFactory
from msgraph.core.middleware import GraphRequestContext
from msgraph_core import APIVersion, NationalClouds
from msgraph_core.graph_client_factory import GraphClientFactory
from msgraph_core.middleware import GraphRequestContext

BASE_URL = NationalClouds.Global + '/' + APIVersion.v1

Expand Down
3 changes: 1 addition & 2 deletions tests/unit/test_base_graph_request_adapter.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import httpx
import pytest
from asyncmock import AsyncMock
from kiota_abstractions.serialization import (
ParseNodeFactoryRegistry,
SerializationWriterFactoryRegistry,
)

from msgraph.core.base_graph_request_adapter import BaseGraphRequestAdapter
from msgraph_core.base_graph_request_adapter import BaseGraphRequestAdapter


def test_create_graph_request_adapter(mock_auth_provider):
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_graph_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import pytest
from kiota_http.middleware import AsyncKiotaTransport, MiddlewarePipeline, RedirectHandler

from msgraph.core import APIVersion, GraphClientFactory, NationalClouds
from msgraph.core.middleware.telemetry import GraphTelemetryHandler
from msgraph_core import APIVersion, GraphClientFactory, NationalClouds
from msgraph_core.middleware.telemetry import GraphTelemetryHandler


def test_create_with_default_middleware():
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/test_graph_telemetry_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import httpx
import pytest

from msgraph.core import SDK_VERSION, APIVersion, NationalClouds
from msgraph.core._enums import FeatureUsageFlag
from msgraph.core.middleware import GraphRequestContext, GraphTelemetryHandler
from msgraph_core import SDK_VERSION, APIVersion, NationalClouds
from msgraph_core._enums import FeatureUsageFlag
from msgraph_core.middleware import GraphRequestContext, GraphTelemetryHandler

BASE_URL = NationalClouds.Global + '/' + APIVersion.v1

Expand Down