Skip to content

Release v0.4.0. #60

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

Merged
merged 21 commits into from
Oct 7, 2023
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
18 changes: 7 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,18 @@ jobs:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-tinytex@v2
if: runner.os != 'Windows'
- uses: conda-incubator/setup-miniconda@v2
- uses: actions/setup-python@v4
with:
auto-update-conda: false
python-version: ${{ matrix.python-version }}
channels: conda-forge,nodefaults
miniforge-variant: Mambaforge

- name: Install core dependencies.
shell: bash -l {0}
run: mamba install -c conda-forge tox-conda coverage
cache: pip
allow-prereleases: true
- run: pip install tox

# Unit, integration, and end-to-end tests.

Expand All @@ -51,7 +47,7 @@ jobs:
run: tox -e pytest -- -m "unit or (not integration and not end_to_end)" --cov=./ --cov-report=xml -n auto

- name: Upload coverage report for unit tests and doctests.
if: runner.os == 'Linux' && matrix.python-version == '3.8'
if: runner.os == 'Linux' && matrix.python-version == '3.10'
shell: bash -l {0}
run: bash <(curl -s https://codecov.io/bash) -F unit -c

Expand All @@ -60,6 +56,6 @@ jobs:
run: tox -e pytest -- -m end_to_end --cov=./ --cov-report=xml -n auto

- name: Upload coverage reports of end-to-end tests.
if: runner.os == 'Linux' && matrix.python-version == '3.8'
if: runner.os == 'Linux' && matrix.python-version == '3.10'
shell: bash -l {0}
run: bash <(curl -s https://codecov.io/bash) -F end_to_end -c
6 changes: 1 addition & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,10 @@ repos:
rev: 'v1.5.1'
hooks:
- id: mypy
args: [
--no-strict-optional,
--ignore-missing-imports,
]
additional_dependencies: [
attrs>=21.3.0,
click,
pytask,
pytask>=0.4.0,
types-PyYAML,
types-setuptools
]
Expand Down
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ This is a record of all past pytask-latex releases and what went into them in re
chronological order. Releases follow [semantic versioning](https://semver.org/) and all
releases are available on [Anaconda.org](https://anaconda.org/conda-forge/pytask-latex).

## 0.4.0 - 2023-10-07

- {pull}`60` updates the package to use pytask v0.4.0.

## 0.3.0 - 2022-12-xx

- {pull}`49` removes support for INI configurations.
Expand Down
45 changes: 30 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ popular LaTeX distributions, like [TeX Live](https://www.tug.org/texlive/),
Compiling your PDF can be as simple as writing the following task.

```python
from pathlib import Path
import pytask


@pytask.mark.latex(script="document.tex", document="document.pdf")
@pytask.mark.latex(script=Path("document.tex"), document=Path("document.pdf"))
def task_compile_latex_document():
pass
```
Expand All @@ -64,11 +65,24 @@ task module to the LaTeX file and the compiled document.

### Dependencies and Products

Dependencies and products can be added as with a normal pytask task using the
`@pytask.mark.depends_on` and `@pytask.mark.produces` decorators. which is explained in
this
Dependencies and products can be added as usual. Read this
[tutorial](https://pytask-dev.readthedocs.io/en/stable/tutorials/defining_dependencies_products.html).

For example, with the `@pytask.task` decorator. (The choice of the kwarg name, here
`path`, is arbitrary.)

```python
import pytask
from pytask import task
from pathlib import Path


@task(kwargs={"path": Path("path_to_another_dependency.tex")})
@pytask.mark.latex(script=Path("document.tex"), document=Path("document.pdf"))
def task_compile_latex_document():
pass
```

### Customizing the compilation

pytask-latex uses latexmk by default to compile the document because it handles most
Expand All @@ -77,8 +91,8 @@ decorator.

```python
@pytask.mark.latex(
script="document.tex",
document="document.pdf",
script=Path("document.tex"),
document=Path("document.pdf"),
compilation_steps="latexmk",
)
def task_compile_latex_document():
Expand All @@ -95,8 +109,8 @@ from pytask_latex import compilation_steps as cs


@pytask.mark.latex(
script="document.tex",
document="document.pdf",
script=Path("document.tex"),
document=Path("document.pdf"),
compilation_steps=cs.latexmk(
options=("--pdf", "--interaction=nonstopmode", "--synctex=1", "--cd")
),
Expand All @@ -113,8 +127,8 @@ an example for generating a `.dvi`.

```python
@pytask.mark.latex(
script="document.tex",
document="document.pdf",
script=Path("document.tex"),
document=Path("document.pdf"),
compilation_steps=cs.latexmk(
options=("--dvi", "--interaction=nonstopmode", "--synctex=1", "--cd")
),
Expand Down Expand Up @@ -157,23 +171,24 @@ The following task compiles two latex documents.
for i in range(2):

@pytask.mark.task
@pytask.mark.latex(script=f"document_{i}.tex", document=f"document_{i}.pdf")
@pytask.mark.latex(
script=Path(f"document_{i}.tex"), document=Path(f"document_{i}.pdf")
)
def task_compile_latex_document():
pass
```

If you want to compile the same document with different command line options, you have
to include the latex decorator in the parametrization just like with
`@pytask.mark.depends_on` and `@pytask.mark.produces`. Pass a dictionary for possible
to include the latex decorator in the parametrization. Pass a dictionary for possible
compilation steps and their options.

```python
for format_ in ("pdf", "dvi"):

@pytask.mark.task
@pytask.mark.latex(
script="document.tex",
document=f"document.{format_}",
script=Path("document.tex"),
document=Path(f"document.{format_}"),
compilation_steps=cs.latexmk(
(f"--{format_}", "--interaction=nonstopmode", "--synctex=1", "--cd")
),
Expand Down
7 changes: 4 additions & 3 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: pytask-latex

channels:
- conda-forge/label/pytask_rc
- conda-forge/label/pytask_parallel_rc
- conda-forge
- nodefaults

Expand All @@ -11,10 +13,9 @@ dependencies:
- toml

# Package dependencies
- pytask >= 0.3
- pytask-parallel >= 0.3
- pytask >= 0.4.0
- pytask-parallel >= 0.4.0
- latex-dependency-scanner >=0.1.1
- pybaum >=0.1.1

# Misc
- black
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ convention = "numpy"

[tool.pytest.ini_options]
# Do not add src since it messes with the loading of pytask-parallel as a plugin.
testpaths = ["test"]
testpaths = ["tests"]
markers = [
"wip: Tests that are work-in-progress.",
"unit: Flag for unit tests which target mainly a single function.",
Expand Down
5 changes: 2 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ project_urls =
[options]
packages = find:
install_requires =
click
latex-dependency-scanner>=0.1.1
pybaum>=0.1.1
pytask>=0.3
pluggy>=1.0.0
pytask>=0.4.0
python_requires = >=3.8
include_package_data = True
package_dir = =src
Expand Down
Loading