Compare commits

...

4 Commits

Author SHA1 Message Date
cd2fdc162e Fix: run pre-commit hooks
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-28 09:39:51 +02:00
d5981d25e5 Core: add pre-commit config 2022-07-28 09:39:20 +02:00
8a9b13cfcf Core: Add pre-commit int dev-dependencies 2022-07-28 09:29:14 +02:00
18b4b69139 Core: setup poetry 2022-07-28 09:25:23 +02:00
38 changed files with 686 additions and 363 deletions

20
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,20 @@
---
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 22.6.0
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
args: ["--profile", "black"]

View File

@ -9,4 +9,3 @@ docker-build-usecase:
docker-usecase: docker-build-usecase docker-usecase: docker-build-usecase
docker run usecase sh -c "bopytex -s students.csv tpl_example.tex && cat 1_example.tex" docker run usecase sh -c "bopytex -s students.csv tpl_example.tex && cat 1_example.tex"

View File

@ -1,3 +1,4 @@
from bopytex.jinja2_env.texenv import texenv
from bopytex.planner.generate_compile_join_planner import planner from bopytex.planner.generate_compile_join_planner import planner
from bopytex.worker import Dispatcher from bopytex.worker import Dispatcher
from bopytex.worker.activate_corr import activate_corr from bopytex.worker.activate_corr import activate_corr
@ -5,22 +6,20 @@ from bopytex.worker.clean import clean
from bopytex.worker.compile import pdflatex from bopytex.worker.compile import pdflatex
from bopytex.worker.generate import generate from bopytex.worker.generate import generate
from bopytex.worker.join_pdf import pdfjam from bopytex.worker.join_pdf import pdfjam
from bopytex.jinja2_env.texenv import texenv
jinja2 = { jinja2 = {"environment": texenv}
"environment": texenv
}
dispatcher = Dispatcher({ dispatcher = Dispatcher(
{
"GENERATE": generate, "GENERATE": generate,
"COMPILE": pdflatex, "COMPILE": pdflatex,
"JOIN": pdfjam, "JOIN": pdfjam,
"CLEAN": clean, "CLEAN": clean,
"ACTIVATE_CORR": activate_corr, "ACTIVATE_CORR": activate_corr,
}) }
)
latex = { latex = {
"solution": r"solution/print = true", "solution": r"solution/print = true",
"no_solution": r"solution/print = false", "no_solution": r"solution/print = false",
} }

View File

@ -1,4 +1,4 @@
class Message(): class Message:
def __init__(self, status, out, err): def __init__(self, status, out, err):
self._status = status self._status = status
self._out = out self._out = out
@ -19,6 +19,7 @@ class Message():
def __repr__(self): def __repr__(self):
return f"Message(status={self.status}, out={self.out}, err={self.err})" return f"Message(status={self.status}, out={self.out}, err={self.err})"
class SubprocessMessage(Message): class SubprocessMessage(Message):
def __init__(self, process): def __init__(self, process):
self._process = process self._process = process

View File

@ -1,7 +1,8 @@
from bopytex.tasks import Task, activate_corr_on, compile_pdf, join_pdfs
import bopytex.planner.naming as naming
import os import os
import bopytex.planner.naming as naming
from bopytex.tasks import Task, activate_corr_on, compile_pdf, join_pdfs
def list_files(dir=".", accept=lambda _: True, reject=lambda _: False): def list_files(dir=".", accept=lambda _: True, reject=lambda _: False):
files = [] files = []

View File

