Skip to content

Commit

Permalink
WIP: Split out glue library as pulp-glue package
Browse files Browse the repository at this point in the history
fixes pulp#628
  • Loading branch information
mdellweg committed Feb 14, 2023
1 parent 53be831 commit a8b1853
Show file tree
Hide file tree
Showing 94 changed files with 299 additions and 247 deletions.
4 changes: 4 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ values =
dev
prod

[bumpversion:file:./pulp-glue/pulp_glue/common/__init__.py]

[bumpversion:file:./pulpcore/cli/common/__init__.py]

[bumpversion:file:./pulp-glue/setup.py]

[bumpversion:file:./setup.py]
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ jobs:
TWINE_USERNAME: pulp
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
cd pulp-glue
python setup.py sdist bdist_wheel
twine upload dist/*
cd ..
python setup.py sdist bdist_wheel
twine upload dist/*
Expand Down
1 change: 1 addition & 0 deletions CHANGES/628.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added new client library `pulp-glue` as a spin off of the `pulp-cli`.
2 changes: 2 additions & 0 deletions pulp-glue/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Pulp Glue
## The version agnostic Pulp 3 client library in python
Empty file.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import IO, Any, ClassVar

from pulpcore.cli.common.context import (
from pulp_glue.common.context import (
EntityDefinition,
PluginRequirement,
PulpContentContext,
Expand All @@ -10,7 +10,7 @@
PulpRepositoryVersionContext,
registered_repository_contexts,
)
from pulpcore.cli.common.i18n import get_translation
from pulp_glue.common.i18n import get_translation

translation = get_translation(__name__)
_ = translation.gettext
Expand Down
Empty file.
1 change: 1 addition & 0 deletions pulp-glue/pulp_glue/common/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.17.0.dev"
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
from typing import Any, ClassVar, Dict, List, Mapping, NamedTuple, Optional, Set, Type, Union

from packaging.version import parse as parse_version
from pulp_glue.common.i18n import get_translation
from pulp_glue.common.openapi import OpenAPI, OpenAPIError, UploadsMap
from requests import HTTPError

from pulpcore.cli.common.i18n import get_translation
from pulpcore.cli.common.openapi import OpenAPI, OpenAPIError, UploadsMap

translation = get_translation(__name__)
_ = translation.gettext

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

import requests
import urllib3

from pulpcore.cli.common.i18n import get_translation
from pulp_glue.common import __version__
from pulp_glue.common.i18n import get_translation

translation = get_translation(__name__)
_ = translation.gettext
Expand Down Expand Up @@ -74,7 +74,7 @@ def __init__(
raise OpenAPIError(_("Cert is required if key is set."))
self._session.headers.update(
{
"User-Agent": user_agent or "Pulp-CLI openapi parser",
"User-Agent": user_agent or f"Pulp-glue openapi parser ({__version__})",
"Accept": "application/json",
}
)
Expand Down
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Any, List, Optional

from pulpcore.cli.common.context import (
from pulp_glue.common.context import (
EntityDefinition,
PluginRequirement,
PulpContentContext,
Expand All @@ -11,7 +11,7 @@
PulpRepositoryVersionContext,
registered_repository_contexts,
)
from pulpcore.cli.common.i18n import get_translation
from pulp_glue.common.i18n import get_translation

translation = get_translation(__name__)
_ = translation.gettext
Expand Down
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
import sys
from typing import IO, Any, ClassVar, Dict, List, Optional

from pulpcore.cli.common.context import (
from pulp_glue.common.context import (
EntityDefinition,
PluginRequirement,
PulpContext,
PulpEntityContext,
PulpException,
)
from pulpcore.cli.common.i18n import get_translation
from pulpcore.cli.common.openapi import UploadsMap
from pulp_glue.common.i18n import get_translation
from pulp_glue.common.openapi import UploadsMap

translation = get_translation(__name__)
_ = translation.gettext
Expand Down
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pulpcore.cli.common.context import (
from pulp_glue.common.context import (
EntityDefinition,
PluginRequirement,
PulpACSContext,
Expand All @@ -10,7 +10,7 @@
PulpRepositoryVersionContext,
registered_repository_contexts,
)
from pulpcore.cli.common.i18n import get_translation
from pulp_glue.common.i18n import get_translation

translation = get_translation(__name__)
_ = translation.gettext
Expand Down
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pulpcore.cli.common.context import (
from pulp_glue.common.context import (
EntityDefinition,
PluginRequirement,
PulpContentContext,
Expand All @@ -9,7 +9,7 @@
PulpRepositoryVersionContext,
registered_repository_contexts,
)
from pulpcore.cli.common.i18n import get_translation
from pulp_glue.common.i18n import get_translation

translation = get_translation(__name__)
_ = translation.gettext
Expand Down
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from typing import IO, Any, ClassVar, Optional

import click

from pulpcore.cli.common.context import (
from pulp_glue.common.context import (
EntityDefinition,
PluginRequirement,
PulpACSContext,
Expand All @@ -15,7 +14,7 @@
PulpRepositoryVersionContext,
registered_repository_contexts,
)
from pulpcore.cli.common.i18n import get_translation
from pulp_glue.common.i18n import get_translation

translation = get_translation(__name__)
_ = translation.gettext
Expand Down
Empty file.
49 changes: 49 additions & 0 deletions pulp-glue/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
from setuptools import setup

try:
from setuptools import find_namespace_packages

plugin_packages = find_namespace_packages(include=["pulp_glue.*"], exclude=["pulp_glue.*.*"])

except ImportError:
# Old versions of setuptools do not provide `find_namespace_packages`
# see https://github.com/pulp/pulp-cli/issues/248
from setuptools import find_packages

plugins = find_packages(where="pulp_glue")
plugin_packages = [f"pulp_glue.{plugin}" for plugin in plugins]

long_description = ""
with open("README.md") as readme:
for line in readme:
long_description += line

setup(
name="pulp-glue",
description="Version agnostic glue library to talk to pulpcore's REST API.",
long_description=long_description,
long_description_content_type="text/markdown",
author="Pulp Team",
author_email="pulp-list@redhat.com",
url="https://github.com/pulp/pulp-cli",
version="0.17.0.dev",
packages=plugin_packages,
package_data={"": ["py.typed", "locale/*/LC_MESSAGES/*.mo"]},
python_requires=">=3.6",
install_requires=[
"packaging",
"setuptools",
"requests~=2.24",
],
license="GPLv2+",
classifiers=[
"Development Status :: 4 - Beta",
"Environment :: Other Environment",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Topic :: System :: Software Distribution",
"Typing :: Typed",
],
)
4 changes: 2 additions & 2 deletions pulpcore/cli/ansible/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from typing import Any

import click
from pulp_glue.common.context import PluginRequirement
from pulp_glue.common.i18n import get_translation

from pulpcore.cli.ansible.content import content
from pulpcore.cli.ansible.distribution import distribution
from pulpcore.cli.ansible.remote import remote
from pulpcore.cli.ansible.repository import repository
from pulpcore.cli.common.context import PluginRequirement
from pulpcore.cli.common.generic import PulpCLIContext, pass_pulp_context, pulp_group
from pulpcore.cli.common.i18n import get_translation

translation = get_translation(__name__)
_ = translation.gettext
Expand Down
10 changes: 5 additions & 5 deletions pulpcore/cli/ansible/content.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
from typing import IO, Any, Callable, Optional, Union

import click

from pulpcore.cli.ansible.context import (
from pulp_glue.ansible.context import (
PulpAnsibleCollectionVersionContext,
PulpAnsibleCollectionVersionSignatureContext,
PulpAnsibleRepositoryContext,
PulpAnsibleRoleContext,
)
from pulpcore.cli.common.context import PulpEntityContext, PulpRepositoryContext
from pulp_glue.common.context import PulpEntityContext, PulpRepositoryContext
from pulp_glue.common.i18n import get_translation
from pulp_glue.core.context import PulpArtifactContext

from pulpcore.cli.common.generic import (
GroupOption,
PulpCLIContext,
Expand All @@ -22,8 +24,6 @@
resource_option,
show_command,
)
from pulpcore.cli.common.i18n import get_translation
from pulpcore.cli.core.context import PulpArtifactContext

translation = get_translation(__name__)
_ = translation.gettext
Expand Down
11 changes: 4 additions & 7 deletions pulpcore/cli/ansible/distribution.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
from typing import Dict, Optional

import click

from pulpcore.cli.ansible.context import (
PulpAnsibleDistributionContext,
PulpAnsibleRepositoryContext,
)
from pulpcore.cli.common.context import (
from pulp_glue.ansible.context import PulpAnsibleDistributionContext, PulpAnsibleRepositoryContext
from pulp_glue.common.context import (
EntityDefinition,
EntityFieldDefinition,
PluginRequirement,
PulpContext,
)
from pulp_glue.common.i18n import get_translation

from pulpcore.cli.common.generic import (
create_command,
destroy_command,
Expand All @@ -28,7 +26,6 @@
resource_option,
show_command,
)
from pulpcore.cli.common.i18n import get_translation

translation = get_translation(__name__)
_ = translation.gettext
Expand Down
6 changes: 3 additions & 3 deletions pulpcore/cli/ansible/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

import click
import yaml

from pulpcore.cli.ansible.context import (
from pulp_glue.ansible.context import (
PulpAnsibleCollectionRemoteContext,
PulpAnsibleRoleRemoteContext,
)
from pulp_glue.common.i18n import get_translation

from pulpcore.cli.common.generic import (
PulpCLIContext,
common_remote_create_options,
Expand All @@ -26,7 +27,6 @@
show_command,
update_command,
)
from pulpcore.cli.common.i18n import get_translation

translation = get_translation(__name__)
_ = translation.gettext
Expand Down
10 changes: 5 additions & 5 deletions pulpcore/cli/ansible/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@

import click
import schema as s

from pulpcore.cli.ansible.context import (
from pulp_glue.ansible.context import (
PulpAnsibleCollectionRemoteContext,
PulpAnsibleCollectionVersionContext,
PulpAnsibleRepositoryContext,
PulpAnsibleRoleContext,
PulpAnsibleRoleRemoteContext,
)
from pulpcore.cli.common.context import (
from pulp_glue.common.context import (
EntityFieldDefinition,
PluginRequirement,
PulpRemoteContext,
PulpRepositoryContext,
)
from pulp_glue.common.i18n import get_translation
from pulp_glue.core.context import PulpSigningServiceContext

from pulpcore.cli.common.generic import (
GroupOption,
PulpCLIContext,
Expand Down Expand Up @@ -43,8 +45,6 @@
update_command,
version_command,
)
from pulpcore.cli.common.i18n import get_translation
from pulpcore.cli.core.context import PulpSigningServiceContext
from pulpcore.cli.core.generic import task_command

translation = get_translation(__name__)
Expand Down
5 changes: 3 additions & 2 deletions pulpcore/cli/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
except ImportError:
HAS_CLICK_SHELL = False

from pulp_glue.common.context import PluginRequirement
from pulp_glue.common.i18n import get_translation

from pulpcore.cli.common.config import CONFIG_LOCATIONS, config, config_options, validate_config
from pulpcore.cli.common.context import PluginRequirement
from pulpcore.cli.common.debug import debug
from pulpcore.cli.common.generic import PulpCLIContext, pulp_group
from pulpcore.cli.common.i18n import get_translation

__version__ = "0.17.0.dev"

Expand Down
2 changes: 1 addition & 1 deletion pulpcore/cli/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

import click
import toml
from pulp_glue.common.i18n import get_translation

from pulpcore.cli.common.generic import pulp_group
from pulpcore.cli.common.i18n import get_translation

translation = get_translation(__name__)
_ = translation.gettext
Expand Down
Loading

0 comments on commit a8b1853

Please sign in to comment.