Skip to content

Commit 94544d3

Browse files
authored
Move everything to markdown. (#18)
1 parent e63c617 commit 94544d3

23 files changed

+366
-206
lines changed

.pre-commit-config.yaml

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ repos:
2828
- id: python-no-eval
2929
- id: python-no-log-warn
3030
- id: python-use-type-annotations
31-
- id: rst-backticks
32-
- id: rst-directive-colons
33-
- id: rst-inline-touching-normal
3431
- id: text-unicode-replacement-char
3532
- repo: https://github.com/asottile/pyupgrade
3633
rev: v2.32.0
@@ -45,11 +42,6 @@ repos:
4542
rev: 22.3.0
4643
hooks:
4744
- id: black
48-
- repo: https://github.com/asottile/blacken-docs
49-
rev: v1.12.1
50-
hooks:
51-
- id: blacken-docs
52-
additional_dependencies: [black]
5345
- repo: https://github.com/PyCQA/flake8
5446
rev: 4.0.1
5547
hooks:
@@ -70,10 +62,6 @@ repos:
7062
pydocstyle,
7163
Pygments,
7264
]
73-
- repo: https://github.com/PyCQA/doc8
74-
rev: 0.11.1
75-
hooks:
76-
- id: doc8
7765
- repo: https://github.com/econchick/interrogate
7866
rev: 1.5.0
7967
hooks:
@@ -86,6 +74,31 @@ repos:
8674
"{{cookiecutter.project_slug}}"
8775
]
8876
pass_filenames: false
77+
- repo: https://github.com/executablebooks/mdformat
78+
rev: 0.7.14
79+
hooks:
80+
- id: mdformat
81+
additional_dependencies: [
82+
mdformat-gfm,
83+
mdformat-black,
84+
]
85+
args: [--wrap, "88"]
86+
files: (README\.md)
87+
- repo: https://github.com/executablebooks/mdformat
88+
rev: 0.7.14
89+
hooks:
90+
- id: mdformat
91+
additional_dependencies: [
92+
mdformat-myst,
93+
mdformat-black,
94+
]
95+
args: [--wrap, "88"]
96+
files: (docs/.)
97+
# Exclude files with admonitions.
98+
# exclude: |
99+
# (?x)^(
100+
# path/to/file.py
101+
# )$
89102
- repo: https://github.com/codespell-project/codespell
90103
rev: v2.1.0
91104
hooks:

