Skip to content

Commit

Permalink
Release prep (#33)
Browse files Browse the repository at this point in the history
* Optimize imports
* Fix spelling issues
* Update initialize command to use release of templates
    - Templates for v0.0.1 have been released, so need to use those templates when initializing a 
      new environment
* Remove dev tag from version
  • Loading branch information
rerobins authored Nov 17, 2017
1 parent 04cbe5a commit 7c4ee03
Show file tree
Hide file tree
Showing 16 changed files with 52 additions and 38 deletions.
4 changes: 2 additions & 2 deletions autology/commands/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

from pkg_resources import iter_entry_points

from autology.configuration import load_configuration_file as _load_configuration_file
from autology import topics
from autology.configuration import load_configuration_file as _load_configuration_file


def _build_arguments():
"""Load subcommands defined in setup.py and allow them to build their arguments."""
"""Load sub-commands defined in setup.py and allow them to build their arguments."""
parser = argparse.ArgumentParser(description='Execute autology root command')
parser.add_argument('--config', '-c', action='store', default='config.yaml',)

Expand Down
2 changes: 1 addition & 1 deletion autology/commands/subcommands/dump_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


def register_command(subparser):
"""Register the subcommand with any additional arguments."""
"""Register the sub-command with any additional arguments."""
parser = subparser.add_parser('dump_config', help='Create a new note object.')
parser.set_defaults(func=_main)

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


def register_command(subparser):
"""Register the subcommand with any additional arguments."""
"""Register the sub-command with any additional arguments."""
parser = subparser.add_parser('export_log_templates', help='Export the defined log templates to a directory')
parser.set_defaults(func=_main)

Expand Down
4 changes: 2 additions & 2 deletions autology/commands/subcommands/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import datetime
import pathlib

from autology.configuration import get_configuration
from autology import topics
from autology.configuration import get_configuration


def register_command(subparser):
"""Register the subcommand with any additional arguments."""
"""Register the sub-command with any additional arguments."""
generator_parser = subparser.add_parser('generate', help='Generate the static content')
generator_parser.set_defaults(func=_main)

Expand Down
14 changes: 8 additions & 6 deletions autology/commands/subcommands/initialize.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
"""Sub-command that will initialize an autology area."""
import pathlib
from autology.configuration import get_configuration
import yaml
import io
import zipfile

import io
import requests
import yaml

from autology.configuration import get_configuration

DEFAULT_TEMPLATES_URL = 'https://github.com/MeerkatLabs/autology_templates/archive/master.zip'
DEFAULT_TEMPLATES_URL = 'https://github.com/MeerkatLabs/autology_templates/archive/v0.0.1.zip'


def register_command(subparser):
"""Register the subcommand with any additional arguments."""
"""Register the sub-command with any additional arguments."""
parser = subparser.add_parser('init', help='Initialize area for gathering content.')
parser.set_defaults(func=_main)

Expand All @@ -33,7 +35,7 @@ def _main(args):
except requests.exceptions.MissingSchema:
template_file = templates

# template output directory is output/templates, so need to create that location before pulling out the tempaltes
# template output directory is output/templates, so need to create that location before pulling out the templates
template_location = main_path / 'templates' / 'output'
template_location.mkdir(parents=True, exist_ok=True)
templates_path = None
Expand Down
10 changes: 6 additions & 4 deletions autology/commands/subcommands/make_note.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
"""Sub-command that will create a new note file for the log."""
from autology.configuration import add_default_configuration, get_configuration, get_configuration_root
from pkg_resources import iter_entry_points
import frontmatter
import datetime
import pathlib
import subprocess

import frontmatter
from pkg_resources import iter_entry_points

from autology import topics
from autology.configuration import add_default_configuration, get_configuration, get_configuration_root


def register_command(subparser):
"""Register the subcommand with any additional arguments."""
"""Register the sub-command with any additional arguments."""
parser = subparser.add_parser('make_note', help='Create a new note object.')
parser.set_defaults(func=_main)

Expand Down
10 changes: 6 additions & 4 deletions autology/commands/subcommands/serve.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
"""Subcommand that hosts the output directory of the publisher as a web server."""
"""Sub-command that hosts the output directory of the publisher as a web server."""
import pathlib
import urllib
from http.server import HTTPServer, SimpleHTTPRequestHandler

import os
import posixpath
import pathlib

from autology.configuration import get_configuration
from http.server import HTTPServer, SimpleHTTPRequestHandler


def register_command(subparser):
"""Register the subcommand with any additional arguments."""
"""Register the sub-command with any additional arguments."""
parser = subparser.add_parser('serve', help='Serve the contents of the publishers output files')
parser.set_defaults(func=_main)

Expand Down
8 changes: 5 additions & 3 deletions autology/publishing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
Provides wrapper around common publishing functionality.
"""
import pathlib

import markdown
import yaml
import shutil
import yaml
from dict_recursive_update import recursive_update
from jinja2 import Environment, FileSystemLoader, select_autoescape

from autology import topics
from autology.configuration import add_default_configuration, get_configuration
from dict_recursive_update import recursive_update

_environment = None
_output_path = None
Expand Down Expand Up @@ -96,7 +98,7 @@ def publish(template, output_file, context=None, **kwargs):


def url_filter(url):
"""Filter that will prepend the URL root for links in order to put the log in a directory on a webserver."""
"""Filter that will prepend the URL root for links in order to put the log in a directory on a web server."""
config = get_configuration()
if config.publishing.url_root:
return "{}{}".format(get_configuration().publishing.url_root, url)
Expand Down
1 change: 1 addition & 0 deletions autology/reports/index.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Report that builds the index file."""
import datetime
import pathlib

from autology import topics
from autology.publishing import publish

Expand Down
11 changes: 7 additions & 4 deletions autology/reports/project/project.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
"""Processes the front data in the markdown files to process project stat recordings."""
import frontmatter
from autology import topics
from yaml import load_all
import datetime
import pathlib
from autology.reports.models import Report

import frontmatter
from yaml import load_all

from autology import topics
from autology.publishing import publish
from autology.reports.models import Report

try:
from yaml import CLoader as Loader
except ImportError:
Expand Down
2 changes: 1 addition & 1 deletion autology/reports/project/template.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Template for the project log files."""
from autology.reports.timeline.template import template_start as timeline_start, template_end as timeline_end
from autology.reports.models import Template
from autology.reports.timeline.template import template_start as timeline_start, template_end as timeline_end


def register_template():
Expand Down
4 changes: 3 additions & 1 deletion autology/reports/timeline/template.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""Simple template definition for a log file that contains start time, end time, location, and empty content."""
from datetime import datetime

import frontmatter

from autology.reports.models import Template


Expand All @@ -20,7 +22,7 @@ def template_start():

def template_end(post):
"""
Finish the manipulation of the metadata in the frontmatter before saving the contents to the storage engine.
Finish the manipulation of the metadata in the front matter before saving the contents to the storage engine.
:param post: the post file that will be modified.
"""
if not post.metadata['end_time']:
Expand Down
6 changes: 3 additions & 3 deletions autology/reports/timeline/timeline.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"""
Timeline report that will process all of the files into a timeline in order to be published to the log.
"""
from operator import attrgetter
import frontmatter
import pathlib
from datetime import datetime, time

import frontmatter
from collections import namedtuple

from autology.reports.models import Report
from autology import topics
from autology.publishing import publish
from autology.reports.models import Report
from autology.utilities import log_file as log_file_utils

# The content that is stored for each individual day
Expand Down
4 changes: 2 additions & 2 deletions autology/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
Current implementation assumes that git is initialized in the project directory, and has a remote named origin.
"""
import git
from autology.configuration import get_configuration_root, add_default_configuration, get_configuration
from autology import topics

from autology import topics
from autology.configuration import get_configuration_root, add_default_configuration, get_configuration

# The current repository that all of the files will be stored/modified in.
_repo = None
Expand Down
6 changes: 3 additions & 3 deletions autology/utilities/log_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

def get_start_time(date, front_matter, file_path=None):
"""
Convert the details in frontmatter into a start time for the file. If there isn't a value stored in the frontmatter
data values, then if defined the file_path will be used.
Convert the details in front matter into a start time for the file. If there isn't a value stored in the front
matter data values, then if defined the file_path will be used.
Will search for start_time key in the frontmatter dictionary, if that value is a string, then it will be parsed as:
Will search for start_time key in the front matter dictionary, if that value is a string, then it will be parsed as:
HH:MM.
If it's an integer or a if it's a duration, then it will be parsed as [HH:]MM:SS duration value which is what YAML
uses by default. Please know that this is because of YAML parsing rules.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='autology',
version='0.1.0.dev',
version='0.1.0',
packages=find_packages(),
url='',
license='MIT',
Expand Down

0 comments on commit 7c4ee03

Please sign in to comment.