Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Move all modules into root namespace. #862

Closed
wants to merge 1 commit into from
Closed
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
10 changes: 8 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ repos:
- id: pyupgrade
args:
- --py38-plus
exclude: '_vendor'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like this to use the same (?x)^( syntax as the other exclusions.

- repo: https://github.com/PyCQA/isort
rev: '5.10.1'
hooks:
Expand All @@ -40,6 +41,11 @@ repos:
rev: '4.0.1'
hooks:
- id: flake8
exclude: |
(?x)^(
^signac/_vendor/configobj/|
^signac/_vendor/deprecation/|
)
- repo: https://github.com/PyCQA/pydocstyle
rev: '6.1.1'
hooks:
Expand All @@ -48,8 +54,8 @@ repos:
(?x)^(
^doc/|
^tests/|
^signac/common/configobj/|
^signac/common/deprecation/|
^signac/_vendor/configobj/|
^signac/_vendor/deprecation/|
^signac/db/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this line be removed?

)
- repo: https://github.com/pre-commit/mirrors-mypy
Expand Down
10 changes: 5 additions & 5 deletions doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ The JobsCursor class
====================
.. _python-api-jobscursor:

.. currentmodule:: signac.contrib.project
.. currentmodule:: signac.project

.. rubric:: Attributes

Expand All @@ -72,7 +72,7 @@ The Job class

.. _python-api-job:

.. currentmodule:: signac.contrib.job
.. currentmodule:: signac.job

.. rubric:: Attributes

Expand Down Expand Up @@ -110,7 +110,7 @@ The Job class
The JSONDict
============

This class implements the interface for the job's :attr:`~signac.contrib.job.Job.statepoint` and :attr:`~signac.contrib.job.Job.document` attributes, but can also be used on its own.
This class implements the interface for the job's :attr:`~signac.job.Job.statepoint` and :attr:`~signac.job.Job.document` attributes, but can also be used on its own.

.. autoclass:: JSONDict
:members:
Expand All @@ -120,7 +120,7 @@ This class implements the interface for the job's :attr:`~signac.contrib.job.Job
The H5Store
===========

This class implements the interface to the job's :attr:`~signac.contrib.job.Job.data` attribute, but can also be used on its own.
This class implements the interface to the job's :attr:`~signac.job.Job.data` attribute, but can also be used on its own.

.. autoclass:: H5Store
:members:
Expand All @@ -130,7 +130,7 @@ This class implements the interface to the job's :attr:`~signac.contrib.job.Job.
The H5StoreManager
==================

This class implements the interface to the job's :attr:`~signac.contrib.job.Job.stores` attribute, but can also be used on its own.
This class implements the interface to the job's :attr:`~signac.job.Job.stores` attribute, but can also be used on its own.

.. autoclass:: H5StoreManager
:members:
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.black]
target-version = ['py38']
include = '\.pyi?$'
exclude = '''
force-exclude = '''
(
/(
\.eggs
Expand All @@ -11,11 +11,11 @@ exclude = '''
| \.venv
| build
| dist
| signac/common/configobj
| _vendor
)/
)
'''

[tool.isort]
profile = 'black'
skip_glob = 'signac/common/configobj/*'
skip_glob = 'signac/_vendor/*'
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ python-tag = py3

[flake8]
max-line-length = 100
exclude = configobj
exclude = _vendor
select = E,F,W
ignore = E123,E126,E203,E226,E241,E704,W503,W504

[pydocstyle]
match = ^((?!\.sync-zenodo-metadata|setup|benchmark).)*\.py$
match-dir = ^((?!\.|tests|configobj).)*$
match-dir = ^((?!\.|tests|_vendor).)*$
ignore-decorators = "deprecated"
add-ignore = D105, D107, D203, D204, D213

Expand All @@ -31,7 +31,7 @@ concurrency = thread,multiprocessing
parallel = True
source = signac
omit =
*/signac/common/configobj/*.py
*/signac/_vendor/configobj/*.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this broader?

Suggested change
*/signac/_vendor/configobj/*.py
*/signac/_vendor/*


[tool:pytest]
filterwarnings =
Expand Down
7 changes: 3 additions & 4 deletions signac/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
collectively accessible.
"""

from . import contrib, errors, sync, testing
from . import errors, sync, testing
from ._synced_collections.backends.collection_json import (
BufferedJSONAttrDict as JSONDict,
)
from .contrib import Project, TemporaryProject, get_job, get_project, init_project
from .core.h5store import H5Store, H5StoreManager
from .diff import diff_jobs
from .h5store import H5Store, H5StoreManager
from .project import Project, TemporaryProject, get_job, get_project, init_project
from .version import __version__

# Alias some properties related to buffering into the signac namespace.
Expand All @@ -27,7 +27,6 @@

__all__ = [
"__version__",
"contrib",
"errors",
"sync",
"Project",
Expand Down
18 changes: 8 additions & 10 deletions signac/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,8 @@
else:
READLINE = True

from . import get_project, init_project
from .common import config
from .common.configobj import Section, flatten_errors
from .contrib.filterparse import parse_filter_arg
from .contrib.import_export import _SchemaPathEvaluationError, export_jobs
from .contrib.utility import _add_verbosity_argument, _print_err, _query_yes_no
from .core.utility import _safe_relpath
from . import config, get_project, init_project
from ._vendor.configobj import Section, flatten_errors
from .diff import diff_jobs
from .errors import (
DestinationExistsError,
Expand All @@ -44,7 +39,10 @@
SchemaSyncConflict,
SyncConflict,
)
from .filterparse import parse_filter_arg
from .import_export import _SchemaPathEvaluationError, export_jobs
from .sync import DocSync, FileSync
from .utility import _add_verbosity_argument, _print_err, _query_yes_no, _safe_relpath
from .version import __version__

MSG_SYNC_SPECIFY_KEY = """
Expand Down Expand Up @@ -491,7 +489,7 @@ def _sig(st):


def _main_import_interactive(project, origin, args):
from .contrib.import_export import _prepare_import_into_project
from .import_export import _prepare_import_into_project

if args.move:
raise ValueError(
Expand Down Expand Up @@ -534,7 +532,7 @@ def _main_import_interactive(project, origin, args):


def _main_import_non_interactive(project, origin, args):
from .contrib.import_export import _prepare_import_into_project
from .import_export import _prepare_import_into_project

try:
paths = {}
Expand Down Expand Up @@ -637,7 +635,7 @@ def main_update_cache(args):
# UNCOMMENT THE FOLLOWING BLOCK WHEN THE FIRST MIGRATION IS INTRODUCED.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized this PR is targeting next. The next branch is no longer up to date, and this PR should be targeting master.

# def main_migrate(args):
# "Migrate the project's schema to the current schema version."
# from .contrib.migration import apply_migrations, _get_config_schema_version
# from .migration import apply_migrations, _get_config_schema_version
# from packaging import version
# from .version import SCHEMA_VERSION
# project = get_project(_ignore_schema_version=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from math import isclose
from numbers import Number

from ..errors import InvalidKeyError
from .errors import InvalidKeyError
from .utility import _nested_dicts_to_dotted_keys, _to_hashable

logger = logging.getLogger(__name__)
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 0 additions & 4 deletions signac/common/__init__.py

This file was deleted.

11 changes: 0 additions & 11 deletions signac/common/errors.py

This file was deleted.

2 changes: 1 addition & 1 deletion signac/common/config.py → signac/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import logging
import os

from .configobj import ConfigObj, ConfigObjError
from ._vendor.configobj import ConfigObj, ConfigObjError
from .errors import ConfigError
from .validate import cfg, get_validator

Expand Down
19 changes: 0 additions & 19 deletions signac/contrib/__init__.py

This file was deleted.

63 changes: 0 additions & 63 deletions signac/contrib/errors.py

This file was deleted.

4 changes: 0 additions & 4 deletions signac/core/__init__.py

This file was deleted.

18 changes: 0 additions & 18 deletions signac/core/errors.py

This file was deleted.

20 changes: 0 additions & 20 deletions signac/core/utility.py

This file was deleted.

File renamed without changes.
4 changes: 2 additions & 2 deletions signac/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This software is licensed under the BSD 3-Clause License.
"""Compute diffs of state points."""

from .contrib.utility import _dotted_dict_to_nested_dicts, _nested_dicts_to_dotted_keys
from .utility import _dotted_dict_to_nested_dicts, _nested_dicts_to_dotted_keys


def diff_jobs(*jobs):
Expand All @@ -18,7 +18,7 @@ def diff_jobs(*jobs):

Parameters
----------
\*jobs : sequence[:class:`~signac.contrib.job.Job`]
\*jobs : sequence[:class:`~signac.job.Job`]
Sequence of jobs to diff.

Returns
Expand Down
Loading