From 5de33f58235bffb7a791bbe65ce14e0cf93c5713 Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Sat, 18 Sep 2021 16:55:46 +0100 Subject: [PATCH] Fix CONTRIBUTING template For some reason Jinja2 substitutions don't seem to work when rendering the markdown templates even when the myst extension is active. This change improves the template having that concern in mind. --- .../markdown/templates/contributing.template | 103 +++++++----------- 1 file changed, 42 insertions(+), 61 deletions(-) diff --git a/src/pyscaffoldext/markdown/templates/contributing.template b/src/pyscaffoldext/markdown/templates/contributing.template index ee1e040..c6e3aea 100644 --- a/src/pyscaffoldext/markdown/templates/contributing.template +++ b/src/pyscaffoldext/markdown/templates/contributing.template @@ -1,15 +1,7 @@ ---- -substitutions: - contribute_button: '"Create pull request"' - the_repository_service: GitHub - repository_url: https://github.com//${name} ---- - -```{eval-rst} -.. todo:: THIS IS SUPPOSED TO BE AN EXAMPLE. MODIFY IT ACCORDING TO YOUR NEEDS! +```{todo} THIS IS SUPPOSED TO BE AN EXAMPLE. MODIFY IT ACCORDING TO YOUR NEEDS! The document assumes you are using a source repository service that promotes a - contribution model similar to `GitHub's fork and pull request workflow`_. + contribution model similar to [GitHub's fork and pull request workflow]. While this is true for the majority of services (like GitHub, GitLab, BitBucket), it might not be the case for private repositories (e.g., when using Gerrit). @@ -22,42 +14,38 @@ substitutions: and update things accordingly. ``` -```{eval-rst} -.. todo:: Provide the correct links/replacements at the bottom of the document. +```{todo} Provide the correct links/replacements at the bottom of the document. ``` -```{eval-rst} -.. todo:: You might want to have a look on `PyScaffold's contributor's guide`_, +```{todo} You might want to have a look on [PyScaffold's contributor's guide], especially if your project is open source. The text should be very similar to this template, but there are a few extra contents that you might decide to also include, like mentioning labels of your issue tracker or automated releases. - ``` # Contributing Welcome to `${name}` contributor's guide. -This document focuses on getting any potential contributor familiarized -with the development processes, but [other kinds of contributions] are also -appreciated. +This document focuses on getting any potential contributor familiarized with +the development processes, but [other kinds of contributions] are also appreciated. If you are new to using [git] or have never collaborated in a project previously, please have a look at [contribution-guide.org]. Other resources are also listed in the excellent [guide created by FreeCodeCamp] [^contrib1]. Please notice, all users and contributors are expected to be **open, -considerate, reasonable, and respectful**. When in doubt, [Python Software -Foundation's Code of Conduct][python software foundation's code of conduct] is a good reference in terms of behavior -guidelines. +considerate, reasonable, and respectful**. When in doubt, +[Python Software Foundation's Code of Conduct] is a good reference in terms of +behavior guidelines. ## Issue Reports If you experience bugs or general issues with `${name}`, please have a look -on the [issue tracker]. If you don't see anything useful there, please feel -free to fire an issue report. +on the [issue tracker]. +If you don't see anything useful there, please feel free to fire an issue report. :::{tip} Please don't forget to include the closed issues in your search. @@ -80,32 +68,31 @@ by adding missing information and correcting mistakes. This means that the docs are kept in the same repository as the project code, and that any documentation update is done in the same way was a code contribution. -```{eval-rst} -.. todo:: Don't forget to mention which markup language you are using. +```{todo} Don't forget to mention which markup language you are using. - e.g., reStructuredText_ or CommonMark_ with MyST_ extensions. + e.g., [reStructuredText] or [CommonMark] with [MyST] extensions. ``` -```{eval-rst} -.. todo:: If your project is hosted on GitHub, you can also mention the following tip: +```{todo} If your project is hosted on GitHub, you can also mention the following tip: - .. tip:: - Please notice that the `GitHub web interface`_ provides a quick way of - propose changes in ``${name}``'s files. While this mechanism can + :::{tip} + Please notice that the [GitHub web interface] provides a quick way of + propose changes in `${name}`'s files. While this mechanism can be tricky for normal code contributions, it works perfectly fine for contributing to the docs, and can be quite handy. If you are interested in trying this method out, please navigate to - the ``docs`` folder in the source repository_, find which file you + the `docs` folder in the source [repository], find which file you would like to propose changes and click in the little pencil icon at the - top, to open `GitHub's code editor`_. Once you finish editing the file, + top, to open [GitHub's code editor]. Once you finish editing the file, please write a message in the form at the bottom of the page describing which changes have you made and what are the motivations behind them and submit your proposal. + ::: ``` When working on documentation changes in your local machine, you can -compile them using [tox]: +compile them using [tox] : ``` tox -e docs @@ -120,8 +107,7 @@ python3 -m http.server --directory 'docs/_build/html' ## Code Contributions -```{eval-rst} -.. todo:: Please include a reference or explanation about the internals of the project. +```{todo} Please include a reference or explanation about the internals of the project. An architecture description, design principles or at least a summary of the main concepts will make it easy for potential contributors to get started @@ -136,8 +122,8 @@ This often provides additional considerations and avoids unnecessary work. ### Create an environment -Before you start coding, we recommend creating an isolated [virtual -environment][virtual environment] to avoid any problems with your installed Python packages. +Before you start coding, we recommend creating an isolated [virtual environment] +to avoid any problems with your installed Python packages. This can easily be done via either [virtualenv]: ``` @@ -154,10 +140,10 @@ conda activate pyscaffold ### Clone the repository -1. Create an user account on {{ the_repository_service }} if you do not already have one. +1. Create an user account on GitHub if you do not already have one. 2. Fork the project [repository]: click on the *Fork* button near the top of the - page. This creates a copy of the code under your account on {{ the_repository_service }}. + page. This creates a copy of the code under your account on GitHub. 3. Clone this copy to your local disk: @@ -174,8 +160,7 @@ conda activate pyscaffold to be able run `putup --help`. - ```{eval-rst} - .. todo:: if you are not using pre-commit, please remove the following item: + ```{todo} if you are not using pre-commit, please remove the following item: ``` 5. Install [pre-commit]: @@ -212,8 +197,7 @@ conda activate pyscaffold to record your changes in [git]. - ```{eval-rst} - .. todo:: if you are not using pre-commit, please remove the following item: + ```{todo} if you are not using pre-commit, please remove the following item: ``` Please make sure to see the validation messages from [pre-commit] and fix @@ -248,17 +232,16 @@ conda activate pyscaffold ### Submit your contribution -1. If everything works fine, push your local branch to {{ the_repository_service }} with: +1. If everything works fine, push your local branch to the remote server with: ``` git push -u origin my-feature ``` -2. Go to the web page of your fork and click {{ contribute_button }} +2. Go to the web page of your fork and click "Create pull request" to send your changes for review. - ```{eval-rst} - .. todo:: if you are using GitHub, you can uncomment the following paragraph + ```{todo} if you are using GitHub, you can uncomment the following paragraph Find more detailed information `creating a PR`_. You might also want to open the PR as a draft first and mark it as ready for review after the feedbacks @@ -323,8 +306,7 @@ package: ### Releases -```{eval-rst} -.. todo:: This section assumes you are using PyPI to publicly release your package. +```{todo} This section assumes you are using PyPI to publicly release your package. If instead you are using a different/private package index, please update the instructions accordingly. @@ -336,7 +318,8 @@ on [PyPI], the following steps can be used to release a new version for 1. Make sure all unit tests are successful. 2. Tag the current commit on the main branch with a release tag, e.g., `v1.2.3`. -3. Push the new tag to the upstream [repository], e.g., `git push upstream v1.2.3` +3. Push the new tag to the upstream [repository], + e.g., `git push upstream v1.2.3` 4. Clean up the `dist` and `build` folders with `tox -e clean` (or `rm -rf dist build`) to avoid confusion with old builds and Sphinx docs. @@ -352,13 +335,6 @@ on [PyPI], the following steps can be used to release a new version for to collectively create software are general and can be applied to all sorts of environments, including private companies and proprietary code bases. -% <-- strart --> - -```{eval-rst} -.. todo:: Please review and change the following definitions: -``` - -% <-- end --> [black]: https://pypi.org/project/black/ [commonmark]: https://commonmark.org/ @@ -372,8 +348,7 @@ on [PyPI], the following steps can be used to release a new version for [github web interface]: https://docs.github.com/en/github/managing-files-in-a-repository/managing-files-on-github/editing-files-in-your-repository [github's code editor]: https://docs.github.com/en/github/managing-files-in-a-repository/managing-files-on-github/editing-files-in-your-repository [github's fork and pull request workflow]: https://guides.github.com/activities/forking/ -[guide created by freecodecamp]: https://github.com/FreeCodeCamp/how-to-contribute-to-open-source -[issue tracker]: {{ repository_url }}/issues +[guide created by freecodecamp]: https://github.com/freecodecamp/how-to-contribute-to-open-source [miniconda]: https://docs.conda.io/en/latest/miniconda.html [myst]: https://myst-parser.readthedocs.io/en/latest/syntax/syntax.html [other kinds of contributions]: https://opensource.guide/how-to-contribute @@ -382,9 +357,15 @@ on [PyPI], the following steps can be used to release a new version for [pyscaffold's contributor's guide]: https://pyscaffold.org/en/stable/contributing.html [pytest can drop you]: https://docs.pytest.org/en/stable/usage.html#dropping-to-pdb-python-debugger-at-the-start-of-a-test [python software foundation's code of conduct]: https://www.python.org/psf/conduct/ -[repository]: {{ repository_url }} [restructuredtext]: https://www.sphinx-doc.org/en/master/usage/restructuredtext/ [sphinx]: https://www.sphinx-doc.org/en/master/ [tox]: https://tox.readthedocs.io/en/stable/ [virtual environment]: https://realpython.com/python-virtual-environments-a-primer/ [virtualenv]: https://virtualenv.pypa.io/en/stable/ + + +```{todo} Please review and change the following definitions: +``` + +[repository]: https://github.com//${name} +[issue tracker]: https://github.com//${name}/issues