{"id":22064478,"url":"https://github.com/josef-friedrich/python-boilerplate","last_synced_at":"2025-03-23T18:13:22.066Z","repository":{"id":45286179,"uuid":"513470877","full_name":"Josef-Friedrich/python-boilerplate","owner":"Josef-Friedrich","description":"A collection of boilerplate files and templates for my Python projects","archived":false,"fork":false,"pushed_at":"2025-02-09T20:32:34.000Z","size":3578,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-09T21:27:50.658Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://josef-friedrich.github.io/python-project-boilerplate/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Josef-Friedrich.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-13T10:06:14.000Z","updated_at":"2025-02-09T20:32:38.000Z","dependencies_parsed_at":"2023-12-26T10:23:20.149Z","dependency_job_id":"0aeb37c9-195b-4a65-89e7-02279dec5449","html_url":"https://github.com/Josef-Friedrich/python-boilerplate","commit_stats":null,"previous_names":["josef-friedrich/python-boilerplate"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Josef-Friedrich%2Fpython-boilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Josef-Friedrich%2Fpython-boilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Josef-Friedrich%2Fpython-boilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Josef-Friedrich%2Fpython-boilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Josef-Friedrich","download_url":"https://codeload.github.com/Josef-Friedrich/python-boilerplate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245144973,"owners_count":20568056,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-30T19:11:39.083Z","updated_at":"2025-03-23T18:13:22.033Z","avatar_url":"https://github.com/Josef-Friedrich.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":".. image:: http://img.shields.io/pypi/v/python-boilerplate.svg\n    :target: https://pypi.org/project/python-boilerplate\n    :alt: This package on the Python Package Index\n\n.. image:: https://github.com/Josef-Friedrich/python-boilerplate/actions/workflows/tests.yml/badge.svg\n    :target: https://github.com/Josef-Friedrich/python-boilerplate/actions/workflows/tests.yml\n    :alt: Tests\n\npython_boilerplate\n==================\n\nA collection of boilerplate files and templates for my Python projects.\n\nMaybe we should use:\nhttps://github.com/cookiecutter/cookiecutter\n\nPoetry\n------\n\nansible-playbook playbook/all/p/poetry.yml\n\n~/.config/pypoetry/config.toml\n\n.. code-block:: toml\n\n    virtualenvs.in-project = true\n\nRuff\n----\n\npipx install ruff\n\nhttps://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff\n\nVersion\n-------\n\n``poetry version \u003crule\u003e``\n\nhttps://python-poetry.org/docs/cli/#version\n\n.. code-block:: python\n\n    from importlib import metadata\n    __version__ = metadata.version('python_boilerplate')\n\nbump2version\n^^^^^^^^^^^^\n\n``.bumpversion.cfg```\n\n.. code-block:: ini\n\n    [bumpversion]\n    commit = True\n    tag = True\n    current_version = 0.1.0\n\n    [bumpversion:file:pyproject.toml]\n    search = version = \"{current_version}\"\n    replace = version = \"{new_version}\"\n\n    [bumpversion:file:python_boilerplate/__init__.py]\n    search = __version__ = '{current_version}'\n    replace = __version__ = '{new_version}'\n\nTest\n----\n\nPlace the test files in a folder named ``tests``. ``poetry new``\ncreates a so called folder. Most projects use this named for the\ntest folder.\n\npytest\n^^^^^^\n\nConvert unittests to pytest using `pytestify \u003chttps://github.com/dannysepler/pytestify\u003e`_.\n\nlittlefoxteam.vscode-python-test-adapter\n\npyright\n^^^^^^^\n\n.. code-block:: toml\n\n    [tool.pyright]\n    reportPrivateUsage = false\n    reportPrivateUsage = false\n    reportUnusedExpression = false\n    reportInvalidStringEscapeSequence = false\n\npyenv\n^^^^^\n\n::\n\n    pyenv-enable.sh\n    pyenv update\n    pyenv install --list | grep \" 3.\"\n    pyenv install 3.8.13\n    pyenv install 3.9.13\n    pyenv install 3.11.0b4\n    pyenv local 3.8.13 3.9.13 3.11.0b4\n    pip install tox tox-pyenv\n    tox\n    pyenv-disable.sh\n\nRun a single test\n\n::\n\n    tox -e quick -- -s test test_job.TestJobWithConfigParser.test_source\n\nPublish\n-------\n\nPublish to PyPI\n\n.. code-block:: shell\n\n    # https://pypi.org/manage/account/token/\n    poetry config pypi-token.pypi pypi-waS5vcmcCJ...\n    poetry build\n    poetry publish\n\nrst\n---\n\nLink: `Python \u003chttps://github.com/Josef-Friedrich/python-project-boilerplate\u003e`_.\n\nhttps://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#sections\n\n1. ``#`` with overline, for parts\n2. ``*`` with overline, for chapters\n3. ``=`` for sections\n4. ``-`` for subsections\n5. ``^`` for subsubsections\n6. ``\"`` for paragraphs\n\nA Literal Block::\n\n    LITERAL BLOCK\n\nWe don’t use parts and chapters in the README files.\n\n.. code-block:: restructuredtext\n\n    section\n    =======\n\n    subsection\n    ----------\n\n    subsubsection\n    ^^^^^^^^^^^^^\n\n    paragraphs\n    \"\"\"\"\"\"\"\"\"\"\n\nInclude an image from an URL:\n\n.. code-block:: restructuredtext\n\n    .. image:: https://raw.githubusercontent.com/Josef-Friedrich/phrydy/refs/heads/main/docs/Type-hints.gif\n        :alt: Type-hints.gif\n\nType hints\n----------\n\nmypy\n^^^^\n\n`Mypy \u003chttps://www.mypy-lang.org/\u003e`_ is an optional static type checker for Python.\n\nVisual Studio Code extensions: `matangover.mypy \u003chttps://marketplace.visualstudio.com/items?itemName=matangover.mypy\u003e`_\n\n.. code-block:: toml\n\n    [tool.mypy]\n    strict = true\n\nTo avoid circular imports\n\n.. code-block:: python\n\n    from typing import TYPE_CHECKING\n    if TYPE_CHECKING:\n        from . import Process\n\nTypedDict\n^^^^^^^^^\n\n.. code-block:: python\n\n    from typing_extensions import TypedDict, Required, NotRequired\n\n    class _trending(TypedDict):\n        allStores: NotRequired[bool]\n        category: str\n        date: str\n        average: List[int]\n\nSupport for typed **kwargs\n^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nhttps://docs.python.org/3/library/typing.html#typing.Unpack\n\n.. code-block:: python\n\n    from typing_extensions import Unpack, TypedDict\n\n    class MyKwargs(TypedDict, total=False):\n      foo: str\n      bar: int\n\n    def baz(**kwargs: Unpack[MyKwargs]) -\u003e None:\n      pass\n\n    baz(foo=\"str\", bar=3) # Pylance will affirm these types.\n\nTask runner\n-----------\n\nhttps://github.com/illBeRoy/taskipy\n\nhttps://github.com/nat-n/poethepoet\n\nDocs\n----\n\nDocstring formats: https://stackoverflow.com/a/24385103\n\nuse reST\n\nFormat and convert Python docstrings and generates patches: `pyment \u003chttps://github.com/dadadel/pyment\u003e`_\n\nGithub pages\n------------\n\n`Settings / Pages \u003chttps://github.com/Josef-Friedrich/python-project-boilerplate/settings/pages\u003e`_\n\nSource: Deploy from branch\nbranch: gh-pages\n\n`Deploying a subfolder to GitHub Pages \u003chttps://gist.github.com/cobyism/4730490\u003e`_\n\nUse subtree push to send it to the gh-pages branch on GitHub.\n\n.. code-block:: shell\n\n    touch docs/_build/.nojekyll\n\n    git subtree push --prefix docs/_build origin gh-pages\n\nStub packages\n-------------\n\n    stubgen .venv/lib/python3.10/site-packages/capturer\n\nhttps://peps.python.org/pep-0561/#stub-only-packages\n\n* https://github.com/lxml/lxml-stubs\n* https://github.com/tk0miya/docutils-stubs\n* https://github.com/Josef-Friedrich/icinga2apic-stubs\n* https://github.com/Josef-Friedrich/nagiosplugin-stubs\n\nAdd packages section to pyproject.toml\n\n.. code-block:: toml\n\n    [tool.poetry]\n    name = \"icinga2apic-stubs\"\n    version = \"0.1.0\"\n    description = \"Type stubs for the icinga2apic package.\"\n    authors = [\"Josef Friedrich \u003cjosef@friedrich.rocks\u003e\"]\n    readme = \"README.rst\"\n    repository = \"https://github.com/Josef-Friedrich/icinga2apic-stubs\"\n    license = \"MIT\"\n    packages = [\n        {include = \"icinga2apic-stubs\"}\n    ]\n\n    classifiers = [\n        \"License :: OSI Approved :: MIT License\",\n    ]\n\n    [tool.poetry.dependencies]\n    python = \"^3.8\"\n\ncli\n---\n\n* argparse\n* click\n\ncli autcompletion\n-----------------\n\n* https://pypi.org/project/shtab\n* https://pypi.org/project/argcomplete\n* https://github.com/dan1994/pyzshcomplete (no update since 3 years)\n* click\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosef-friedrich%2Fpython-boilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjosef-friedrich%2Fpython-boilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosef-friedrich%2Fpython-boilerplate/lists"}