README.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# cookiecutter-pytask-project
2+
3+
[![MIT license](https://img.shields.io/github/license/pytask-dev/cookiecutter-pytask-project)](https://github.com/pytask-dev/cookiecutter-pytask-project)
4+
[![image](https://readthedocs.org/projects/cookiecutter-pytask-project/badge/?version=latest)](https://cookiecutter-pytask-project.readthedocs.io/en/latest)
5+
[![image](https://img.shields.io/github/workflow/status/pytask-dev/cookiecutter-pytask-project/main/main)](https://github.com/pytask-dev/cookiecutter-pytask-project/actions?query=branch%3Amain)
6+
[![image](https://codecov.io/gh/pytask-dev/cookiecutter-pytask-project/branch/main/graph/badge.svg)](https://codecov.io/gh/pytask-dev/cookiecutter-pytask-project)
7+
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/pytask-dev/cookiecutter-pytask-project/main.svg)](https://results.pre-commit.ci/latest/github/pytask-dev/cookiecutter-pytask-project/main)
8+
[![image](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
9+
10+
This repository contains a minimal cookiecutter template for a project with
11+
[pytask](https://github.com/pytask-dev/pytask).
12+
13+
## Usage
14+
15+
First, install cookiecutter.
16+
17+
```console
18+
$ pip install cookiecutter
19+
20+
$ conda install -c conda-forge cookiecutter
21+
```
22+
23+
Then, set up the template with
24+
25+
```console
26+
$ cookiecutter https://github.com/pytask-dev/cookiecutter-pytask-project
27+
```
28+
29+
## Documentation
30+
31+
If you are new to pytask, just follow the
32+
[tutorials](https://pytask-dev.readthedocs.io/en/stable/tutorials/index.html) which will
33+
help you with your first steps like how to write the first task.
34+
35+
If you are already familiar with pytask, the
36+
[how-to guides](https://pytask-dev.readthedocs.io/en/stable/how_to_guides/index.html)
37+
offer more in-depth guidance on complex projects.
38+
39+
In general, you will find most guidance in the
40+
[documentation](https://pytask-dev.readthedocs.io/en/stable/index.html) and some advice
41+
in the FAQ below.
42+
43+
## FAQ
44+
45+
Q: Why are the source files nested in `src/<project_slug>`?
46+
47+
A: This is called the src layout and the advantages are discussed in this
48+
[article by Hynek Schlawack](https://hynek.me/articles/testing-packaging/).
49+
50+
Although the article discusses the src layout in terms of Python packages, it is also
51+
beneficial to structure a project the same way. Next to the reasons discussed there, it
52+
is possible to use a single Python environment for multiple projects without messing
53+
with your PYTHONPATH (via `pip install -e .` or `conda develop .`) each time and still
54+
import modules.
55+
56+
Q: My project is a Python package, but it does not seem to have a version. Where is it?
57+
58+
A: The cookiecutter uses [setuptools_scm](https://github.com/pypa/setuptools_scm/) to
59+
manage the version number. When you install your created project as a Python package
60+
with `pip install -e .`, setuptools_scm tries to infer the version number from the tags
61+
created on the repo.
62+
63+
For example, if you have switched to a commit associated with the tag `v0.2.0`,
64+
setuptools_scm will create a `src/<package_slug>/_version.py` with a variable containing
65+
`version = '0.2.0'` which you can use in your `src/<package_slug>/__init__.py`. If you
66+
are one commit ahead of the tag, you version will be something like `0.2.0.dev1+...`
67+
indicating you are one commit ahead of the tag `v0.2.0`.
68+
69+
If you want to switch to the tradition setup, replace the following code in your
70+
`pyproject.toml`
71+
72+
```toml
73+
[build-system]
74+
requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.0"]
75+
```
76+
77+
with
78+
79+
```toml
80+
[build-system]
81+
requires = ["setuptools"]
82+
build-backend = "setuptools.build_meta"
83+
```

README.rst

Lines changed: 0 additions & 59 deletions
This file was deleted.

docs/rtd_environment.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ dependencies:
1212
- furo
1313
- ipython
1414
- nbsphinx
15+
- myst-parser
1516
- sphinx
1617
- sphinx-autoapi
1718
- sphinx-copybutton
1819
- sphinx-panels
1920

2021
- pip:
21-
- -e ../
22+
- ../
23+
- sphinxext-opengraph
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
API Reference
2-
=============
1+
# API Reference
32

43
The following documents are auto-generated and not carefully edited. They provide direct
54
access to the source code and the docstrings.
65

7-
.. toctree::
8-
:titlesonly:
9-
10-
/autoapi/pre_gen_project/index
11-
/autoapi/post_gen_project/index
6+
```{toctree}
7+
---
8+
titlesonly: true
9+
---
10+
/autoapi/pre_gen_project/index
11+
/autoapi/post_gen_project/index
12+
```

docs/source/changes.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Changes
2+
3+
This is a record of all past cookiecutter-pytask-project releases and what went into
4+
them in reverse chronological order.
5+
6+
## 1.2.0 - 2022-xx-xx
7+
8+
- {pull}`7` skips concurrent CI builds.
9+
- {pull}`8` harmonizes cookiecutter-pytask-project with econ-project-templates.
10+
- {pull}`9` deprecates Python 3.6, add support for Python 3.10 and add mypy optionally.
11+
- {pull}`12` removes `LICENSE` from `MANIFEST.in` if no license is selected.
12+
- {pull}`13` adds a `.gitignore`.
13+
- {pull}`14` adds a `CITATION`.
14+
- {pull}`15` cancels concurrent CI jobs.
15+
- {pull}`18` fixes {issue}`17` and moves rst to markdown.
16+
17+
## 1.1.0 - 2022-01-16
18+
19+
- {pull}`4` renames the cookiecutter from cookiecutter-pytask to
20+
cookiecutter-pytask-project to avoid confusion with the cookiecutter for plugins. And
21+
remove unnecessary packaging stuff.
22+
23+
## 1.0.0 - 2022-01-05
24+
25+
- {pull}`1` creates first release of a minimal cookiecutter template for a pytask
26+
project.
27+
- {pull}`2` adds more tests.

docs/source/changes.rst

Lines changed: 0 additions & 27 deletions
This file was deleted.

docs/source/conf.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@
3232
"sphinx.ext.extlinks",
3333
"sphinx.ext.intersphinx",
3434
"sphinx.ext.napoleon",
35+
"sphinxext.opengraph",
3536
"sphinx.ext.viewcode",
3637
"sphinx_copybutton",
3738
"sphinx_panels",
3839
"autoapi.extension",
40+
"myst_parser",
3941
]
4042

4143
# Add any paths that contain templates here, relative to this directory.
@@ -57,9 +59,12 @@
5759
copybutton_prompt_is_regexp = True
5860

5961
# Use these roles to create links to github users and pull requests.
62+
_repo = "https://github.com/pytask-dev/cookiecutter-pytask-project"
6063
extlinks = {
61-
"ghuser": ("https://github.com/%s", "@"),
62-
"gh": ("https://github.com/pytask-dev/cookiecutter-pytask-project/pull/%s", "#"),
64+
"pypi": ("https://pypi.org/project/%s/", ""),
65+
"issue": (f"{_repo}/issues/%s", "issue #"),
66+
"pull": (f"{_repo}/pull/%s", "pull request #"),
67+
"user": ("https://github.com/%s", "@"),
6368
}
6469

6570
# Link objects to other documentations.
@@ -68,6 +73,9 @@
6873
"pytask": ("https://pytask-dev.readthedocs.io/en/stable/", None),
6974
}
7075

76+
# MyST
77+
myst_enable_extensions = []
78+
7179

7280
# -- Options for HTML output -------------------------------------------------
7381

docs/source/faq.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# FAQ
2+
3+
Q: Why are the source files nested in `src/<project_slug>`?
4+
5+
A: This is called the src layout and the advantages are discussed in this
6+
[article by Hynek Schlawack](https://hynek.me/articles/testing-packaging/).
7+
8+
Although the article discusses the src layout in terms of Python packages, it is also
9+
beneficial to structure a project the same way. Next to the reasons discussed there, it
10+
is possible to use a single Python environment for multiple projects without messing
11+
with your PYTHONPATH (via `pip install -e .` or `conda develop .`) each time and still
12+
import modules.
13+
14+
Q: My project is a Python package, but it does not seem to have a version. Where is it?
15+
16+
A: The cookiecutter uses [setuptools_scm](https://github.com/pypa/setuptools_scm/) to
17+
manage the version number. When you install your created project as a Python package
18+
with `pip install -e .`, setuptools_scm tries to infer the version number from the tags
19+
created on the repo.
20+
21+
For example, if you have switched to a commit associated with the tag `v0.2.0`,
22+
setuptools_scm will create a `src/<package_slug>/_version.py` with a variable containing
23+
`version = '0.2.0'` which you can use in your `src/<package_slug>/__init__.py`. If you
24+
are one commit ahead of the tag, you version will be something like `0.2.0.dev1+...`
25+
indicating you are one commit ahead of the tag `v0.2.0`.
26+
27+
If you want to switch to the tradition setup, replace the following code in your
28+
`pyproject.toml`
29+
30+
```toml
31+
[build-system]
32+
requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.0"]
33+
```
34+
35+
with
36+
37+
```toml
38+
[build-system]
39+
requires = ["setuptools"]
40+
build-backend = "setuptools.build_meta"
41+
```

0 commit comments

Comments
 (0)