Skip to content

Commit

Permalink
Merge pull request #7 from JayZ12138/master
Browse files Browse the repository at this point in the history
Rename package name to ubiconfig
  • Loading branch information
JayZ12138 committed Mar 13, 2019
2 parents 599da0b + 246d062 commit 9942ee2
Show file tree
Hide file tree
Showing 20 changed files with 32 additions and 32 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
python-ubi-config
==================
ubiconfig
=========

A Python library for reading UBI configurations
A Python library for accessing Universal Base Image configurations

[![Build Status](https://travis-ci.org/release-engineering/ubi-config.svg?branch=master)](https://travis-ci.org/release-engineering/ubi-config)
[![Coverage Status](https://coveralls.io/repos/github/release-engineering/ubi-config/badge.svg?branch=master)](https://coveralls.io/github/release-engineering/ubi-config?branch=master)
Expand All @@ -26,7 +26,7 @@ When there is `DEFAULT_UBI_REPO` set, user can load the config by passing the co
name to `get_loader().load()`

```python
from ubi_config import get_loader
from ubiconfig import get_loader

config = get_loader().load('rhel-8-for-x86_64-appstream')
# config has been validated and is now a Python object with relevant properties
Expand All @@ -36,14 +36,14 @@ print package_whitelist
Or, get all config files from the repo:
```python

from ubi_config import get_loader
from ubiconfig import get_loader

configs = get_loader().load_all()
# returns a list of UbiConfig objects
```
Or, user can also load the config from local file:
```python
from ubi_config import get_loader
from ubiconfig import get_loader

config = get_loader(local=True).load('/path/to/rhel-8-for-x86_64-appstream.yaml')
```
Expand Down
10 changes: 5 additions & 5 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ No matter which branch is the config file in, it will load it for you.

.. code-block:: python
from ubi_config import get_loader
from ubiconfig import get_loader
default_loader = get_loader()
config = default_loader.load("ubi7_config_file")
Expand All @@ -58,7 +58,7 @@ Except the above usage, there are some other use cases:

.. code-block:: python
from ubi_config import get_loader
from ubiconfig import get_loader
loader = get_loader()
configs = loader.load_all()
# returns a list of UbiConfig objects
Expand All @@ -67,7 +67,7 @@ Except the above usage, there are some other use cases:

.. code-block:: python
from ubi_config import get_loader
from ubiconfig import get_loader
local_loader = get_loader(local=True)
config = local_loader.load("full/path/to/local_ubi7_config")
Expand All @@ -77,7 +77,7 @@ path by passing ``local_repo`` to ``get_loader``

.. code-block:: python
from ubi_config import get_loader
from ubiconfig import get_loader
local_loader = get_loader(use=True, local_repo='repo/path')
config = local_loader.load('local_ubi7_config')
Expand All @@ -91,7 +91,7 @@ You can always reuse the loader

API Reference
-------------
.. currentmodule:: ubi_config
.. currentmodule:: ubiconfig
.. function:: get_loader

Get a Loader instance which is used to load configurations.
Expand Down
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


def get_description():
return 'a simple tool used to load UBI config'
return 'A Python Library for accessing Universal Base Image configurations'


def get_long_description():
Expand All @@ -24,11 +24,11 @@ def get_requirements():
version='0.1.0',
author='',
author_email='',
packages=['ubi_config',
'ubi_config.utils',
'ubi_config.utils.api',
'ubi_config.config_types'],
package_data={'ubi_config': ['utils/config_schema.json']},
packages=['ubiconfig',
'ubiconfig.utils',
'ubiconfig.utils.api',
'ubiconfig.config_types'],
package_data={'ubiconfig': ['utils/config_schema.json']},
url='https://github.com/release-engineering/ubi-config',
license='GNU General Public License',
description=get_description(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ubi_config.config_types import packages, modules, content_sets
from ubiconfig.config_types import packages, modules, content_sets


def test_package_with_arch():
Expand Down
10 changes: 5 additions & 5 deletions tests/ubi_config/test_ubi.py → tests/ubiconfig/test_ubi.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from mock import patch
import yaml

from ubi_config import ubi
from ubi_config.utils.api.gitlab import RepoApi
from ubiconfig import ubi
from ubiconfig.utils.api.gitlab import RepoApi


TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), '../data')
Expand Down Expand Up @@ -47,7 +47,7 @@ def make_response(content):


@patch('requests.Session')
@patch('ubi_config.ubi.Loader._pre_load')
@patch('ubiconfig.ubi.Loader._pre_load')
def test_load_all_from_default_repo(mocked_pre_load, mocked_session, files_branch_map,
dnf7_config_file, ubi7_config_file, response):
mocked_pre_load.return_value = files_branch_map
Expand Down Expand Up @@ -134,14 +134,14 @@ def test_get_branches(mocked_session):
{'name': 'ubi7', 'default': False, 'can_push': True}]
mocked_session.get.return_value.json.return_value = branches
repo_apis = RepoApi(ubi.DEFAULT_UBI_REPO)
with patch('ubi_config.ubi.Loader._pre_load'):
with patch('ubiconfig.ubi.Loader._pre_load'):
loader = ubi.Loader(session=mocked_session, repo_api=repo_apis)
actual_branches = loader._get_branches()
assert actual_branches == ['dnf7', 'ubi7']


@patch('requests.Session')
@patch('ubi_config.ubi.Loader._get_branches')
@patch('ubiconfig.ubi.Loader._get_branches')
def test_pre_load(mocked_get_branches, mocked_session, files_branch_map):
branches = ['dnf7', 'ubi7']
mocked_get_branches.return_value = branches
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
from six.moves.urllib.parse import urljoin

from ubi_config.utils.api import gitlab
from ubiconfig.utils.api import gitlab


@pytest.fixture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import yaml

from ubi_config.utils import config_validation
from ubiconfig.utils import config_validation

TEST_DATA = os.path.join(os.path.dirname(__file__),
'../../data/configs/dnf7/rhel-atomic-host.yaml')
Expand Down
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ deps=
commands=
flake8 \
--max-complexity 10
sh -c 'pylint ubi_config; test $(( $? & (1|2|4|32) )) = 0'
sh -c 'pylint ubiconfig; test $(( $? & (1|2|4|32) )) = 0'

[testenv:cov]
deps=
-rtest-requirements.txt
pytest-cov
usedevelop=true
commands=
pytest --cov-report=html --cov=ubi_config {posargs}
pytest --cov-report=html --cov=ubiconfig {posargs}

[testenv:cov-travis]
passenv = TRAVIS TRAVIS_*
Expand All @@ -34,7 +34,7 @@ deps=
coveralls
usedevelop=true
commands=
pytest --cov=ubi_config {posargs}
pytest --cov=ubiconfig {posargs}
coveralls

[testenv:docs]
Expand Down
3 changes: 0 additions & 3 deletions ubi_config/__init__.py

This file was deleted.

3 changes: 3 additions & 0 deletions ubiconfig/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from ubiconfig.ubi import get_loader, Loader, UbiConfig

__all__ = ['get_loader', 'Loader', 'UbiConfig']
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion ubi_config/ubi.py → ubiconfig/ubi.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
DEFAULT_UBI_REPO = os.getenv("DEFAULT_UBI_REPO", "")

logging.basicConfig()
LOG = logging.getLogger('ubi_config')
LOG = logging.getLogger('ubiconfig')


def get_loader(local=False, local_repo=None):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 9942ee2

Please sign in to comment.