From 1590eee663f7392b48f96c8b1189fea618b8a365 Mon Sep 17 00:00:00 2001 From: Ezequiel Rozen Date: Fri, 9 Jun 2023 12:25:04 -0300 Subject: [PATCH] [DRE-94] Add publisher pypi (#76) * Add publisher pypi * change python version publisher * change setuptools version * change setuptools version * change setuptools version * change setuptools version * Change config openapi python * remove version * remove version * setuptools_scm * Change action publisher config * Change dynamic version * Change validate version * Change pypi test --- .github/workflows/pypi-publish.yml | 40 ++++++++++++++++++++++++++++++ .openapi-generator-ignore | 3 +-- .openapi-generator/FILES | 1 + MANIFEST.in | 2 ++ README.md | 15 +++++------ pyproject.toml | 21 ++++++++++++++++ 6 files changed, 73 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/pypi-publish.yml create mode 100644 MANIFEST.in diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml new file mode 100644 index 0000000..ffaffe5 --- /dev/null +++ b/.github/workflows/pypi-publish.yml @@ -0,0 +1,40 @@ +name: publish on pypi +on: + release: + types: [published] +jobs: + build-and-publish: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.11 + - name: Check if release creator is an authors + run: | + if [[ $(jq '.sender.type' $GITHUB_EVENT_PATH) == '"User"' ]]; then + creator_login=${{ github.event.release.author.login }} + if ! grep -q $creator_login AUTHORS.md; then + echo "Release creator is not an code owner, skipping the rest of the workflow." + exit 1 + fi + fi + - name: Validate release version + run: | + tag_name=${{ github.event.release.tag_name }} + version=$(cat VERSION) + if [ $tag_name != $version ]; then + echo "Release tag_name is not the same that in file VERSION" + exit 1 + fi + - name: Build project + run: python3 -m pip install --upgrade build && python3 -m build + - name: Publish package + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} + verbose: true \ No newline at end of file diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore index 340fe04..7b7c7e7 100644 --- a/.openapi-generator-ignore +++ b/.openapi-generator-ignore @@ -16,5 +16,4 @@ git_push.sh appveyor.yml .openapi-generator/ .openapi-generator -.github/workflows/python.yml -README.md \ No newline at end of file +.github/workflows/python.yml \ No newline at end of file diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 6cf8752..452e222 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -2,6 +2,7 @@ AUTHORS.md CODE_OF_CONDUCT.md LICENSE +README.md VERSION conekta/__init__.py conekta/api/__init__.py diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..e5ff3ce --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +exclude .devcontainer +exclude .vscode \ No newline at end of file diff --git a/README.md b/README.md index 423b292..8ca2665 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,10 @@ Then import the package: import conekta ``` +### Tests + +Execute `pytest` to run the tests. + ## Getting Started Please follow the [installation procedure](#installation--usage) and then run the following: @@ -52,12 +56,6 @@ import conekta from conekta.rest import ApiException from pprint import pprint -# Defining the host is optional and defaults to https://api.conekta.io -# See configuration.py for a list of all supported configuration parameters. -configuration = conekta.Configuration( - host = "https://api.conekta.io" -) - # The client must configure the authentication and authorization parameters # in accordance with the API server security policy. # Examples for each auth method are provided below, use the example that @@ -385,11 +383,14 @@ Class | Method | HTTP request | Description - [WebhookUpdateRequest](docs/WebhookUpdateRequest.md) - [WhitelistlistRuleResponse](docs/WhitelistlistRuleResponse.md) + ## Documentation For Authorization -## bearerAuth +Authentication schemes defined for the API: + +### bearerAuth - **Type**: Bearer authentication diff --git a/pyproject.toml b/pyproject.toml index c69608e..f0e4ae6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,5 +25,26 @@ flake8 = ">=4.0.0" requires = ["setuptools"] build-backend = "setuptools.build_meta" +[tool.setuptools_scm] + [tool.pylint.'MESSAGES CONTROL'] extension-pkg-whitelist = "pydantic" + +[project] +name = "conekta" +version = "6.0.0" +authors = [ + { name="Engineering Conekta", email="engineering@conekta.com" }, +] +description = "This is a Python library that allows interaction with https://api.conekta.io API." +readme = "README.md" +requires-python = ">=3.7" +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", +] + +[project.urls] +"Homepage" = "https://github.com/conekta/conekta-python" +"Bug Tracker" = "https://github.com/conekta/conekta-python/issues"