Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ source = pyblish
[report]
include = *pyblish*
omit =
*/vendor*
*/_vendor*
*/tests*
*/run_*
2 changes: 1 addition & 1 deletion .noserc
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ with-doctest=1
with-coverage=1
cover-html=1
cover-erase=1
exclude=vendor
exclude=_vendor
cover-tests=1
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ pyblish Changelog

This contains all major version changes between pyblish releases.

Version 1.4.3
-------------
- Privatised modules (#295)

Version 1.4.2
-------------

Expand Down
2 changes: 1 addition & 1 deletion pyblish/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

"""

from .version import version, version_info, __version__
from ._version import version, version_info, __version__


_registered_paths = list()
Expand Down
2 changes: 1 addition & 1 deletion pyblish/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

"""

from . import cli
from . import _cli as cli

if __name__ == '__main__':
cli.main(obj={}, prog_name="pyblish")
10 changes: 8 additions & 2 deletions pyblish/cli.py → pyblish/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,14 @@
import json
import logging

from . import api, lib, util, __version__
from .vendor import click
from . import (
api,
util,
_lib as lib,
__version__
)

from ._vendor import click

_ctx = None
_help = {
Expand Down
6 changes: 5 additions & 1 deletion pyblish/compat.py → pyblish/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
import re
import inspect
import warnings
from . import plugin, lib, logic
from . import (
_plugin as plugin,
_lib as lib,
_logic as logic
)

# Aliases
Selector = plugin.Collector
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion pyblish/lib.py → pyblish/_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import functools

from . import _registered_callbacks
from .vendor import six
from ._vendor import six


def inrange(number, base, offset=0.5):
Expand Down
4 changes: 2 additions & 2 deletions pyblish/logic.py → pyblish/_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import logging
import traceback

from . import _registered_test, _registered_gui, lib
from .plugin import Validator
from . import _registered_test, _registered_gui, _lib as lib
from ._plugin import Validator


log = logging.getLogger("pyblish.logic")
Expand Down
4 changes: 2 additions & 2 deletions pyblish/plugin.py → pyblish/_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
_registered_targets,
)

from . import lib
from .vendor import iscompatible, six
from . import _lib as lib
from ._vendor import iscompatible, six

log = logging.getLogger("pyblish.plugin")

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 @@ -4,7 +4,7 @@
import tempfile
import contextlib

from pyblish.vendor import click
from pyblish._vendor import click

from ._compat import iteritems, PY2

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 10 additions & 7 deletions pyblish/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

from __future__ import absolute_import

from . import version
from . import _version as version
import getpass

from .plugin import (
from ._plugin import (
Context,
Instance,

Expand Down Expand Up @@ -81,14 +81,16 @@
current_host,
)

from .lib import (
from ._lib import (
log,
time as __time,
emit,
inrange,

time as __time,
main_package_path as __main_package_path
)

from .logic import (
from ._logic import (
plugins_by_family,
plugins_by_host,
plugins_by_instance,
Expand All @@ -104,7 +106,7 @@
default_test as __default_test,
)

from .error import (
from ._error import (
PyblishError,
SelectionError,
ValidationError,
Expand All @@ -113,7 +115,7 @@
NoInstancesError
)

from .compat import (
from ._compat import (
deregister_all,
sort,
Selector,
Expand Down Expand Up @@ -235,6 +237,7 @@ def __init__():
# Utilities
"log",
"emit",
"inrange",

# Exceptions
"PyblishError",
Expand Down
18 changes: 9 additions & 9 deletions pyblish/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import warnings

# Local library
from . import api, logic, plugin, lib
from . import api, _logic, _plugin

log = logging.getLogger("pyblish.util")

Expand All @@ -26,7 +26,7 @@ def publish(context=None, plugins=None):
defaults to results of discover()

Usage:
>> context = plugin.Context()
>> context = _plugin.Context()
>> publish(context) # Pass..
>> context = publish() # ..or receive a new

Expand All @@ -38,14 +38,14 @@ def publish(context=None, plugins=None):

# Do not consider inactive plug-ins
plugins = list(p for p in plugins if p.active)
collectors = list(p for p in plugins if lib.inrange(
collectors = list(p for p in plugins if api.inrange(
number=p.order,
base=api.CollectorOrder)
)

# First pass, collection
for Plugin, instance in logic.Iterator(collectors, context):
plugin.process(Plugin, context, instance)
for Plugin, instance in _logic.Iterator(collectors, context):
_plugin.process(Plugin, context, instance)

# Exclude collectors from further processing
plugins = list(p for p in plugins if p not in collectors)
Expand All @@ -54,7 +54,7 @@ def publish(context=None, plugins=None):
# least one compatible instance.
for Plugin in list(plugins):
if Plugin.__instanceEnabled__:
if not logic.instances_by_plugin(context, Plugin):
if not _logic.instances_by_plugin(context, Plugin):
plugins.remove(Plugin)

# Mutable state, used in Iterator
Expand All @@ -64,9 +64,9 @@ def publish(context=None, plugins=None):
}

# Second pass, the remainder
for Plugin, instance in logic.Iterator(plugins, context, state):
for Plugin, instance in _logic.Iterator(plugins, context, state):
try:
result = plugin.process(Plugin, context, instance)
result = _plugin.process(Plugin, context, instance)

except StopIteration: # End of items
raise
Expand Down Expand Up @@ -157,7 +157,7 @@ def integrate(context=None, plugins=None):
def _convenience(order, context=None, plugins=None):
plugins = list(
p for p in (api.discover() if plugins is None else plugins)
if lib.inrange(p.order, order)
if api.inrange(p.order, order)
)

return publish(context, plugins)
Expand Down
2 changes: 1 addition & 1 deletion run_testsuite.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
sys.path.insert(0, path)

import nose
from pyblish.vendor import mock
from pyblish._vendor import mock

warnings.warn = mock.MagicMock()

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
readme = f.read()


version_file = os.path.abspath("pyblish/version.py")
version_file = os.path.abspath("pyblish/_version.py")
version_mod = imp.load_source("version", version_file)
version = version_mod.version

Expand Down Expand Up @@ -49,6 +49,6 @@
"icons/*.svg"],
},
entry_points={
"console_scripts": ["pyblish = pyblish.cli:main"]
"console_scripts": ["pyblish = pyblish._cli:main"]
},
)
33 changes: 16 additions & 17 deletions tests/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,46 @@
import tempfile
import contextlib

import pyblish
import pyblish.cli
import pyblish.plugin
from pyblish.vendor import six
# import pyblish
from pyblish import api, _lib, _plugin
from pyblish._vendor import six

# Setup
HOST = 'python'
FAMILY = 'test.family'

REGISTERED = pyblish.plugin.registered_paths()
PACKAGEPATH = pyblish.lib.main_package_path()
REGISTERED = _plugin.registered_paths()
PACKAGEPATH = _lib.main_package_path()
ENVIRONMENT = os.environ.get("PYBLISHPLUGINPATH", "")
PLUGINPATH = os.path.join(PACKAGEPATH, '..', 'tests', 'plugins')


def setup():
"""Disable default plugins and only use test plugins"""
pyblish.plugin.deregister_all_paths()
_plugin.deregister_all_paths()


def setup_empty():
"""Disable all plug-ins"""
setup()
pyblish.plugin.deregister_all_plugins()
pyblish.plugin.deregister_all_paths()
pyblish.plugin.deregister_all_hosts()
pyblish.plugin.deregister_all_callbacks()
_plugin.deregister_all_plugins()
_plugin.deregister_all_paths()
_plugin.deregister_all_hosts()
_plugin.deregister_all_callbacks()


def teardown():
"""Restore previously REGISTERED paths"""

pyblish.plugin.deregister_all_paths()
_plugin.deregister_all_paths()
for path in REGISTERED:
pyblish.plugin.register_plugin_path(path)
_plugin.register_plugin_path(path)

os.environ["PYBLISHPLUGINPATH"] = ENVIRONMENT
pyblish.api.deregister_all_plugins()
pyblish.api.deregister_all_hosts()
pyblish.api.deregister_test()
pyblish.api.__init__()
api.deregister_all_plugins()
api.deregister_all_hosts()
api.deregister_test()
api.__init__()


@contextlib.contextmanager
Expand Down
Loading