Skip to content

Commit

Permalink
Update task files for docs visualizations
Browse files Browse the repository at this point in the history
  • Loading branch information
timmens committed Jun 28, 2024
1 parent fc331f5 commit fd0a0ee
Show file tree
Hide file tree
Showing 16 changed files with 95 additions and 256 deletions.
18 changes: 9 additions & 9 deletions docs/scripts/latex/root_bld_src.tex
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@
]
{
\nodepart{one}
\begin{small}
\begin{footnotesize}
project root
\end{small}
\end{footnotesize}
\nodepart{two}
\texttt{bld}
\nodepart{three}
\texttt{\{project\_slug\}.pdf}
\texttt{template\_project.pdf}
\nodepart{four}
\texttt{\{project\_slug\}\_pres.pdf}
\texttt{template\_project\_pres.pdf}
\nodepart{five}
\texttt{src}
\nodepart{six}
Expand All @@ -62,9 +62,9 @@
]
{
\nodepart{one}
\begin{small}
\begin{footnotesize}
bld/python
\end{small}
\end{footnotesize}
\nodepart{two}
\texttt{data}
\nodepart{three}
Expand Down Expand Up @@ -97,9 +97,9 @@
]
{
\nodepart{one}
\begin{small}
src/\{project\_slug\}
\end{small}
\begin{footnotesize}
src/template\_project
\end{footnotesize}
\nodepart{two}
\texttt{analysis}
\nodepart{three}
Expand Down
18 changes: 9 additions & 9 deletions docs/scripts/latex/src.tex
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
]
{
\nodepart{one}
\begin{small}
src/\{project\_slug\}
\end{small}
\begin{footnotesize}
src/template\_project
\end{footnotesize}
\nodepart{two}
\texttt{analysis}
\nodepart{three}
Expand Down Expand Up @@ -66,9 +66,9 @@
]
{
\nodepart{one}
\begin{small}
\begin{footnotesize}
data\_management
\end{small}
\end{footnotesize}
\nodepart{two}
\texttt{\_\_init\_\_.py}
\nodepart{three}
Expand All @@ -92,9 +92,9 @@
]
{
\nodepart{one}
\begin{small}
\begin{footnotesize}
analysis
\end{small}
\end{footnotesize}
\nodepart{two}
\texttt{\_\_init\_\_.py}
\nodepart{three}
Expand All @@ -117,9 +117,9 @@
]
{
\nodepart{one}
\begin{small}
\begin{footnotesize}
final
\end{small}
\end{footnotesize}
\nodepart{two}
\texttt{\_\_init\_\_.py}
\nodepart{three}
Expand Down
2 changes: 1 addition & 1 deletion docs/scripts/task_create_visualization_for_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import plotly.graph_objects as go
import pytask

DOCS = Path(__file__).parent.parent.parent.resolve() # root/docs
DOCS = Path(__file__).parent.parent.resolve() # root/docs
DOCS_SCRIPTS = DOCS / "scripts"
FIGURES = DOCS / "source" / "figures" / "generated"

Expand Down
57 changes: 29 additions & 28 deletions docs/source/development/how-to-contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,52 @@ for some immediate and clearly defined tasks.

```console
$ conda env create -f environment.yml
$ conda activate cp
$ conda activate template_project
```

1. Implement the fix or new feature. If you work on the *inner project* please read
about our recommend workflow in the next section. There we also explain what the
*inner project* is.
1. In case you work on the documentation, you also have to install and activate the
documentation environment:

```console
$ conda env create -f docs/rtd_environment.yml
$ conda activate ept-docs
```

You can build the documentation using

```console
$ cd docs
$ make html
```

The newly created documentation can be opened using (replace "browser" with your browser
of choice)

```console
$ browser docs/build/html/index.html
```

1. Implement the fix or new feature.

1. We validate contributions in three ways. First, we have a test suite to check the
implementation the templates. Second, we correct for stylistic errors in code and
documentation using linters. Third, we test whether the documentation builds
implementation of the template project. Second, we correct for stylistic errors in
code and documentation using linters. Third, we test whether the documentation builds
successfully.

You can run all checks with `pytest` by running
You can run the checks on the template project with `pytest` by running

```console
$ pytest
```

This will run the complete test suite.

Correct any errors displayed in the terminal.
You should correct any errors displayed in the terminal.

To correct stylistic errors, you can also install the linters as a pre-commit with

```console
$ conda activate template_project
$ pre-commit install
```

Expand All @@ -71,23 +92,3 @@ for some immediate and clearly defined tasks.
your changes.

1. The final PR will be merged by one of the main contributors.

## Working on the inner project

We differentiate between the *inner project*, which is the template project located in
template_project, and the *outer project*, which is everything else.

To work on the inner project we recommend the following workflow:

1. Use `cookiecutter econ-project-templates` locally to create an template project

1. Create a conda environment in this local template project

1. Make sure that pytask builds the template project and that the tests run

1. Apply changes to the template project

1. Repeat step 3

1. Transfer changes to the official repository by changing example names to
template_project etc.
26 changes: 0 additions & 26 deletions docs/source/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,32 +107,6 @@ of choice.

1. Press `Return` and then `ctrl+o` (= WriteOut = save) and `Return` once more.

(cookiecutter_trouble)=

### When cookiecutter exits with an error

If cookiecutter fails, you will get a lengthy error message. It is important that you
work through this and try to understand the error (the language used might seem funny,
but it is precise...).

Then type:

```bash
$ code ~/.cookiecutter_replay/econ-project-templates-0.7.1.json
```

If you are not using VS Code as your editor of choice, adjust the line accordingly.

This command should open your editor and show you a json file containing your answers to
the previously filled out dialogue. You can fix your faulty settings in this file. If
you have spaces or special characters in your path, you need to adjust your path.

When done, launch a new shell if necessary and type:

```bash
$ cookiecutter --replay https://github.com/OpenSourceEconomics/econ-project-templates/archive/v0.7.1.zip
```

(stata_failure_check_erase_log_file)=

### Stata failure: FileNotFoundError
Expand Down
Binary file modified docs/source/figures/generated/root_bld_src.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/figures/generated/src.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
136 changes: 0 additions & 136 deletions docs/source/getting_started/cookiecutter_dialogue.md

This file was deleted.

15 changes: 8 additions & 7 deletions docs/source/getting_started/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ want to jump to any of the sections in this part of the documentation:
- In {ref}`preparing_your_system`, we describe what needs to be installed on your
computer so that you can use the templates.
- Should you have done that already for a different project, you can directly go to
{ref}`cookiecutter_dialogue`, which describes the options you have when moving from
the template to your specific research project.
{ref}`template_setup`, which describes how to customize the template to your specific
research project.
- In case a project has been set up by you or a collaborator and you want to use it on a
different machine as well, you will find the explanations on how to do so in
{ref}`second_machine`.

Once you are set up in this fashion, you may want to read up on the background of the
{ref}`background`. In case you know those already, have a look in
{ref}`guides_explanations` for guides on starting new projects or porting existing ones.
Once you are set up in this fashion, you may want to read up on some additional
information in the {ref}`background` section. In case you know those already, have a
look in {ref}`guides_explanations` for guides on starting new projects or porting
existing ones.

(preparing_your_system)=

Expand All @@ -25,11 +26,11 @@ Once you are set up in this fashion, you may want to read up on the background o
```{include} preparing_your_system.md
```

(cookiecutter_dialogue)=
(template_setup)=

## Customising the template for your needs

```{include} cookiecutter_dialogue.md
```{include} template_setup.md
```

(second_machine)=
Expand Down
Loading

0 comments on commit fd0a0ee

Please sign in to comment.