+{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"bootstrap-python-package","text":"<p>This template repository provides the boilerplate to create a python package. It is configured with all the following features:</p> <ul> <li>Test suite using pytest</li> <li>Typing using mypy</li> <li>Linting using ruff</li> <li>Code formatter using black</li> <li>Security checks using bandit</li> <li>Integration with CodeClimate for code quality and coverage checks</li> <li>CI pipeline supporting:<ul> <li>testing against multiple python versions</li> <li>releases on PyPI</li> <li>GitHub pages documentation using mkdocs</li> </ul> </li> </ul>"},{"location":"#how-to-use-this-repository-template-to-create-a-new-package","title":"How to use this repository template to create a new package","text":"<ul> <li>Create your github repository using this template. (The big green <code>Use this template</code> button)</li> <li>Rename the <code>bootstrap_python_package</code> directory</li> <li>Search and replace all the occurrences of <code>bootstrap-python-package</code> and <code>bootstrap_python_package</code></li> <li>Configure a pending trusted publisher on pypi using the following values:<ul> <li>PyPI Project Name: what you renamed the directory <code>bootstrap_python_package</code> to (Double check <code>_</code> and <code>-</code>)</li> <li>Owner: The github repository owner (in this case <code>febus982</code>)</li> <li>Repository name: The github repository name (in this case <code>bootstrap-python-package</code>)</li> <li>Workflow name: <code>release.yml</code></li> </ul> </li> <li>Create a GitHub Actions secret named <code>CODECLIMATE_REPORTER_ID</code> (at URL <code>https://github.com/GITHUB_NAME_OR_ORGANIZATION/GITHUB_REPOSITORY/settings/secrets/actions</code>) containing the codeclimate reporter id (you can find it at <code>https://codeclimate.com/repos/YOUR_REPO_ID/settings/test_reporter</code>). If you don't want to use CodeClimate just delete <code>workflows/python-quality.yml</code>.</li> <li>Update the badges in <code>README.md</code>! (check shields.io for extra badges)</li> <li>Setup local development:<ul> <li>Clone the repository</li> <li>Install poetry <code>pip install poetry</code></li> <li>Install dev dependencies with <code>make dev-dependencies</code></li> <li>(optional) It is strongly recommended to install pre-commit and run <code>pre-commit install</code> so that formatting and linting are automatically executed during <code>git commit</code>.</li> </ul> </li> <li>Setup GitHub pages (this need local development setup):<ul> <li>Initialise documentation branch <code>poetry run mike deploy dev latest --update-aliases --push</code></li> <li>Configure GitHub Pages to deploy from the <code>gh-pages</code> branch (at URL <code>https://github.com/GITHUB_NAME_OR_ORGANIZATION/GITHUB_REPOSITORY/settings/pages</code>)</li> <li>Add the <code>main</code> branch and the <code>v*.*.*</code> tag rules to the \"deployment branches and tags\" list in the <code>gh-pages</code> environment (at URL <code>https://github.com/GITHUB_NAME_OR_ORGANIZATION/GITHUB_REPOSITORY/settings/environments</code>)</li> </ul> </li> </ul> <p>IMPORTANT: The repository is configured to deploy on the test PyPI repository. It's strongly recommended to create the project in the test PyPI repository and test the deployment pipeline. When you're happy with the result, create the project on the official PyPI repository and remove the marked lines in <code>workflows/release.yml</code>.</p>"},{"location":"#package-release","title":"Package release","text":"<p>This setup uses poetry-dynamic-versioning. This means it's not necessary to commit the version in the code but the CI pipeline will infer it from the git tag.</p> <p>To release a new version, just create a new release and tag in the GitHub repository, to:</p> <ul> <li>Build and deploy the python package to PyPI</li> <li>Build and deploy a new version of the documentation to GitHub pages</li> </ul> <p>IMPORTANT: The default configuration requires the release name and the tag to follow the convention <code>vX.X.X</code> (semantic versioning preceded by lowercase <code>v</code>). It will publish the correct version on Pypi, omitting the <code>v</code> (ie. <code>v1.0.0</code> will publish <code>1.0.0</code>).</p> <p>This format can be customized, refer to poetry-dynamic-versioning docs</p>"},{"location":"#commands-for-development","title":"Commands for development","text":"<p>All the common commands used during development can be run using make targets:</p> <ul> <li><code>make dev-dependencies</code>: Install dev requirements</li> <li><code>make update-dependencies</code>: Update dev requirements</li> <li><code>make fix</code>: Run code style and lint automatic fixes (where possible)</li> <li><code>make test</code>: Run test suite against system python version</li> <li><code>make check</code>: Run tests against all available python versions, code style and lint checks</li> <li><code>make type</code>, <code>make format</code>, <code>make lint</code>, <code>make bandit</code>: Run the relevant check</li> <li><code>make docs</code>: Render the mkdocs website locally</li> </ul>"},{"location":"API-Reference/","title":"Index","text":""},{"location":"API-Reference/#bootstrap_python_package.some_function","title":"<code>some_function()</code>","text":"<p>Some function docstring</p> RETURNS DESCRIPTION <code>str</code> <p>Some string</p> Source code in <code>bootstrap_python_package/__init__.py</code> <pre><code>def some_function() -> str:\n \"\"\"\n Some function docstring\n\n :return: Some string\n :rtype: str\n \"\"\"\n return \"some_variable_to_test\"\n</code></pre>"}]}
0 commit comments