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 10, 2023
1 parent 5d4e351 commit f1db8ed
Show file tree
Hide file tree
Showing 78 changed files with 190 additions and 141 deletions.
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
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,7 @@

import requests
import urllib3

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

translation = get_translation(__name__)
_ = translation.gettext
Expand Down
52 changes: 52 additions & 0 deletions pulp-glue/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
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",
"PyYAML~=5.3", # TODO check!
"schema==0.7.5", # TODO check!
"setuptools", # TODO check!
"requests~=2.24",
"toml==0.10.2", # TODO check!
],
license="GPLv2+",
classifiers=[
"Development Status :: 4 - Beta",
"Environment :: Library",
"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
4 changes: 2 additions & 2 deletions pulpcore/cli/ansible/content.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
from typing import IO, Any, Callable, Optional, Union

import click
from pulp_glue.common.context import PulpEntityContext, PulpRepositoryContext
from pulp_glue.common.i18n import get_translation

from pulpcore.cli.ansible.context import (
PulpAnsibleCollectionVersionContext,
PulpAnsibleCollectionVersionSignatureContext,
PulpAnsibleRepositoryContext,
PulpAnsibleRoleContext,
)
from pulpcore.cli.common.context import PulpEntityContext, PulpRepositoryContext
from pulpcore.cli.common.generic import (
GroupOption,
PulpCLIContext,
Expand All @@ -22,7 +23,6 @@
resource_option,
show_command,
)
from pulpcore.cli.common.i18n import get_translation
from pulpcore.cli.core.context import PulpArtifactContext

translation = get_translation(__name__)
Expand Down
4 changes: 2 additions & 2 deletions pulpcore/cli/ansible/context.py
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
14 changes: 7 additions & 7 deletions pulpcore/cli/ansible/distribution.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
from typing import Dict, Optional

import click

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

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

translation = get_translation(__name__)
_ = translation.gettext
Expand Down
2 changes: 1 addition & 1 deletion pulpcore/cli/ansible/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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

from pulpcore.cli.ansible.context import (
PulpAnsibleCollectionRemoteContext,
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
14 changes: 7 additions & 7 deletions pulpcore/cli/ansible/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

import click
import schema as s
from pulp_glue.common.context import (
EntityFieldDefinition,
PluginRequirement,
PulpRemoteContext,
PulpRepositoryContext,
)
from pulp_glue.common.i18n import get_translation

from pulpcore.cli.ansible.context import (
PulpAnsibleCollectionRemoteContext,
Expand All @@ -10,12 +17,6 @@
PulpAnsibleRoleContext,
PulpAnsibleRoleRemoteContext,
)
from pulpcore.cli.common.context import (
EntityFieldDefinition,
PluginRequirement,
PulpRemoteContext,
PulpRepositoryContext,
)
from pulpcore.cli.common.generic import (
GroupOption,
PulpCLIContext,
Expand Down Expand Up @@ -43,7 +44,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

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
4 changes: 2 additions & 2 deletions pulpcore/cli/common/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
from typing import IO, Any, Dict, Iterable, Optional

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

from pulpcore.cli.common.context import PluginRequirement
from pulpcore.cli.common.generic import (
PulpCLIContext,
load_json_callback,
pass_pulp_context,
pulp_group,
)
from pulpcore.cli.common.i18n import get_translation

translation = get_translation(__name__)
_ = translation.gettext
Expand Down
5 changes: 2 additions & 3 deletions pulpcore/cli/common/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
import schema as s
import yaml
from click.decorators import FC, F

from pulpcore.cli.common.context import (
from pulp_glue.common.context import (
DATETIME_FORMATS,
DEFAULT_LIMIT,
EntityDefinition,
Expand All @@ -26,7 +25,7 @@
PulpRepositoryContext,
PulpRepositoryVersionContext,
)
from pulpcore.cli.common.i18n import get_translation
from pulp_glue.common.i18n import get_translation

try:
from pygments import highlight
Expand Down
4 changes: 2 additions & 2 deletions pulpcore/cli/container/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from typing import Any

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

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
from pulpcore.cli.container.content import content
from pulpcore.cli.container.distribution import distribution
from pulpcore.cli.container.namespace import namespace
Expand Down
2 changes: 1 addition & 1 deletion pulpcore/cli/container/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from typing import Any

import click
from pulp_glue.common.context import PulpEntityContext

from pulpcore.cli.common.context import PulpEntityContext
from pulpcore.cli.common.generic import (
GroupOption,
PulpCLIContext,
Expand Down
4 changes: 2 additions & 2 deletions pulpcore/cli/container/context.py
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
4 changes: 2 additions & 2 deletions pulpcore/cli/container/distribution.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from typing import Dict, Optional, Union, cast

import click
from pulp_glue.common.context import EntityDefinition, PulpEntityContext, PulpRepositoryContext
from pulp_glue.common.i18n import get_translation

from pulpcore.cli.common.context import EntityDefinition, PulpEntityContext, PulpRepositoryContext
from pulpcore.cli.common.generic import (
PulpCLIContext,
create_command,
Expand All @@ -21,7 +22,6 @@
role_command,
show_command,
)
from pulpcore.cli.common.i18n import get_translation
from pulpcore.cli.container.context import (
PulpContainerDistributionContext,
PulpContainerPushRepositoryContext,
Expand Down
2 changes: 1 addition & 1 deletion pulpcore/cli/container/namespace.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import click
from pulp_glue.common.i18n import get_translation

from pulpcore.cli.common.generic import (
PulpCLIContext,
Expand All @@ -13,7 +14,6 @@
role_command,
show_command,
)
from pulpcore.cli.common.i18n import get_translation
from pulpcore.cli.container.context import PulpContainerNamespaceContext

translation = get_translation(__name__)
Expand Down
2 changes: 1 addition & 1 deletion pulpcore/cli/container/remote.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import click
from pulp_glue.common.i18n import get_translation

from pulpcore.cli.common.generic import (
PulpCLIContext,
Expand All @@ -19,7 +20,6 @@
show_command,
update_command,
)
from pulpcore.cli.common.i18n import get_translation
from pulpcore.cli.container.context import PulpContainerRemoteContext

translation = get_translation(__name__)
Expand Down
8 changes: 2 additions & 6 deletions pulpcore/cli/container/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@
from typing import Any, Dict, List, Optional

import click
from pulp_glue.common.context import EntityFieldDefinition, PulpRemoteContext, PulpRepositoryContext
from pulp_glue.common.i18n import get_translation

from pulpcore.cli.common.context import (
EntityFieldDefinition,
PulpRemoteContext,
PulpRepositoryContext,
)
from pulpcore.cli.common.generic import (
create_command,
destroy_command,
Expand All @@ -30,7 +27,6 @@
update_command,
version_command,
)
from pulpcore.cli.common.i18n import get_translation
from pulpcore.cli.container.content import show_options
from pulpcore.cli.container.context import (
PulpContainerBaseRepositoryContext,
Expand Down
Loading

0 comments on commit f1db8ed

Please sign in to comment.