Merge pull request #719 from maebert/maebert-fast-import

Reduce startup time by 55%
This commit is contained in:
Jonathan Wren 2019-12-10 20:58:56 -08:00 committed by GitHub
commit f5e47f6484
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 8 deletions

1
.gitignore vendored
View file

@ -52,3 +52,4 @@ exp/
_extras/ _extras/
*.sublime-* *.sublime-*
site/ site/
jrnl/__version__.py

View file

@ -113,6 +113,7 @@ jobs:
before_deploy: before_deploy:
- poetry config http-basic.pypi "$PYPI_USER" "$PYPI_PASS" - poetry config http-basic.pypi "$PYPI_USER" "$PYPI_PASS"
- poetry version "$TRAVIS_TAG" - poetry version "$TRAVIS_TAG"
- echo __version__ = \"$TRAVIS_TAG\" > jrnl/__version__.py
- poetry build - poetry build
deploy: deploy:
- provider: script - provider: script
@ -124,4 +125,3 @@ jobs:
- git add pyproject.toml - git add pyproject.toml
- git commit -m "Incrementing version to ${TRAVIS_TAG}" - git commit -m "Incrementing version to ${TRAVIS_TAG}"
- git push https://${GITHUB_TOKEN}@github.com/jrnl-org/jrnl.git master - git push https://${GITHUB_TOKEN}@github.com/jrnl-org/jrnl.git master

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
import pkg_resources import os
try:
dist = pkg_resources.get_distribution('jrnl') from .__version__ import __version__
__title__ = dist.project_name except ImportError:
__version__ = dist.version __version__ = "source"
__title__ = "jrnl"

View file

@ -1,5 +1,4 @@
import re import re
import asteval
import yaml import yaml
VAR_RE = r"[_a-zA-Z][a-zA-Z0-9_]*" VAR_RE = r"[_a-zA-Z][a-zA-Z0-9_]*"
@ -39,6 +38,7 @@ class Template:
return self._expand(self.blocks[block], **vars) return self._expand(self.blocks[block], **vars)
def _eval_context(self, vars): def _eval_context(self, vars):
import asteval
e = asteval.Interpreter(use_numpy=False, writer=None) e = asteval.Interpreter(use_numpy=False, writer=None)
e.symtable.update(vars) e.symtable.update(vars)
e.symtable['__last_iteration'] = vars.get("__last_iteration", False) e.symtable['__last_iteration'] = vars.get("__last_iteration", False)