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

Reduce startup time by 55% #719

Merged
merged 4 commits into from
Dec 11, 2019
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ exp/
_extras/
*.sublime-*
site/
jrnl/__version__.py
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ jobs:
before_deploy:
- poetry config http-basic.pypi "$PYPI_USER" "$PYPI_PASS"
- poetry version "$TRAVIS_TAG"
- echo __version__ = \"$TRAVIS_TAG\" > jrnl/__version__.py
- poetry build
deploy:
- provider: script
Expand All @@ -124,4 +125,3 @@ jobs:
- git add pyproject.toml
- git commit -m "Incrementing version to ${TRAVIS_TAG}"
- git push https://${GITHUB_TOKEN}@github.com/jrnl-org/jrnl.git master

12 changes: 6 additions & 6 deletions jrnl/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env python

import pkg_resources

dist = pkg_resources.get_distribution('jrnl')
__title__ = dist.project_name
__version__ = dist.version

import os
try:
from .__version__ import __version__
except ImportError:
__version__ = "source"
__title__ = "jrnl"
2 changes: 1 addition & 1 deletion jrnl/plugins/template.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import re
import asteval
import yaml

VAR_RE = r"[_a-zA-Z][a-zA-Z0-9_]*"
Expand Down Expand Up @@ -39,6 +38,7 @@ def render_block(self, block, **vars):
return self._expand(self.blocks[block], **vars)

def _eval_context(self, vars):
import asteval
e = asteval.Interpreter(use_numpy=False, writer=None)
e.symtable.update(vars)
e.symtable['__last_iteration'] = vars.get("__last_iteration", False)
Expand Down