diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c5a8e88..582d3df 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,22 +1,31 @@ name: Build and publish to PyPi -on: push +on: + workflow_dispatch: + inputs: + tag: + description: 'Tag to publish (v*.*.*)' + required: true + type: string jobs: build-n-publish: name: Build and publish to PyPi runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@master - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + with: + ref: ${{ inputs.tag }} + - uses: actions/setup-python@v5 - name: Install dependencies run: | - python -m pip install --upgrade setuptools wheel + python -m pip install --upgrade poetry + poetry install - name: Build run: | - python setup.py sdist bdist_wheel + poetry build + - name: Configure Poetry credentials + run: | + poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }} - name: Publish - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} + run: | + poetry publish diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 188f3fe..a8cd85b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,10 +10,11 @@ jobs: matrix: # https://help.github.com/articles/virtual-environments-for-github-actions platform: - - ubuntu-20.04 # ubuntu-20.04 - - macos-latest # macOS-10.14 - - windows-latest # windows-2019 - python-version: [ '3.6', '3.7', '3.8', '3.9', '3.10' ] + - ubuntu-20.04 + - macos-latest + - windows-latest + # https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json + python-version: [ '3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13' ] exclude: - platform: macos-latest python-version: '3.6' @@ -21,9 +22,9 @@ jobs: python-version: '3.7' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies diff --git a/.gitignore b/.gitignore index 7fca1ad..6701356 100644 --- a/.gitignore +++ b/.gitignore @@ -99,7 +99,7 @@ ipython_config.py # This is especially recommended for binary packages to ensure reproducibility, and is more # commonly ignored for libraries. # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control -#poetry.lock +poetry.lock # pdm # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e2dd60a..62d87c4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,7 +7,6 @@ To contribute, [fork](https://www.dynatrace.com/support/help/dynatrace-api) this [Tests](#tests) [Code formatting](#code-formatting) - ## Setup @@ -29,10 +28,18 @@ source .venv/bin/activate # On linux # On Windows cmd: .venv/Scripts/activate.bat ``` +You need Poetry on your system to be able to build and release the package. +If you don't have a system-wide installation of Poetry, you can install it +in the same virtual environment. + +```shell +pip install poetry +``` + Install the dev requirements: ```shell -pip install -r requirements_dev.txt +poetry install ``` Make sure tests pass: diff --git a/README.md b/README.md index 7d4a7f3..cf88c02 100644 --- a/README.md +++ b/README.md @@ -145,6 +145,7 @@ dt.settings.create_object(validate_only=False, body=settings_object) ActiveGates | :heavy_check_mark: | `dt.activegates` | ActiveGates - Auto-update configuration | :heavy_check_mark: | `dt.activegates_autoupdate_configuration` | ActiveGates - Auto-update jobs | :heavy_check_mark: | `dt.activegates_autoupdate_jobs` | + ActiveGates - Remote configuration | :heavy_check_mark: | `dt.activegates_remote_configuration` | Audit Logs | :heavy_check_mark: | `dt.audit_logs` | Events | :warning: | `dt.events_v2` | Extensions 2.0 | :heavy_check_mark: | `dt.extensions_v2` | @@ -153,6 +154,7 @@ dt.settings.create_object(validate_only=False, body=settings_object) Monitored entities | :warning: | `dt.entities` | Monitored entities - Custom tags | :heavy_check_mark: | `dt.custom_tags` | Network zones | :warning: | `dt.network_zones` | + OneAgents - Remote configuration | :heavy_check_mark: | `dt.oneagents_remote_configuration` | Problems | :heavy_check_mark: | `dt.problems` | Security problems | :x: | | Service-level objectives | :heavy_check_mark: | `dt.slos` | diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..f84d23c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,52 @@ +[tool.poetry] +name = "dt" +version = "1.1.71" +description = "Dynatrace API Python client" +readme = "README.md" +authors = ["David Lopes "] +maintainers = [ + "David Lopes ", + "James Kitson ", + "Vagiz Duseev " +] +homepage = "https://github.com/dynatrace-oss/api-client-python" +repository = "https://github.com/dynatrace-oss/api-client-python" +documentation = "https://github.com/dynatrace-oss/api-client-python" +packages = [ + { include = "dynatrace*" } +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "License :: OSI Approved", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: Implementation :: CPython", + "Operating System :: POSIX :: Linux", + "Operating System :: Microsoft :: Windows", + "Operating System :: MacOS", + "Topic :: Software Development", +] + +[tool.poetry.dependencies] +python = ">=3.6" +requests = ">=2.22" + +[tool.poetry.group.dev.dependencies] +pytest = "*" +mock = "*" +tox = "*" +wrapt = "*" + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" \ No newline at end of file diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 1c86341..0000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -requests>=2.22 \ No newline at end of file diff --git a/requirements_dev.txt b/requirements_dev.txt deleted file mode 100644 index d86f540..0000000 --- a/requirements_dev.txt +++ /dev/null @@ -1,5 +0,0 @@ -requests>=2.22 -pytest>=6.2.3 -mock -tox -wrapt==1.12.1 \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index fd93743..0000000 --- a/setup.py +++ /dev/null @@ -1,37 +0,0 @@ -from setuptools import find_packages, setup - -setup( - name="dt", - version="1.1.71", - packages=find_packages(include=["dynatrace*"]), - install_requires=["requests>=2.22"], - tests_require=["pytest", "mock", "tox"], - python_requires=">=3.6", - author="David Lopes", - author_email="davidribeirolopes@gmail.com", - description="Dynatrace API Python client", - long_description="Dynatrace API Python client", - url="https://github.com/dlopes7/dynatrace-rest-python", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "License :: OSI Approved", - "License :: OSI Approved :: Apache Software License", # 2.0 - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", - "Programming Language :: Python :: Implementation :: CPython", - "Operating System :: POSIX :: Linux", - "Operating System :: Microsoft :: Windows", - "Operating System :: MacOS", - "Topic :: Software Development", - ], - project_urls={"Issue Tracker": "https://github.com/dlopes7/dynatrace-rest-python/issues"}, -) diff --git a/test/mock_data/POST_api_v2_activeGates_remoteConfigurationManagement.json b/test/mock_data/POST_api_v2_activeGates_remoteConfigurationManagement_4cfaf0a9b26d2dd.json similarity index 100% rename from test/mock_data/POST_api_v2_activeGates_remoteConfigurationManagement.json rename to test/mock_data/POST_api_v2_activeGates_remoteConfigurationManagement_4cfaf0a9b26d2dd.json diff --git a/test/mock_data/POST_api_v2_activeGates_remoteConfigurationManagement_validator.json b/test/mock_data/POST_api_v2_activeGates_remoteConfigurationManagement_validator_4cfaf0a9b26d2dd.json similarity index 100% rename from test/mock_data/POST_api_v2_activeGates_remoteConfigurationManagement_validator.json rename to test/mock_data/POST_api_v2_activeGates_remoteConfigurationManagement_validator_4cfaf0a9b26d2dd.json diff --git a/test/mock_data/POST_api_v2_oneagents_remoteConfigurationManagement.json b/test/mock_data/POST_api_v2_oneagents_remoteConfigurationManagement_4cfaf0a9b26d2dd.json similarity index 100% rename from test/mock_data/POST_api_v2_oneagents_remoteConfigurationManagement.json rename to test/mock_data/POST_api_v2_oneagents_remoteConfigurationManagement_4cfaf0a9b26d2dd.json diff --git a/test/mock_data/POST_api_v2_oneagents_remoteConfigurationManagement_validator.json b/test/mock_data/POST_api_v2_oneagents_remoteConfigurationManagement_validator_4cfaf0a9b26d2dd.json similarity index 100% rename from test/mock_data/POST_api_v2_oneagents_remoteConfigurationManagement_validator.json rename to test/mock_data/POST_api_v2_oneagents_remoteConfigurationManagement_validator_4cfaf0a9b26d2dd.json