Skip to content

Commit

Permalink
provider migrate cloudant (#46405)
Browse files Browse the repository at this point in the history
* Update provider schema to include excluded-python-versions

The provider schema previously supported this field but it was dropped
during the provider migration project. Cloudant is the only provider at
the time of writing which makes use of this mechanism

* Migrate Cloudant provider to new structure

* Updates from PR feedback

* Add wildcard for all patch releases of an excluded python version

If it is not already present add a wild card for all patch releases of
an excluded python version

* Fix install_airflow script to remove cloudant on 3.9

* Remove more spaces

* Remove the fix for version exclusions

With functional version exclusion in requires-python working, many
things in our CI are not setup to support this. So go back to "soft"
or non-functional exclusions. This will at least update the classifiers
  • Loading branch information
o-nikolas authored Feb 5, 2025
1 parent 0a3eb17 commit 9161259
Show file tree
Hide file tree
Showing 32 changed files with 495 additions and 37 deletions.
4 changes: 1 addition & 3 deletions .github/boring-cyborg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ labelPRBasedOnFilePath:
- providers/celery/**

provider:cloudant:
- providers/src/airflow/providers/cloudant/**/*
- docs/apache-airflow-providers-cloudant/**/*
- providers/tests/cloudant/**/*
- providers/cloudant/**

provider:cncf-kubernetes:
- airflow/example_dags/example_kubernetes_executor.py
Expand Down
7 changes: 7 additions & 0 deletions airflow/new_provider.yaml.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
"removed"
]
},
"excluded-python-versions": {
"description": "List of python versions excluded for that provider",
"type": "array",
"items": {
"type": "string"
}
},
"integrations": {
"description": "List of integrations supported by the provider.",
"type": "array",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,7 @@ def _regenerate_pyproject_toml(context: dict[str, Any], provider_details: Provid
trim_blocks=True,
keep_trailing_newline=True,
)

get_pyproject_toml_path.write_text(get_pyproject_toml_content)
get_console().print(
f"[info]Generated {get_pyproject_toml_path} for the {provider_details.provider_id} provider\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ classifiers = [
{% endfor %}
"Topic :: System :: Monitoring",
]
requires-python = "~=3.9"
requires-python = "{{ REQUIRES_PYTHON }}"

# The dependencies should be modified in place in the generated file
# Any change in the dependencies is preserved when the file is regenerated
Expand Down
8 changes: 8 additions & 0 deletions dev/breeze/src/airflow_breeze/utils/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

from airflow_breeze.global_constants import (
ALLOWED_PYTHON_MAJOR_MINOR_VERSIONS,
DEFAULT_PYTHON_MAJOR_MINOR_VERSION,
PROVIDER_DEPENDENCIES,
PROVIDER_RUNTIME_DATA_SCHEMA_PATH,
REGULAR_DOC_PACKAGES,
Expand Down Expand Up @@ -788,6 +789,12 @@ def get_provider_jinja_context(
p for p in ALLOWED_PYTHON_MAJOR_MINOR_VERSIONS if p not in provider_details.excluded_python_versions
]
cross_providers_dependencies = get_cross_provider_dependent_packages(provider_package_id=provider_id)

# Most providers require the same python versions, but some may have exclusions
requires_python_version: str = f"~={DEFAULT_PYTHON_MAJOR_MINOR_VERSION}"
for excluded_python_version in provider_details.excluded_python_versions:
requires_python_version += f",!={excluded_python_version}"

context: dict[str, Any] = {
"PROVIDER_ID": provider_details.provider_id,
"PACKAGE_PIP_NAME": get_pip_package_name(provider_details.provider_id),
Expand Down Expand Up @@ -825,6 +832,7 @@ def get_provider_jinja_context(
"PIP_REQUIREMENTS_TABLE_RST": convert_pip_requirements_to_table(
get_provider_requirements(provider_id), markdown=False
),
"REQUIRES_PYTHON": requires_python_version,
}
return context

Expand Down
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ apache-airflow-providers-apprise
apache-airflow-providers-asana
apache-airflow-providers-atlassian-jira
apache-airflow-providers-celery
apache-airflow-providers-cloudant
apache-airflow-providers-cohere
apache-airflow-providers-common-compat
apache-airflow-providers-common-io
Expand Down
25 changes: 0 additions & 25 deletions docs/apache-airflow-providers-cloudant/changelog.rst

This file was deleted.

2 changes: 1 addition & 1 deletion generated/provider_dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@
"cloudant": {
"deps": [
"apache-airflow>=2.9.0",
"ibmcloudant==0.9.1 ; python_version >= \"3.10\""
"ibmcloudant==0.9.1;python_version>=\"3.10\""
],
"devel-deps": [],
"plugins": [],
Expand Down
62 changes: 62 additions & 0 deletions providers/cloudant/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@

.. Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
.. http://www.apache.org/licenses/LICENSE-2.0
.. Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
.. NOTE! THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE OVERWRITTEN!
.. IF YOU WANT TO MODIFY TEMPLATE FOR THIS FILE, YOU SHOULD MODIFY THE TEMPLATE
`PROVIDER_README_TEMPLATE.rst.jinja2` IN the `dev/breeze/src/airflow_breeze/templates` DIRECTORY
Package ``apache-airflow-providers-cloudant``

Release: ``4.1.0``


`IBM Cloudant <https://www.ibm.com/cloud/cloudant>`__


Provider package
----------------

This is a provider package for ``cloudant`` provider. All classes for this provider package
are in ``airflow.providers.cloudant`` python package.

You can find package information and changelog for the provider
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-cloudant/4.1.0/>`_.

Installation
------------

You can install this package on top of an existing Airflow 2 installation (see ``Requirements`` below
for the minimum Airflow version supported) via
``pip install apache-airflow-providers-cloudant``

The package supports the following python versions: 3.10,3.11,3.12

Requirements
------------

================== =====================================
PIP package Version required
================== =====================================
``apache-airflow`` ``>=2.9.0``
``ibmcloudant`` ``==0.9.1; python_version >= "3.10"``
================== =====================================

The changelog for the provider package can be found in the
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-cloudant/4.1.0/changelog.html>`_.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ versions:
- 1.0.1
- 1.0.0

dependencies:
- apache-airflow>=2.9.0
# Even though 3.9 is excluded below, we need to make this python_version aware so that `uv` can generate a
# full lock file when building lock file from provider sources
- 'ibmcloudant==0.9.1 ; python_version >= "3.10"'

excluded-python-versions:
# ibmcloudant transitively brings in urllib3 2.x, but the snowflake provider has a dependency that pins
# urllib3 to 1.x on Python 3.9; thus we exclude those Python versions from taking the update
Expand All @@ -65,7 +59,7 @@ excluded-python-versions:
integrations:
- integration-name: IBM Cloudant
external-doc-url: https://www.ibm.com/cloud/cloudant
logo: /integration-logos/cloudant/Cloudant.png
logo: /docs/integration-logos/Cloudant.png
tags: [service]

hooks:
Expand Down
79 changes: 79 additions & 0 deletions providers/cloudant/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# NOTE! THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE OVERWRITTEN!

# IF YOU WANT TO MODIFY THIS FILE EXCEPT DEPENDENCIES, YOU SHOULD MODIFY THE TEMPLATE
# `pyproject_TEMPLATE.toml.jinja2` IN the `dev/breeze/src/airflow_breeze/templates` DIRECTORY
[build-system]
requires = ["flit_core==3.10.1"]
build-backend = "flit_core.buildapi"

[project]
name = "apache-airflow-providers-cloudant"
version = "4.1.0"
description = "Provider package apache-airflow-providers-cloudant for Apache Airflow"
readme = "README.rst"
authors = [
{name="Apache Software Foundation", email="[email protected]"},
]
maintainers = [
{name="Apache Software Foundation", email="[email protected]"},
]
keywords = [ "airflow-provider", "cloudant", "airflow", "integration" ]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"Framework :: Apache Airflow",
"Framework :: Apache Airflow :: Provider",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: System :: Monitoring",
]
requires-python = "~=3.9,!=3.9"

# The dependencies should be modified in place in the generated file
# Any change in the dependencies is preserved when the file is regenerated
dependencies = [
"apache-airflow>=2.9.0",
# Even though 3.9 is excluded below, we need to make this python_version aware so that `uv` can generate a
# full lock file when building lock file from provider sources
"ibmcloudant==0.9.1;python_version>=\"3.10\"",
]

[project.urls]
"Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-cloudant/4.1.0"
"Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-cloudant/4.1.0/changelog.html"
"Bug Tracker" = "https://github.com/apache/airflow/issues"
"Source Code" = "https://github.com/apache/airflow"
"Slack Chat" = "https://s.apache.org/airflow-slack"
"Twitter" = "https://x.com/ApacheAirflow"
"YouTube" = "https://www.youtube.com/channel/UCSXwxpWZQ7XZ1WL3wqevChA/"

[project.entry-points."apache_airflow_provider"]
provider_info = "airflow.providers.cloudant.get_provider_info:get_provider_info"

[tool.flit.module]
name = "airflow.providers.cloudant"

[tool.pytest.ini_options]
ignore = "tests/system/"
Loading

0 comments on commit 9161259

Please sign in to comment.