Skip to content

Commit

Permalink
doc&fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
antonymayi committed Dec 4, 2020
1 parent 8ef58b9 commit 7a63ef9
Show file tree
Hide file tree
Showing 17 changed files with 51 additions and 143 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-byte-order-marker
- id: fix-byte-order-marker
- id: check-case-conflict
- id: check-merge-conflict
- id: check-yaml
Expand Down
13 changes: 12 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,19 @@
html_static_path = ['static']

html_show_sourcelink = False

html_show_copyright = False
html_logo = 'images/logo.svg'
html_theme_options = {
'logo_only': False,
'display_version': False,
}
html_context = {
'display_github': True,
'github_user': 'formlio',
'github_repo': 'forml',
'github_version': 'master',
'conf_py_path': '/docs/',
}

# == Extensions configuration ==================================================

Expand Down
2 changes: 1 addition & 1 deletion docs/dsl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ a *date* field ``dob`` (aliased as ``birthday``) plus its extended version ``Stu
* schemas can be extended
* extended fields can override same name fields from parents
* field ordering is based on the in-class definition order, fields from parent classes come before fields of child
classes, overriding a field doesn't change its position
classes, overriding a field doesn't change its position

Schemas are expected to be published in form of :ref:`catalogs <io-catalogized-schemas>` which can be imported by both
:doc:`projects <../project>` and :doc:`platforms <../platform>` making them the mapping intermediaries.
Expand Down
2 changes: 2 additions & 0 deletions docs/images/logo.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions docs/lifecycle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ Test

$ python3 setup.py test

.. note::
The test mode is going to be deprecated in the upstream ``setuptools`` package so this will need to change.

Evaluate
Perform an evaluation based on the specs defined in ``evaluation.py`` and return the metrics. This can be defined
either as cross-validation or hold-out training. One of the potential use-cases might be a CI integration
Expand Down
8 changes: 2 additions & 6 deletions docs/project.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,6 @@ the custom locations of its project components using the ``component`` parameter
setuptools.setup(...,
component={'pipeline': 'path.to.my.custom.pipeline.module'})


.. note:: Since :pep:`517`, setuptools is no longer the Python default build tool, ForML is in the future also likely
to take a more generic approach to the build frontend/backend and the ``setup.py`` might no longer play the
described role.

.. _project-pipeline:

Pipeline (``pipeline.py``)
Expand Down Expand Up @@ -130,7 +125,8 @@ Evaluation (``evaluation.py``)

Definition of the model evaluation strategy for both the development and production lifecycle.

.. note:: The whole evaluation implementation is an interim and more robust concept with different API is ongoing.
.. note:: The whole evaluation implementation is an interim and more robust concept with different API is on the
.roadmap.

The evaluation strategy again needs to be submitted to the framework using the ``component.setup()`` handler::

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Create a python file under ``~/.forml/tutorial.py`` with the following content::

from forml.io import feed
from forml.lib.reader import sqlite
from forml.lib.schema.kaggle import titanic
from openschema.kaggle import titanic


class Feed(feed.Provider):
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial/titanic/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
version='0.1.dev0',
packages=setuptools.find_packages(include=['titanic*']),
setup_requires=['pytest-runner'],
install_requires=['scikit-learn', 'pandas', 'numpy', 'category_encoders==2.0.0'],
install_requires=['openschema', 'scikit-learn', 'pandas', 'numpy', 'category_encoders==2.0.0'],
)
2 changes: 1 addition & 1 deletion examples/tutorial/titanic/titanic/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"""

from forml.lib.flow.operator import cast
from forml.lib.schema.kaggle import titanic as schema
from openschema.kaggle import titanic as schema
from forml.project import component

FEATURES = schema.Passenger.select(
Expand Down
2 changes: 1 addition & 1 deletion forml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"""
ForML top level.
"""
__version__ = '0.2.dev0'
__version__ = '0.2.dev1'
__author__ = 'ForML Authors'

from forml.conf import logging
Expand Down
24 changes: 0 additions & 24 deletions forml/lib/schema/__init__.py

This file was deleted.

20 changes: 0 additions & 20 deletions forml/lib/schema/kaggle/__init__.py

This file was deleted.

58 changes: 0 additions & 58 deletions forml/lib/schema/kaggle/titanic.py

This file was deleted.

23 changes: 22 additions & 1 deletion forml/project/setuptools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"""
import inspect
import logging
import os
import typing