@ -1,7 +1,8 @@
from bopytex.tasks import Task, activate_corr_on, compile_pdf, generate, join_pdfs import csv
import bopytex.planner.naming as naming import bopytex.planner.naming as naming
from bopytex.planner.exceptions import PlannerMissingOption from bopytex.planner.exceptions import PlannerMissingOption
import csv from bopytex.tasks import Task, activate_corr_on, compile_pdf, generate, join_pdfs
def build_subject_list_from_infos(infos: list[dict]) -> list[dict]: def build_subject_list_from_infos(infos: list[dict]) -> list[dict]:
@ -70,10 +71,7 @@ def tasks_builder(
for subject in subjects: for subject in subjects:
source = naming.template2source(template, subject) source = naming.template2source(template, subject)
args = { args = {"subject": subject, "options": options}
"subject": subject,
"options": options
}
tasks.append(generate(template, args, source)) tasks.append(generate(template, args, source))

View File

@ -12,4 +12,3 @@ def source2pdf(source):
def join(template): def join(template):
return source2pdf("joined" + template[3:]) return source2pdf("joined" + template[3:])

View File

@ -2,9 +2,10 @@
# encoding: utf-8 # encoding: utf-8
import click
import logging import logging
import click
from bopytex.service import main from bopytex.service import main
formatter = logging.Formatter("%(name)s :: %(levelname)s :: %(message)s") formatter = logging.Formatter("%(name)s :: %(levelname)s :: %(message)s")

View File

@ -8,8 +8,9 @@ Producing then compiling templates
import importlib.util import importlib.util
import os import os
from pathlib import Path from pathlib import Path
from bopytex.scheduler import Scheduler
from bopytex import default_config from bopytex import default_config
from bopytex.scheduler import Scheduler
def orcherstrator( def orcherstrator(

View File

@ -15,4 +15,3 @@ class Dispatcher:
) )
return choosen_action(args=task.args, deps=task.deps, output=task.output) return choosen_action(args=task.args, deps=task.deps, output=task.output)

View File

@ -11,4 +11,3 @@ def activate_corr(args, deps, output):
output_f.write(line.replace(no_solution, solution)) output_f.write(line.replace(no_solution, solution))
return Message(0, [f"ACTIVATE CORR - {deps[0]} to {output}"], []) return Message(0, [f"ACTIVATE CORR - {deps[0]} to {output}"], [])

View File

@ -1,6 +1,7 @@
import subprocess import subprocess
from bopytex.message import Message from bopytex.message import Message
from ..message import SubprocessMessage from ..message import SubprocessMessage

View File

@ -20,8 +20,7 @@ def pdfjam(args: dict, deps, output):
def gs(args: dict, deps, output): def gs(args: dict, deps, output):
"""Not working. The command works in terminal but not here""" """Not working. The command works in terminal but not here"""
joining_process = subprocess.Popen( joining_process = subprocess.Popen(
["gs", f"-dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile={output}"] ["gs", f"-dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile={output}"] + deps,
+ deps,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, stderr=subprocess.PIPE,
universal_newlines=True, universal_newlines=True,

View File

@ -198,5 +198,3 @@ SSH_TARGET_DIR=/var/docker/opytex.org/www/opytex
rsync_upload: html rsync_upload: html
rsync -e "ssh" -P -rvzc --delete $(BUILDDIR)/html/ $(SSH_CONF):$(SSH_TARGET_DIR) --cvs-exclude rsync -e "ssh" -P -rvzc --delete $(BUILDDIR)/html/ $(SSH_CONF):$(SSH_TARGET_DIR) --cvs-exclude

View File

@ -188,4 +188,3 @@ Calculer les longueurs $OC$ et $AB$.
%%% mode: latex %%% mode: latex
%%% TeX-master: "master" %%% TeX-master: "master"
%%% End: %%% End:

View File

@ -13,9 +13,9 @@
# All configuration values have a default; values that are commented out # All configuration values have a default; values that are commented out
# serve to show the default. # serve to show the default.
import sys
import os import os
import shlex import shlex
import sys
# If extensions (or modules to document with autodoc) are in another directory, # If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the # add these directories to sys.path here. If the directory is relative to the
@ -31,46 +31,46 @@ import shlex
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones. # ones.
extensions = [ extensions = [
'sphinx.ext.autodoc', "sphinx.ext.autodoc",
'sphinx.ext.mathjax', "sphinx.ext.mathjax",
'sphinx.ext.ifconfig', "sphinx.ext.ifconfig",
'sphinx.ext.viewcode', "sphinx.ext.viewcode",
] ]
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates'] templates_path = ["_templates"]
# The suffix(es) of source filenames. # The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string: # You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md'] # source_suffix = ['.rst', '.md']
source_suffix = '.rst' source_suffix = ".rst"
# The encoding of source files. # The encoding of source files.
# source_encoding = 'utf-8-sig' # source_encoding = 'utf-8-sig'
# The master toctree document. # The master toctree document.
master_doc = 'index' master_doc = "index"
# General information about the project. # General information about the project.
project = 'Opytex' project = "Opytex"
copyright = '2016, Benjamin Bertrand' copyright = "2016, Benjamin Bertrand"
author = 'Benjamin Bertrand' author = "Benjamin Bertrand"
# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the # |version| and |release|, also used in various other places throughout the
# built documents. # built documents.
# #
# The short X.Y version. # The short X.Y version.
version = '0.1' version = "0.1"
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = '0.1' release = "0.1"
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.
# #
# This is also used if you do content translation via gettext catalogs. # This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases. # Usually you set "language" from the command line for these cases.
language = 'fr' language = "fr"
# There are two options for replacing |today|: either, you set today to some # There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used: # non-false value, then it is used:
@ -98,7 +98,7 @@ exclude_patterns = []
# show_authors = False # show_authors = False
# The name of the Pygments (syntax highlighting) style to use. # The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx' pygments_style = "sphinx"
# A list of ignored prefixes for module index sorting. # A list of ignored prefixes for module index sorting.
# modindex_common_prefix = [] # modindex_common_prefix = []
@ -116,6 +116,7 @@ todo_include_todos = False
# a list of builtin themes. # a list of builtin themes.
# html_theme = 'alabaster' # html_theme = 'alabaster'
import sphinx_rtd_theme import sphinx_rtd_theme
html_theme = "sphinx_rtd_theme" html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
@ -146,7 +147,7 @@ html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# Add any paths that contain custom static files (such as style sheets) here, # Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files, # relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css". # so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static'] html_static_path = ["_static"]
# Add any extra paths that contain custom files (such as robots.txt or # Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied # .htaccess) here, relative to this directory. These files are copied
@ -209,20 +210,17 @@ html_static_path = ['_static']
# html_search_scorer = 'scorer.js' # html_search_scorer = 'scorer.js'
# Output file base name for HTML help builder. # Output file base name for HTML help builder.
htmlhelp_basename = 'Opytexdoc' htmlhelp_basename = "Opytexdoc"
# -- Options for LaTeX output --------------------------------------------- # -- Options for LaTeX output ---------------------------------------------
latex_elements = { latex_elements = {
# The paper size ('letterpaper' or 'a4paper'). # The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper', #'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt'). # The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt', #'pointsize': '10pt',
# Additional stuff for the LaTeX preamble. # Additional stuff for the LaTeX preamble.
#'preamble': '', #'preamble': '',
# Latex figure (float) alignment # Latex figure (float) alignment
#'figure_align': 'htbp', #'figure_align': 'htbp',
} }
@ -231,8 +229,7 @@ latex_elements = {
# (source start file, target name, title, # (source start file, target name, title,
# author, documentclass [howto, manual, or own class]). # author, documentclass [howto, manual, or own class]).
latex_documents = [ latex_documents = [
(master_doc, 'Opytex.tex', 'Opytex Documentation', (master_doc, "Opytex.tex", "Opytex Documentation", "Benjamin Bertrand", "manual"),
'Benjamin Bertrand', 'manual'),
] ]
# The name of an image file (relative to this directory) to place at the top of # The name of an image file (relative to this directory) to place at the top of
@ -260,10 +257,7 @@ latex_documents = [
# One entry per manual page. List of tuples # One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section). # (source start file, name, description, authors, manual section).
man_pages = [ man_pages = [(master_doc, "opytex", "Opytex Documentation", [author], 1)]
(master_doc, 'opytex', 'Opytex Documentation',
[author], 1)
]
# If true, show URL addresses after external links. # If true, show URL addresses after external links.
# man_show_urls = False # man_show_urls = False
@ -275,9 +269,15 @@ man_pages = [
# (source start file, target name, title, author, # (source start file, target name, title, author,
# dir menu entry, description, category) # dir menu entry, description, category)
texinfo_documents = [ texinfo_documents = [
(master_doc, 'Opytex', 'Opytex Documentation', (
author, 'Opytex', 'One line description of project.', master_doc,
'Miscellaneous'), "Opytex",
"Opytex Documentation",
author,
"Opytex",
"One line description of project.",
"Miscellaneous",
),
] ]
# Documents to append as an appendix to all manuals. # Documents to append as an appendix to all manuals.

View File

@ -38,4 +38,3 @@ Indices and tables
* :ref:`genindex` * :ref:`genindex`
* :ref:`modindex` * :ref:`modindex`
* :ref:`search` * :ref:`search`

View File

@ -158,6 +158,3 @@ Il est possible aussi de créer les sujets et les corrections en même temps ave
.. code-block:: bash .. code-block:: bash
opytex -t tpl_DM.tex -c -N 60 opytex -t tpl_DM.tex -c -N 60

View File

@ -1,4 +1,3 @@
from mapytex import Expression from mapytex import Expression
direct_access = {
"Expression": Expression direct_access = {"Expression": Expression}
}

280
poetry.lock generated Normal file
View File

@ -0,0 +1,280 @@
[[package]]
name = "cfgv"
version = "3.3.1"
description = "Validate configuration and produce human readable error messages."
category = "dev"
optional = false
python-versions = ">=3.6.1"
[[package]]
name = "click"
version = "8.1.3"
description = "Composable command line interface toolkit"
category = "main"
optional = false
python-versions = ">=3.7"
[package.dependencies]
colorama = {version = "*", markers = "platform_system == \"Windows\""}
[[package]]
name = "colorama"
version = "0.4.5"
description = "Cross-platform colored terminal text."
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
[[package]]
name = "distlib"
version = "0.3.5"
description = "Distribution utilities"
category = "dev"
optional = false
python-versions = "*"
[[package]]
name = "filelock"
version = "3.7.1"
description = "A platform independent file lock."
category = "dev"
optional = false
python-versions = ">=3.7"
[package.extras]
docs = ["furo (>=2021.8.17b43)", "sphinx (>=4.1)", "sphinx-autodoc-typehints (>=1.12)"]
testing = ["covdefaults (>=1.2.0)", "coverage (>=4)", "pytest (>=4)", "pytest-cov", "pytest-timeout (>=1.4.2)"]
[[package]]
name = "identify"
version = "2.5.2"
description = "File identification library for Python"
category = "dev"
optional = false
python-versions = ">=3.7"
[package.extras]
license = ["ukkonen"]
[[package]]
name = "jinja2"
version = "3.1.2"
description = "A very fast and expressive template engine."
category = "main"
optional = false
python-versions = ">=3.7"
[package.dependencies]
MarkupSafe = ">=2.0"
[package.extras]
i18n = ["Babel (>=2.7)"]
[[package]]
name = "markupsafe"
version = "2.1.1"
description = "Safely add untrusted strings to HTML/XML markup."
category = "main"
optional = false
python-versions = ">=3.7"
[[package]]
name = "nodeenv"
version = "1.7.0"
description = "Node.js virtual environment builder"
category = "dev"
optional = false
python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*"
[[package]]
name = "platformdirs"
version = "2.5.2"
description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
category = "dev"
optional = false
python-versions = ">=3.7"
[package.extras]
docs = ["furo (>=2021.7.5b38)", "proselint (>=0.10.2)", "sphinx-autodoc-typehints (>=1.12)", "sphinx (>=4)"]
test = ["appdirs (==1.4.4)", "pytest-cov (>=2.7)", "pytest-mock (>=3.6)", "pytest (>=6)"]
[[package]]
name = "pre-commit"
version = "2.20.0"
description = "A framework for managing and maintaining multi-language pre-commit hooks."
category = "dev"
optional = false
python-versions = ">=3.7"
[package.dependencies]
cfgv = ">=2.0.0"
identify = ">=1.0.0"
nodeenv = ">=0.11.1"
pyyaml = ">=5.1"
toml = "*"
virtualenv = ">=20.0.8"
[[package]]
name = "pyyaml"
version = "6.0"
description = "YAML parser and emitter for Python"
category = "dev"
optional = false
python-versions = ">=3.6"
[[package]]
name = "toml"
version = "0.10.2"
description = "Python Library for Tom's Obvious, Minimal Language"
category = "dev"
optional = false
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
[[package]]
name = "virtualenv"
version = "20.16.2"
description = "Virtual Python Environment builder"
category = "dev"
optional = false
python-versions = ">=3.6"
[package.dependencies]
distlib = ">=0.3.1,<1"
filelock = ">=3.2,<4"
platformdirs = ">=2,<3"
[package.extras]
docs = ["proselint (>=0.10.2)", "sphinx (>=3)", "sphinx-argparse (>=0.2.5)", "sphinx-rtd-theme (>=0.4.3)", "towncrier (>=21.3)"]
testing = ["coverage (>=4)", "coverage-enable-subprocess (>=1)", "flaky (>=3)", "packaging (>=20.0)", "pytest (>=4)", "pytest-env (>=0.6.2)", "pytest-freezegun (>=0.4.1)", "pytest-mock (>=2)", "pytest-randomly (>=1)", "pytest-timeout (>=1)"]
[metadata]
lock-version = "1.1"
python-versions = "^3.10"
content-hash = "a5f3c648ba2e1f31104bdf2c1e9f76dcbe7e324bf8c8d720fa160fd070bcd38a"
[metadata.files]
cfgv = [
{file = "cfgv-3.3.1-py2.py3-none-any.whl", hash = "sha256:c6a0883f3917a037485059700b9e75da2464e6c27051014ad85ba6aaa5884426"},
{file = "cfgv-3.3.1.tar.gz", hash = "sha256:f5a830efb9ce7a445376bb66ec94c638a9787422f96264c98edc6bdeed8ab736"},
]
click = [
{file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"},
{file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"},
]
colorama = [
{file = "colorama-0.4.5-py2.py3-none-any.whl", hash = "sha256:854bf444933e37f5824ae7bfc1e98d5bce2ebe4160d46b5edf346a89358e99da"},
{file = "colorama-0.4.5.tar.gz", hash = "sha256:e6c6b4334fc50988a639d9b98aa429a0b57da6e17b9a44f0451f930b6967b7a4"},
]
distlib = [
{file = "distlib-0.3.5-py2.py3-none-any.whl", hash = "sha256:b710088c59f06338ca514800ad795a132da19fda270e3ce4affc74abf955a26c"},
{file = "distlib-0.3.5.tar.gz", hash = "sha256:a7f75737c70be3b25e2bee06288cec4e4c221de18455b2dd037fe2a795cab2fe"},
]
filelock = [
{file = "filelock-3.7.1-py3-none-any.whl", hash = "sha256:37def7b658813cda163b56fc564cdc75e86d338246458c4c28ae84cabefa2404"},
{file = "filelock-3.7.1.tar.gz", hash = "sha256:3a0fd85166ad9dbab54c9aec96737b744106dc5f15c0b09a6744a445299fcf04"},
]
identify = [
{file = "identify-2.5.2-py2.py3-none-any.whl", hash = "sha256:feaa9db2dc0ce333b453ce171c0cf1247bbfde2c55fc6bb785022d411a1b78b5"},
{file = "identify-2.5.2.tar.gz", hash = "sha256:a3d4c096b384d50d5e6dc5bc8b9bc44f1f61cefebd750a7b3e9f939b53fb214d"},
]
jinja2 = [
{file = "Jinja2-3.1.2-py3-none-any.whl", hash = "sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61"},
{file = "Jinja2-3.1.2.tar.gz", hash = "sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852"},
]
markupsafe = [
{file = "MarkupSafe-2.1.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:86b1f75c4e7c2ac2ccdaec2b9022845dbb81880ca318bb7a0a01fbf7813e3812"},
{file = "MarkupSafe-2.1.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:f121a1420d4e173a5d96e47e9a0c0dcff965afdf1626d28de1460815f7c4ee7a"},
{file = "MarkupSafe-2.1.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a49907dd8420c5685cfa064a1335b6754b74541bbb3706c259c02ed65b644b3e"},
{file = "MarkupSafe-2.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:10c1bfff05d95783da83491be968e8fe789263689c02724e0c691933c52994f5"},
{file = "MarkupSafe-2.1.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b7bd98b796e2b6553da7225aeb61f447f80a1ca64f41d83612e6139ca5213aa4"},
{file = "MarkupSafe-2.1.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:b09bf97215625a311f669476f44b8b318b075847b49316d3e28c08e41a7a573f"},
{file = "MarkupSafe-2.1.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:694deca8d702d5db21ec83983ce0bb4b26a578e71fbdbd4fdcd387daa90e4d5e"},
{file = "MarkupSafe-2.1.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:efc1913fd2ca4f334418481c7e595c00aad186563bbc1ec76067848c7ca0a933"},
{file = "MarkupSafe-2.1.1-cp310-cp310-win32.whl", hash = "sha256:4a33dea2b688b3190ee12bd7cfa29d39c9ed176bda40bfa11099a3ce5d3a7ac6"},
{file = "MarkupSafe-2.1.1-cp310-cp310-win_amd64.whl", hash = "sha256:dda30ba7e87fbbb7eab1ec9f58678558fd9a6b8b853530e176eabd064da81417"},
{file = "MarkupSafe-2.1.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:671cd1187ed5e62818414afe79ed29da836dde67166a9fac6d435873c44fdd02"},
{file = "MarkupSafe-2.1.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3799351e2336dc91ea70b034983ee71cf2f9533cdff7c14c90ea126bfd95d65a"},
{file = "MarkupSafe-2.1.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e72591e9ecd94d7feb70c1cbd7be7b3ebea3f548870aa91e2732960fa4d57a37"},
{file = "MarkupSafe-2.1.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6fbf47b5d3728c6aea2abb0589b5d30459e369baa772e0f37a0320185e87c980"},
{file = "MarkupSafe-2.1.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:d5ee4f386140395a2c818d149221149c54849dfcfcb9f1debfe07a8b8bd63f9a"},
{file = "MarkupSafe-2.1.1-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:bcb3ed405ed3222f9904899563d6fc492ff75cce56cba05e32eff40e6acbeaa3"},
{file = "MarkupSafe-2.1.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:e1c0b87e09fa55a220f058d1d49d3fb8df88fbfab58558f1198e08c1e1de842a"},
{file = "MarkupSafe-2.1.1-cp37-cp37m-win32.whl", hash = "sha256:8dc1c72a69aa7e082593c4a203dcf94ddb74bb5c8a731e4e1eb68d031e8498ff"},
{file = "MarkupSafe-2.1.1-cp37-cp37m-win_amd64.whl", hash = "sha256:97a68e6ada378df82bc9f16b800ab77cbf4b2fada0081794318520138c088e4a"},
{file = "MarkupSafe-2.1.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:e8c843bbcda3a2f1e3c2ab25913c80a3c5376cd00c6e8c4a86a89a28c8dc5452"},
{file = "MarkupSafe-2.1.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:0212a68688482dc52b2d45013df70d169f542b7394fc744c02a57374a4207003"},
{file = "MarkupSafe-2.1.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8e576a51ad59e4bfaac456023a78f6b5e6e7651dcd383bcc3e18d06f9b55d6d1"},
{file = "MarkupSafe-2.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4b9fe39a2ccc108a4accc2676e77da025ce383c108593d65cc909add5c3bd601"},
{file = "MarkupSafe-2.1.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:96e37a3dc86e80bf81758c152fe66dbf60ed5eca3d26305edf01892257049925"},
{file = "MarkupSafe-2.1.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:6d0072fea50feec76a4c418096652f2c3238eaa014b2f94aeb1d56a66b41403f"},
{file = "MarkupSafe-2.1.1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:089cf3dbf0cd6c100f02945abeb18484bd1ee57a079aefd52cffd17fba910b88"},
{file = "MarkupSafe-2.1.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:6a074d34ee7a5ce3effbc526b7083ec9731bb3cbf921bbe1d3005d4d2bdb3a63"},
{file = "MarkupSafe-2.1.1-cp38-cp38-win32.whl", hash = "sha256:421be9fbf0ffe9ffd7a378aafebbf6f4602d564d34be190fc19a193232fd12b1"},
{file = "MarkupSafe-2.1.1-cp38-cp38-win_amd64.whl", hash = "sha256:fc7b548b17d238737688817ab67deebb30e8073c95749d55538ed473130ec0c7"},
{file = "MarkupSafe-2.1.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:e04e26803c9c3851c931eac40c695602c6295b8d432cbe78609649ad9bd2da8a"},
{file = "MarkupSafe-2.1.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:b87db4360013327109564f0e591bd2a3b318547bcef31b468a92ee504d07ae4f"},
{file = "MarkupSafe-2.1.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:99a2a507ed3ac881b975a2976d59f38c19386d128e7a9a18b7df6fff1fd4c1d6"},
{file = "MarkupSafe-2.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:56442863ed2b06d19c37f94d999035e15ee982988920e12a5b4ba29b62ad1f77"},
{file = "MarkupSafe-2.1.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3ce11ee3f23f79dbd06fb3d63e2f6af7b12db1d46932fe7bd8afa259a5996603"},
{file = "MarkupSafe-2.1.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:33b74d289bd2f5e527beadcaa3f401e0df0a89927c1559c8566c066fa4248ab7"},
{file = "MarkupSafe-2.1.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:43093fb83d8343aac0b1baa75516da6092f58f41200907ef92448ecab8825135"},
{file = "MarkupSafe-2.1.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:8e3dcf21f367459434c18e71b2a9532d96547aef8a871872a5bd69a715c15f96"},
{file = "MarkupSafe-2.1.1-cp39-cp39-win32.whl", hash = "sha256:d4306c36ca495956b6d568d276ac11fdd9c30a36f1b6eb928070dc5360b22e1c"},
{file = "MarkupSafe-2.1.1-cp39-cp39-win_amd64.whl", hash = "sha256:46d00d6cfecdde84d40e572d63735ef81423ad31184100411e6e3388d405e247"},
{file = "MarkupSafe-2.1.1.tar.gz", hash = "sha256:7f91197cc9e48f989d12e4e6fbc46495c446636dfc81b9ccf50bb0ec74b91d4b"},
]
nodeenv = [
{file = "nodeenv-1.7.0-py2.py3-none-any.whl", hash = "sha256:27083a7b96a25f2f5e1d8cb4b6317ee8aeda3bdd121394e5ac54e498028a042e"},
{file = "nodeenv-1.7.0.tar.gz", hash = "sha256:e0e7f7dfb85fc5394c6fe1e8fa98131a2473e04311a45afb6508f7cf1836fa2b"},
]
platformdirs = [
{file = "platformdirs-2.5.2-py3-none-any.whl", hash = "sha256:027d8e83a2d7de06bbac4e5ef7e023c02b863d7ea5d079477e722bb41ab25788"},
{file = "platformdirs-2.5.2.tar.gz", hash = "sha256:58c8abb07dcb441e6ee4b11d8df0ac856038f944ab98b7be6b27b2a3c7feef19"},
]
pre-commit = [
{file = "pre_commit-2.20.0-py2.py3-none-any.whl", hash = "sha256:51a5ba7c480ae8072ecdb6933df22d2f812dc897d5fe848778116129a681aac7"},
{file = "pre_commit-2.20.0.tar.gz", hash = "sha256:a978dac7bc9ec0bcee55c18a277d553b0f419d259dadb4b9418ff2d00eb43959"},
]
pyyaml = [
{file = "PyYAML-6.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d4db7c7aef085872ef65a8fd7d6d09a14ae91f691dec3e87ee5ee0539d516f53"},
{file = "PyYAML-6.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9df7ed3b3d2e0ecfe09e14741b857df43adb5a3ddadc919a2d94fbdf78fea53c"},
{file = "PyYAML-6.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:77f396e6ef4c73fdc33a9157446466f1cff553d979bd00ecb64385760c6babdc"},
{file = "PyYAML-6.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a80a78046a72361de73f8f395f1f1e49f956c6be882eed58505a15f3e430962b"},
{file = "PyYAML-6.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:f84fbc98b019fef2ee9a1cb3ce93e3187a6df0b2538a651bfb890254ba9f90b5"},
{file = "PyYAML-6.0-cp310-cp310-win32.whl", hash = "sha256:2cd5df3de48857ed0544b34e2d40e9fac445930039f3cfe4bcc592a1f836d513"},
{file = "PyYAML-6.0-cp310-cp310-win_amd64.whl", hash = "sha256:daf496c58a8c52083df09b80c860005194014c3698698d1a57cbcfa182142a3a"},
{file = "PyYAML-6.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:897b80890765f037df3403d22bab41627ca8811ae55e9a722fd0392850ec4d86"},
{file = "PyYAML-6.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:50602afada6d6cbfad699b0c7bb50d5ccffa7e46a3d738092afddc1f9758427f"},
{file = "PyYAML-6.0-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:48c346915c114f5fdb3ead70312bd042a953a8ce5c7106d5bfb1a5254e47da92"},
{file = "PyYAML-6.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:98c4d36e99714e55cfbaaee6dd5badbc9a1ec339ebfc3b1f52e293aee6bb71a4"},
{file = "PyYAML-6.0-cp36-cp36m-win32.whl", hash = "sha256:0283c35a6a9fbf047493e3a0ce8d79ef5030852c51e9d911a27badfde0605293"},
{file = "PyYAML-6.0-cp36-cp36m-win_amd64.whl", hash = "sha256:07751360502caac1c067a8132d150cf3d61339af5691fe9e87803040dbc5db57"},
{file = "PyYAML-6.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:819b3830a1543db06c4d4b865e70ded25be52a2e0631ccd2f6a47a2822f2fd7c"},
{file = "PyYAML-6.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:473f9edb243cb1935ab5a084eb238d842fb8f404ed2193a915d1784b5a6b5fc0"},
{file = "PyYAML-6.0-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0ce82d761c532fe4ec3f87fc45688bdd3a4c1dc5e0b4a19814b9009a29baefd4"},
{file = "PyYAML-6.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:231710d57adfd809ef5d34183b8ed1eeae3f76459c18fb4a0b373ad56bedcdd9"},
{file = "PyYAML-6.0-cp37-cp37m-win32.whl", hash = "sha256:c5687b8d43cf58545ade1fe3e055f70eac7a5a1a0bf42824308d868289a95737"},
{file = "PyYAML-6.0-cp37-cp37m-win_amd64.whl", hash = "sha256:d15a181d1ecd0d4270dc32edb46f7cb7733c7c508857278d3d378d14d606db2d"},
{file = "PyYAML-6.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:0b4624f379dab24d3725ffde76559cff63d9ec94e1736b556dacdfebe5ab6d4b"},
{file = "PyYAML-6.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:213c60cd50106436cc818accf5baa1aba61c0189ff610f64f4a3e8c6726218ba"},
{file = "PyYAML-6.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9fa600030013c4de8165339db93d182b9431076eb98eb40ee068700c9c813e34"},
{file = "PyYAML-6.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:277a0ef2981ca40581a47093e9e2d13b3f1fbbeffae064c1d21bfceba2030287"},
{file = "PyYAML-6.0-cp38-cp38-win32.whl", hash = "sha256:d4eccecf9adf6fbcc6861a38015c2a64f38b9d94838ac1810a9023a0609e1b78"},
{file = "PyYAML-6.0-cp38-cp38-win_amd64.whl", hash = "sha256:1e4747bc279b4f613a09eb64bba2ba602d8a6664c6ce6396a4d0cd413a50ce07"},
{file = "PyYAML-6.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:055d937d65826939cb044fc8c9b08889e8c743fdc6a32b33e2390f66013e449b"},
{file = "PyYAML-6.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:e61ceaab6f49fb8bdfaa0f92c4b57bcfbea54c09277b1b4f7ac376bfb7a7c174"},
{file = "PyYAML-6.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d67d839ede4ed1b28a4e8909735fc992a923cdb84e618544973d7dfc71540803"},
{file = "PyYAML-6.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cba8c411ef271aa037d7357a2bc8f9ee8b58b9965831d9e51baf703280dc73d3"},
{file = "PyYAML-6.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:40527857252b61eacd1d9af500c3337ba8deb8fc298940291486c465c8b46ec0"},
{file = "PyYAML-6.0-cp39-cp39-win32.whl", hash = "sha256:b5b9eccad747aabaaffbc6064800670f0c297e52c12754eb1d976c57e4f74dcb"},
{file = "PyYAML-6.0-cp39-cp39-win_amd64.whl", hash = "sha256:b3d267842bf12586ba6c734f89d1f5b871df0273157918b0ccefa29deb05c21c"},
{file = "PyYAML-6.0.tar.gz", hash = "sha256:68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2"},
]
toml = [
{file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"},
{file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"},
]
virtualenv = [
{file = "virtualenv-20.16.2-py2.py3-none-any.whl", hash = "sha256:635b272a8e2f77cb051946f46c60a54ace3cb5e25568228bd6b57fc70eca9ff3"},
{file = "virtualenv-20.16.2.tar.gz", hash = "sha256:0ef5be6d07181946891f5abc8047fda8bc2f0b4b9bf222c64e6e8963baee76db"},
]

18
pyproject.toml Normal file
View File

@ -0,0 +1,18 @@
[tool.poetry]
name = "bopytex"
version = "1.0.0rc1"
description = "Command line tool for compiling latex with python command embedded"
authors = ["Bertrand Benjamin <benjamin.bertrand@opytex.org>"]
license = "GPLv3"
[tool.poetry.dependencies]
python = "^3.10"
click = "^8.1.3"
Jinja2 = "^3.1.2"
[tool.poetry.dev-dependencies]
pre-commit = "^2.20.0"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

View File

@ -1,5 +1,6 @@
from bopytex.worker import Dispatcher from bopytex.worker import Dispatcher
from .workers import fake_worker, success_worker, fail_worker
from .workers import fail_worker, fake_worker, success_worker
fake_dispatcher = Dispatcher( fake_dispatcher = Dispatcher(
{ {

View File

@ -1,5 +1,6 @@
from bopytex.message import Message from bopytex.message import Message
def fake_worker(args, deps, output): def fake_worker(args, deps, output):
return Message(0, [f"FAKE - {args} - {deps} - {output}"], []) return Message(0, [f"FAKE - {args} - {deps} - {output}"], [])
@ -10,4 +11,3 @@ def success_worker(args, deps, output):
def fail_worker(args, deps, output): def fail_worker(args, deps, output):
return Message(1, [f"FAILURE - {args} - {deps} - {output}"], []) return Message(1, [f"FAILURE - {args} - {deps} - {output}"], [])

View File

@ -1,9 +1,11 @@
import os import os
import jinja2
from pathlib import Path from pathlib import Path
from bopytex.service import main
import jinja2
import pytest import pytest
from bopytex.service import main
@pytest.fixture @pytest.fixture
def template_path(tmp_path): def template_path(tmp_path):
@ -22,6 +24,7 @@ Subject {{ number }}
) )
return template return template
@pytest.fixture @pytest.fixture
def bad_template_path(tmp_path): def bad_template_path(tmp_path):
template = tmp_path / "tpl_source.tex" template = tmp_path / "tpl_source.tex"
@ -64,6 +67,7 @@ def test_with_default_planner(template_path, jinja2_env, tmp_path):
assert Path("joined_source.pdf").exists() assert Path("joined_source.pdf").exists()
def test_with_default_planner_bad_template(bad_template_path, jinja2_env, tmp_path): def test_with_default_planner_bad_template(bad_template_path, jinja2_env, tmp_path):
os.chdir(tmp_path) os.chdir(tmp_path)
@ -82,4 +86,3 @@ def test_with_default_planner_bad_template(bad_template_path, jinja2_env, tmp_pa
pass pass
assert not Path("joined_source.pdf").exists() assert not Path("joined_source.pdf").exists()

View File

@ -1,5 +1,9 @@
from bopytex.planner.generate_compile_join_planner import tasks_builder as gcj_task_builder from bopytex.planner.activate_corr_compile_join_planner import (
from bopytex.planner.activate_corr_compile_join_planner import tasks_builder as accj_task_builder tasks_builder as accj_task_builder,
)
from bopytex.planner.generate_compile_join_planner import (
tasks_builder as gcj_task_builder,
)
from bopytex.tasks import Task from bopytex.tasks import Task
@ -18,9 +22,9 @@ def test_tasks_builder_generate():
"options": { "options": {
"no_pdf": True, "no_pdf": True,
"subjects": [{"number": "01"}, {"number": "02"}], "subjects": [{"number": "01"}, {"number": "02"}],
'template': 'tpl_source.tex', "template": "tpl_source.tex",
}, },
"subject": {"number": "01"} "subject": {"number": "01"},
}, },
deps=["tpl_source.tex"], deps=["tpl_source.tex"],
output="01_source.tex", output="01_source.tex",
@ -31,9 +35,9 @@ def test_tasks_builder_generate():
"options": { "options": {
"no_pdf": True, "no_pdf": True,
"subjects": [{"number": "01"}, {"number": "02"}], "subjects": [{"number": "01"}, {"number": "02"}],
'template': 'tpl_source.tex', "template": "tpl_source.tex",
}, },
"subject": {"number": "02"} "subject": {"number": "02"},
}, },
deps=["tpl_source.tex"], deps=["tpl_source.tex"],
output="02_source.tex", output="02_source.tex",
@ -56,9 +60,9 @@ def test_tasks_builder_generate_compile():
"options": { "options": {
"no_join": True, "no_join": True,
"subjects": [{"number": "01"}, {"number": "02"}], "subjects": [{"number": "01"}, {"number": "02"}],
'template': 'tpl_source.tex', "template": "tpl_source.tex",
}, },
"subject": {"number": "01"} "subject": {"number": "01"},
}, },
deps=["tpl_source.tex"], deps=["tpl_source.tex"],
output="01_source.tex", output="01_source.tex",
@ -75,9 +79,9 @@ def test_tasks_builder_generate_compile():
"options": { "options": {
"no_join": True, "no_join": True,
"subjects": [{"number": "01"}, {"number": "02"}], "subjects": [{"number": "01"}, {"number": "02"}],
'template': 'tpl_source.tex', "template": "tpl_source.tex",
}, },
"subject": {"number": "02"} "subject": {"number": "02"},
}, },
deps=["tpl_source.tex"], deps=["tpl_source.tex"],
output="02_source.tex", output="02_source.tex",
@ -104,9 +108,9 @@ def test_tasks_builder_generate_compile_join():
args={ args={
"options": { "options": {
"subjects": [{"number": "01"}, {"number": "02"}], "subjects": [{"number": "01"}, {"number": "02"}],
'template': 'tpl_source.tex', "template": "tpl_source.tex",
}, },
"subject": {"number": "01"} "subject": {"number": "01"},
}, },
deps=["tpl_source.tex"], deps=["tpl_source.tex"],
output="01_source.tex", output="01_source.tex",
@ -122,9 +126,9 @@ def test_tasks_builder_generate_compile_join():
args={ args={
"options": { "options": {
"subjects": [{"number": "01"}, {"number": "02"}], "subjects": [{"number": "01"}, {"number": "02"}],
'template': 'tpl_source.tex', "template": "tpl_source.tex",
}, },
"subject": {"number": "02"} "subject": {"number": "02"},
}, },
deps=["tpl_source.tex"], deps=["tpl_source.tex"],
output="02_source.tex", output="02_source.tex",
@ -161,9 +165,9 @@ def test_tasks_builder_generate_compile_corr():
"subjects": [{"number": "01"}, {"number": "02"}], "subjects": [{"number": "01"}, {"number": "02"}],
"corr": True, "corr": True,
"no_join": True, "no_join": True,
'template': 'tpl_source.tex', "template": "tpl_source.tex",
}, },
"subject": {"number": "01"} "subject": {"number": "01"},
}, },
deps=["tpl_source.tex"], deps=["tpl_source.tex"],
output="01_source.tex", output="01_source.tex",
@ -177,11 +181,11 @@ def test_tasks_builder_generate_compile_corr():
Task( Task(
action="ACTIVATE_CORR", action="ACTIVATE_CORR",
args={ args={
'corr': True, "corr": True,
'no_join': True, "no_join": True,
'no_pdf': False, "no_pdf": False,
'template': 'tpl_source.tex', "template": "tpl_source.tex",
"subjects": [{'number': '01'}, {'number': '02'}] "subjects": [{"number": "01"}, {"number": "02"}],
}, },
deps=["01_source.tex"], deps=["01_source.tex"],
output="corr_01_source.tex", output="corr_01_source.tex",
@ -199,9 +203,9 @@ def test_tasks_builder_generate_compile_corr():
"subjects": [{"number": "01"}, {"number": "02"}], "subjects": [{"number": "01"}, {"number": "02"}],
"corr": True, "corr": True,
"no_join": True, "no_join": True,
'template': 'tpl_source.tex', "template": "tpl_source.tex",
}, },
"subject": {"number": "02"} "subject": {"number": "02"},
}, },
deps=["tpl_source.tex"], deps=["tpl_source.tex"],
output="02_source.tex", output="02_source.tex",
@ -215,11 +219,11 @@ def test_tasks_builder_generate_compile_corr():
Task( Task(
action="ACTIVATE_CORR", action="ACTIVATE_CORR",
args={ args={
'corr': True, "corr": True,
'no_join': True, "no_join": True,
'no_pdf': False, "no_pdf": False,
'template': 'tpl_source.tex', "template": "tpl_source.tex",
"subjects": [{'number': '01'}, {'number': '02'}] "subjects": [{"number": "01"}, {"number": "02"}],
}, },
deps=["02_source.tex"], deps=["02_source.tex"],
output="corr_02_source.tex", output="corr_02_source.tex",
@ -250,9 +254,9 @@ def test_tasks_builder_generate_compile_corr_joined():
"subjects": [{"number": "01"}, {"number": "02"}], "subjects": [{"number": "01"}, {"number": "02"}],
"corr": True, "corr": True,
"no_join": False, "no_join": False,
'template': 'tpl_source.tex', "template": "tpl_source.tex",
}, },
"subject": {"number": "01"} "subject": {"number": "01"},
}, },
deps=["tpl_source.tex"], deps=["tpl_source.tex"],
output="01_source.tex", output="01_source.tex",
@ -266,11 +270,11 @@ def test_tasks_builder_generate_compile_corr_joined():
Task( Task(
action="ACTIVATE_CORR", action="ACTIVATE_CORR",
args={ args={
'corr': True, "corr": True,
'no_join': False, "no_join": False,
'no_pdf': False, "no_pdf": False,
'template': 'tpl_source.tex', "template": "tpl_source.tex",
"subjects": [{'number': '01'}, {'number': '02'}] "subjects": [{"number": "01"}, {"number": "02"}],
}, },
deps=["01_source.tex"], deps=["01_source.tex"],
output="corr_01_source.tex", output="corr_01_source.tex",
@ -288,9 +292,9 @@ def test_tasks_builder_generate_compile_corr_joined():
"subjects": [{"number": "01"}, {"number": "02"}], "subjects": [{"number": "01"}, {"number": "02"}],
"corr": True, "corr": True,
"no_join": False, "no_join": False,
'template': 'tpl_source.tex', "template": "tpl_source.tex",
}, },
"subject": {"number": "02"} "subject": {"number": "02"},
}, },
deps=["tpl_source.tex"], deps=["tpl_source.tex"],
output="02_source.tex", output="02_source.tex",
@ -304,11 +308,11 @@ def test_tasks_builder_generate_compile_corr_joined():
Task( Task(
action="ACTIVATE_CORR", action="ACTIVATE_CORR",
args={ args={
'corr': True, "corr": True,
'no_join': False, "no_join": False,
'no_pdf': False, "no_pdf": False,
'template': 'tpl_source.tex', "template": "tpl_source.tex",
"subjects": [{'number': '01'}, {'number': '02'}] "subjects": [{"number": "01"}, {"number": "02"}],
}, },
deps=["02_source.tex"], deps=["02_source.tex"],
output="corr_02_source.tex", output="corr_02_source.tex",
@ -344,9 +348,9 @@ def test_only_corr_tasks_builder():
Task( Task(
action="ACTIVATE_CORR", action="ACTIVATE_CORR",
args={ args={
'no_join': False, "no_join": False,
'no_pdf': False, "no_pdf": False,
'sources': ['01_source.tex', '02_source.tex'] "sources": ["01_source.tex", "02_source.tex"],
}, },
deps=["01_source.tex"], deps=["01_source.tex"],
output="corr_01_source.tex", output="corr_01_source.tex",
@ -360,9 +364,9 @@ def test_only_corr_tasks_builder():
Task( Task(
action="ACTIVATE_CORR", action="ACTIVATE_CORR",
args={ args={
'no_join': False, "no_join": False,
'no_pdf': False, "no_pdf": False,
'sources': ['01_source.tex', '02_source.tex'] "sources": ["01_source.tex", "02_source.tex"],
}, },
deps=["02_source.tex"], deps=["02_source.tex"],
output="corr_02_source.tex", output="corr_02_source.tex",

View File

@ -1,9 +1,11 @@
from bopytex.message import Message
from bopytex.tasks import Task
from bopytex.scheduler import Scheduler
from .fakes.dispatcher import fake_dispatcher
import pytest import pytest
from bopytex.message import Message
from bopytex.scheduler import Scheduler
from bopytex.tasks import Task
from .fakes.dispatcher import fake_dispatcher
def test_schedule_append(): def test_schedule_append():
scheduler = Scheduler(dispatcher=fake_dispatcher) scheduler = Scheduler(dispatcher=fake_dispatcher)

View File

@ -1,10 +1,12 @@
import os import os
import pytest import pytest
from bopytex.planner import fake_planner from bopytex.planner import fake_planner
from bopytex.service import build_config, orcherstrator from bopytex.service import build_config, orcherstrator
from bopytex.tasks import Task from bopytex.tasks import Task
from bopytex.worker import Dispatcher from bopytex.worker import Dispatcher
from .fakes.workers import fake_worker from .fakes.workers import fake_worker

View File

@ -22,6 +22,7 @@ def test_block_line_statement():
output = jinja2_template.render() output = jinja2_template.render()
assert output == "2" assert output == "2"
def test_block_line_statement_with_comment(): def test_block_line_statement_with_comment():
base_template = r"""%-set a = 2 base_template = r"""%-set a = 2
%# comment %# comment
@ -30,11 +31,10 @@ def test_block_line_statement_with_comment():
output = jinja2_template.render() output = jinja2_template.render()
assert output == "\n2" assert output == "\n2"
def test_add_filter(): def test_add_filter():
texenv.filters["count_caracters"] = lambda x: len(x) texenv.filters["count_caracters"] = lambda x: len(x)
base_template = r"""\Var{a} has \Var{a | count_caracters}""" base_template = r"""\Var{a} has \Var{a | count_caracters}"""
jinja2_template = texenv.from_string(base_template) jinja2_template = texenv.from_string(base_template)
output = jinja2_template.render(a="coucou") output = jinja2_template.render(a="coucou")
assert output == "coucou has 6" assert output == "coucou has 6"

View File

@ -1,9 +1,10 @@
import os import os
from pathlib import Path from pathlib import Path
from bopytex.worker.compile import latexmk
import pytest import pytest
from bopytex.worker.compile import latexmk
@pytest.fixture @pytest.fixture
def tex_path(tmp_path): def tex_path(tmp_path):

View File

@ -1,8 +1,10 @@
import os import os
import jinja2 import jinja2
from bopytex.worker.generate import generate
import pytest import pytest
from bopytex.worker.generate import generate
@pytest.fixture @pytest.fixture
def jinja2_env(tmp_path): def jinja2_env(tmp_path):
@ -70,7 +72,7 @@ def test_generate_with_random(template_path_with_random, jinja2_env):
"jinja2": {"environment": jinja2_env}, "jinja2": {"environment": jinja2_env},
"direct_access": { "direct_access": {
"random": random, "random": random,
} },
}, },
"subject": {}, "subject": {},
}, },

View File

@ -1,10 +1,11 @@
import os import os
import shutil import shutil
from pathlib import Path from pathlib import Path
from bopytex.worker.join_pdf import pdfjam
import pytest import pytest
from bopytex.worker.join_pdf import pdfjam
@pytest.fixture @pytest.fixture
def multiple_pdf(tmp_path, request): def multiple_pdf(tmp_path, request):