Skip to content

Commit

Permalink
Updated root package name to be in line with standard naming conventi…
Browse files Browse the repository at this point in the history
…ons.
  • Loading branch information
ricekab committed Mar 27, 2018
1 parent a85f020 commit 299c8a1
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 23 deletions.
8 changes: 4 additions & 4 deletions docs/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ API Reference
Basic seeder
------------

.. autoclass:: seeder.basic_seeder.BasicSeeder
.. autoclass:: sqlalchemyseeder.basic_seeder.BasicSeeder
:members:

Resolving seeder
----------------

.. autoclass:: seeder.resolving_seeder.ResolvingSeeder
.. autoclass:: sqlalchemyseeder.resolving_seeder.ResolvingSeeder
:members:

.. autoclass:: seeder.resolving_seeder.ClassRegistry
.. autoclass:: sqlalchemyseeder.resolving_seeder.ClassRegistry
:members:

Exceptions
----------
.. automodule:: seeder.exceptions
.. automodule:: sqlalchemyseeder.exceptions
:members:
6 changes: 3 additions & 3 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ Seeders
Basic seeder
------------
If you only need to create an object using a simple field->value mapping you can do so with the
:class:`~seeder.basic_seeder.BasicSeeder` methods.
:class:`~sqlalchemyseeder.basic_seeder.BasicSeeder` methods.

Resolving seeder
----------------
Once you want to be able to reference other entities you'll need to use a :class:`~seeder.resolving_seeder.ResolvingSeeder`.
Once you want to be able to reference other entities you'll need to use a :class:`~sqlalchemyseeder.resolving_seeder.ResolvingSeeder`.
This allows for entity attributes to point to other entities (in case of relationships) or reference another entity's field
(for foreign keys or attributes).

Expand Down Expand Up @@ -434,7 +434,7 @@ Three countries each with a single airport.
Using the resolving seeder
**************************
A :class:`~seeder.ResolvingSeeder` needs access to a session (provided on initialization) which it uses to resolve references.
A :class:`~sqlalchemyseeder.ResolvingSeeder` needs access to a session (provided on initialization) which it uses to resolve references.

A basic usage example:

Expand Down
2 changes: 0 additions & 2 deletions seeder/__init__.py

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
name='sqlalchemy-seeder',
version='0.2.0',
packages=find_packages(exclude=["tests"]),
package_data={"seeder": ["resources/*"]},
package_data={"sqlalchemyseeder": ["resources/*"]},
url='https://github.com/RiceKab/sqlalchemy-seeder',
license='MIT',
author='Kevin CY Tang',
Expand Down
2 changes: 2 additions & 0 deletions sqlalchemyseeder/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from sqlalchemyseeder.basic_seeder import BasicSeeder
from sqlalchemyseeder.resolving_seeder import ResolvingSeeder
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import jsonschema
import pkg_resources
import yaml
from seeder.exceptions import AmbiguousReferenceError, UnresolvedReferencesError, EntityBuildError
from sqlalchemyseeder.exceptions import AmbiguousReferenceError, UnresolvedReferencesError, EntityBuildError
from sqlalchemy import inspect as sainsp
from sqlalchemy.exc import NoInspectionAvailable
from sqlalchemy.orm.exc import MultipleResultsFound
Expand All @@ -22,7 +22,7 @@ def _is_mappable_class(cls):


class ClassRegistry(object):
""" A cache of mappable classes used by :class:`~seeder.resolving_seeder.ResolvingSeeder`. """
""" A cache of mappable classes used by :class:`~sqlalchemyseeder.resolving_seeder.ResolvingSeeder`. """

def __init__(self):
self.class_path_cache = {}
Expand Down Expand Up @@ -122,21 +122,21 @@ class ResolvingSeeder(object):
This requires the data to be formatted in a custom :ref:`data-format` to define the references.
As entities have to define their target class they must be registered so the seeder can retrieve them during the
seeding process. This is typically done using :meth:`~seeder.resolving_seeder.ClassRegistry.register`,
:meth:`~seeder.resolving_seeder.ClassRegistry.register_class` or
:meth:`~seeder.resolving_seeder.ClassRegistry.register_module` which are
hoisted methods from :class:`~seeder.resolving_seeder.ClassRegistry`. If a classpath is encountered but not
As entities have to define their target class they must be registered so the sqlalchemyseeder can retrieve them during the
seeding process. This is typically done using :meth:`~sqlalchemyseeder.resolving_seeder.ClassRegistry.register`,
:meth:`~sqlalchemyseeder.resolving_seeder.ClassRegistry.register_class` or
:meth:`~sqlalchemyseeder.resolving_seeder.ClassRegistry.register_module` which are
hoisted methods from :class:`~sqlalchemyseeder.resolving_seeder.ClassRegistry`. If a classpath is encountered but not
recognized it will be resolved before continuing.
The session passed to this seeder is used to resolve references. Flushes may occur depending on the session
The session passed to this sqlalchemyseeder is used to resolve references. Flushes may occur depending on the session
configuration and the passed parameters. The default behaviour when loading entities is to perform flushes but not
to commit.
"""

def __init__(self, session):
self.session = session
schema_string = pkg_resources.resource_string('seeder', VALIDATION_SCHEMA_RSC)
schema_string = pkg_resources.resource_string('sqlalchemyseeder', VALIDATION_SCHEMA_RSC)
self.validation_schema = json.loads(schema_string)
self.registry = ClassRegistry()

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/test_basic.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from seeder.basic_seeder import BasicSeeder
from sqlalchemyseeder.basic_seeder import BasicSeeder


def test_basic_from_dict(model):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_registry.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from seeder.resolving_seeder import ClassRegistry
from sqlalchemyseeder.resolving_seeder import ClassRegistry


@pytest.fixture()
Expand Down
4 changes: 2 additions & 2 deletions tests/test_resolver.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
from jsonschema import ValidationError
from seeder.exceptions import UnresolvedReferencesError, AmbiguousReferenceError
from seeder.resolving_seeder import ResolvingSeeder
from sqlalchemyseeder.exceptions import UnresolvedReferencesError, AmbiguousReferenceError
from sqlalchemyseeder.resolving_seeder import ResolvingSeeder


@pytest.fixture()
Expand Down

0 comments on commit 299c8a1

Please sign in to comment.