import setuptools
Expand All @@ -28,6 +29,7 @@
from setuptools import * # pylint: disable=redefined-builtin; # noqa: F401,F402,F403
from setuptools import dist

from forml.project import product
from forml.project.setuptools.command import launch, bdist, upload

LOGGER = logging.getLogger(__name__)
Expand All @@ -41,8 +43,27 @@ def __init__(self, attrs=None):
self.component: typing.Mapping[str, str] = dict()
super().__init__(attrs)

@property
def artifact(self) -> product.Artifact:
"""Get the artifact for this project.
COMMANDS: typing.Mapping[str, typing.Type[launch.Mode]] = {
Returns:
Artifact instance.
"""
modules = dict(self.component)
package = modules.pop('', None)
if not package:
for mod in modules.values():
if '.' in mod:
package, _ = os.path.splitext(mod)
break
else:
package = self.packages[0]
pkgdir = self.package_dir or {'': '.'}
return product.Artifact(pkgdir[''], package=package, **modules)


COMMANDS: typing.Mapping[str, typing.Type[setuptools.Command]] = {
'train': launch.Train,
'tune': launch.Tune,
'eval': launch.Eval,
Expand Down
4 changes: 3 additions & 1 deletion forml/project/setuptools/command/bdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ def manifest(self) -> distribution.Manifest:
"""Package manifest."""
name = self.distribution.get_name()
version = self.distribution.get_version()
return distribution.Manifest(name=name, version=version, package='titanic')
return distribution.Manifest(
name=name, version=version, package=self.distribution.artifact.package, **self.distribution.artifact.modules
)

def run(self) -> None:
"""Trigger the packaging process."""
Expand Down
25 changes: 3 additions & 22 deletions forml/project/setuptools/command/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@
"""
import abc
import logging
import os
import typing

from setuptools.command import test

from forml.conf.parsed import provider
from forml.project import product
from forml.runtime import launcher as launchmod

LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -54,29 +52,12 @@ def finalize_options(self) -> None:
"""Fini options."""
self.ensure_string_list('feed')

@property
def artifact(self) -> product.Artifact:
"""Get the artifact for this project.
Returns:
Artifact instance.
"""
modules = dict(self.distribution.component)
package = modules.pop('', None)
if not package:
for mod in modules.values():
if '.' in mod:
package, _ = os.path.splitext(mod)
break
else:
package = self.distribution.packages[0]
pkgdir = self.distribution.package_dir or {'': '.'}
return product.Artifact(pkgdir[''], package=package, **modules)

def run_tests(self) -> None:
"""This is the original test command entry point - let's override it with our actions."""
LOGGER.debug('%s: starting %s', self.distribution.get_name(), self.__class__.__name__.lower())
launcher = self.artifact.launcher(provider.Runner.resolve(self.runner), provider.Feed.resolve(self.feed))
launcher = self.distribution.artifact.launcher(
provider.Runner.resolve(self.runner), provider.Feed.resolve(self.feed)
)
result = self.launch(launcher, lower=self.lower, upper=self.upper)
if result is not None:
print(result)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
license='Apache License 2.0',
packages=setuptools.find_packages(include=['forml*']),
package_data={'forml.conf': ['config.toml', 'logging.ini']},
setup_requires=['docutils', 'setuptools', 'wheel', 'toml'],
setup_requires=['setuptools', 'wheel', 'toml'],
install_requires=['joblib', 'pip', 'setuptools', 'packaging>=20.0', 'toml'],
extras_require={
'all': EXTRAS_ALL,
Expand Down

0 comments on commit 7a63ef9

Please sign in to comment.