From b094b992293e5347c15ae594ad232a249640a9af Mon Sep 17 00:00:00 2001 From: Will Munslow Date: Fri, 9 May 2025 11:16:37 -0700 Subject: [PATCH] refactor: modernize Python packaging to use pyproject.toml - Remove setup.py, setup.cfg, requirements.txt and test-requirements.txt - Consolidate all package configuration in pyproject.toml - Update GitHub Actions workflows to use new configuration - Remove unnecessary CI files (.travis.yml, .gitlab-ci.yml, git_push.sh) - Update installation instructions in README.md - Bump version to 3.1.6 --- .github/workflows/continuous-integration.yml | 3 +- .github/workflows/python-publish.yml | 7 +-- .gitignore | 2 + .gitlab-ci.yml | 25 --------- .travis.yml | 17 ------ README.md | 26 +++++---- git_push.sh | 57 -------------------- onelogin/__init__.py | 2 +- pyproject.toml | 54 +++++++++++++------ requirements.txt | 5 -- setup.cfg | 2 - setup.py | 45 ---------------- test-requirements.txt | 3 -- tox.ini | 12 ++--- 14 files changed, 60 insertions(+), 200 deletions(-) delete mode 100644 .gitlab-ci.yml delete mode 100644 .travis.yml delete mode 100644 git_push.sh delete mode 100644 requirements.txt delete mode 100644 setup.cfg delete mode 100644 setup.py delete mode 100644 test-requirements.txt diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index f2bb8e9e..3bb74f80 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -20,8 +20,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install . pip install -e ".[test]" - name: Test run: | - python -m unittest + python -m pytest diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 0f49c49b..b8f2f5c5 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -32,12 +32,7 @@ jobs: python -m pip install --upgrade pip pip install build - name: Build package - run: python -m - build - --sdist - --wheel - --outdir dist/ - . + run: python -m build --sdist --wheel --outdir dist/ . - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: diff --git a/.gitignore b/.gitignore index 43995bd4..dfdd9b7e 100644 --- a/.gitignore +++ b/.gitignore @@ -64,3 +64,5 @@ target/ #Ipython Notebook .ipynb_checkpoints + +**/.claude/settings.local.json diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index d0dda390..00000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,25 +0,0 @@ -# NOTE: This file is auto generated by OpenAPI Generator. -# URL: https://openapi-generator.tech -# -# ref: https://docs.gitlab.com/ee/ci/README.html -# ref: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml - -stages: - - test - -.pytest: - stage: test - script: - - pip install -r requirements.txt - - pip install -r test-requirements.txt - - pytest --cov=onelogin - -pytest-3.7: - extends: .pytest - image: python:3.7-alpine -pytest-3.8: - extends: .pytest - image: python:3.8-alpine -pytest-3.9: - extends: .pytest - image: python:3.9-alpine \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7f7e1a75..00000000 --- a/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -# ref: https://docs.travis-ci.com/user/languages/python -language: python -python: - - "3.7" - - "3.8" - - "3.9" - - "3.10" - - "3.11" - # uncomment the following if needed - #- "3.11-dev" # 3.11 development branch - #- "nightly" # nightly build -# command to install dependencies -install: - - "pip install -r requirements.txt" - - "pip install -r test-requirements.txt" -# command to run tests -script: pytest --cov=onelogin diff --git a/README.md b/README.md index 37ed6c9d..63f43e29 100644 --- a/README.md +++ b/README.md @@ -17,13 +17,17 @@ Python 3.7+ ### pip install -If the python package is hosted on a repository, you can install directly using: +You can install directly using pip: ```sh pip install onelogin ``` -(you may need to run `pip` with root permission: `sudo pip install onelogin`) +For development and testing, install with test dependencies: + +```sh +pip install onelogin[test] +``` Then import the package: @@ -31,26 +35,20 @@ Then import the package: import onelogin ``` -### Setuptools +### Tests -Install via [Setuptools](http://pypi.python.org/pypi/setuptools). +First, install the package with test dependencies: ```sh -python setup.py install --user +pip install -e .[test] ``` -(or `sudo python setup.py install` to install the package for all users) - -Then import the package: +Then run the tests: -```python -import onelogin +```sh +pytest ``` -### Tests - -Execute `pytest` to run the tests. - ## Getting Started Please follow the [installation procedure](#installation--usage) and then run the following: diff --git a/git_push.sh b/git_push.sh deleted file mode 100644 index f53a75d4..00000000 --- a/git_push.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 -git_host=$4 - -if [ "$git_host" = "" ]; then - git_host="github.com" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - git_user_id="GIT_USER_ID" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="GIT_REPO_ID" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=$(git remote) -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' diff --git a/onelogin/__init__.py b/onelogin/__init__.py index e0fb47a0..94a54159 100644 --- a/onelogin/__init__.py +++ b/onelogin/__init__.py @@ -14,7 +14,7 @@ """ -__version__ = "3.1.5" +__version__ = "3.1.6" # import apis into sdk package from onelogin.api.api_auth_claims_api import APIAuthClaimsApi diff --git a/pyproject.toml b/pyproject.toml index fefec1f1..79f6c48c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,29 +1,49 @@ -[tool.poetry] +[project] name = "onelogin" -version = "3.1.5" +version = "3.1.6" description = "OneLogin API" -authors = ["OneLogin "] -license = "NoLicense" +authors = [ + {name = "OneLogin", email = "team@openapitools.org"} +] +license = {text = "NoLicense"} readme = "README.md" -repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID" keywords = ["OpenAPI", "OpenAPI-Generator", "OneLogin API"] +requires-python = ">=3.7" +dependencies = [ + "urllib3>=2.0.2", + "python-dateutil>=2.5.3", + "pydantic>=2.11.0", + "aenum>=3.1.11", + "setuptools>=67.7.1", +] -[tool.poetry.dependencies] -python = "^3.7" +[project.optional-dependencies] +test = [ + "pytest~=7.1.3", + "pytest-cov>=2.8.1", + "pytest-randomly>=3.12.0", + "flake8>=4.0.0", + "tox>=3.9.0", +] -urllib3 = ">= 1.25.3" -python-dateutil = ">=2.8.2" -pydantic = ">=2.11.0" -aenum = ">=3.1.11" - -[tool.poetry.dev-dependencies] -pytest = ">=7.2.1" -tox = ">=3.9.0" -flake8 = ">=4.0.0" +[project.urls] +Repository = "https://github.com/onelogin/onelogin-python-sdk" [build-system] -requires = ["setuptools"] +requires = ["setuptools>=67.7.1", "wheel"] build-backend = "setuptools.build_meta" +[tool.setuptools] +packages = ["onelogin"] +package-dir = {"" = "."} +include-package-data = true + +[tool.pytest.ini_options] +testpaths = ["test"] +python_files = "test_*.py" + +[tool.flake8] +max-line-length = 99 + [tool.pylint.'MESSAGES CONTROL'] extension-pkg-whitelist = "pydantic" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index a6479dd8..00000000 --- a/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -python_dateutil >= 2.5.3 -setuptools >= 67.7.1 -urllib3 >= 2.0.2 -pydantic >= 2.11.0 -aenum >= 3.1.11 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 11433ee8..00000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[flake8] -max-line-length=99 diff --git a/setup.py b/setup.py deleted file mode 100644 index 734588cb..00000000 --- a/setup.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding: utf-8 - -""" - OneLogin API - - OpenAPI Specification for OneLogin # noqa: E501 - - The version of the OpenAPI document: 3.1.1 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" - - -from setuptools import setup, find_packages # noqa: H301 - -# To install the library, run the following -# -# python setup.py install -# -# prerequisite: setuptools -# http://pypi.python.org/pypi/setuptools -NAME = "onelogin" -VERSION = "3.1.5" - -PYTHON_REQUIRES = ">=3.7" -with open("requirements.txt") as f: - requirements = f.read().splitlines() - -setup( - name=NAME, - version=VERSION, - description="OneLogin API", - author="OneLogin", - author_email="team@openapitools.org", - url="", - keywords=["OpenAPI", "OpenAPI-Generator", "OneLogin API"], - install_requires=requirements, - packages=find_packages(exclude=["test", "tests"]), - include_package_data=True, - long_description_content_type='text/markdown', - long_description="""\ - OpenAPI Specification for OneLogin # noqa: E501 - """ -) diff --git a/test-requirements.txt b/test-requirements.txt deleted file mode 100644 index 3a0d0b93..00000000 --- a/test-requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -pytest~=7.1.3 -pytest-cov>=2.8.1 -pytest-randomly>=3.12.0 diff --git a/tox.ini b/tox.ini index 41c726b3..9426acac 100644 --- a/tox.ini +++ b/tox.ini @@ -1,9 +1,9 @@ [tox] -envlist = py3 +envlist = py37, py38, py39, py310, py311 +isolated_build = True [testenv] -deps=-r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt - -commands= - pytest --cov=onelogin +deps = + .[test] +commands = + pytest --cov=onelogin