├── .github └── workflows │ └── ci.yml ├── .gitignore ├── .venv ├── CHANGELOG.rst ├── LICENSE ├── PYPT-UPDATE ├── README.rst ├── cookiecutter.json ├── requirements.txt └── {{cookiecutter.repo_name}} ├── .github └── workflows │ └── ci.yml ├── .gitignore ├── .pypt ├── commitlog ├── config ├── ghrel ├── hooks │ ├── post-release.hook │ └── pre-sdist.hook └── localegen ├── AUTHORS ├── CHANGELOG.rst ├── CONTRIBUTING.rst ├── LICENSE ├── MANIFEST.in ├── PKGBUILD ├── PKGBUILD-git ├── README ├── README.rst ├── docs ├── CHANGELOG.rst ├── CONTRIBUTING.rst ├── LICENSE.rst ├── README.rst ├── conf.py ├── html │ └── index.html └── index.rst ├── pypt-extras ├── AUR │ ├── AURvm │ │ ├── aurvm_client.py │ │ ├── aurvm_heartbeat.sh │ │ └── aurvm_host.py │ └── hooks │ │ └── post-release.hook └── Qt │ └── resources.py ├── release ├── requirements.txt ├── setup.cfg ├── setup.py ├── tests ├── __init__.py └── test_sanity.py └── {{cookiecutter.repo_name}} ├── __init__.py ├── __main__.py └── template.py /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: PyPT CI 2 | on: [push, pull_request] 3 | 4 | jobs: 5 | pypt: 6 | name: Test PyPT (Python ${{ matrix.python-version }}) 7 | strategy: 8 | fail-fast: false 9 | matrix: 10 | python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', 'pypy-3.7', 'pypy-3.8', 'pypy-3.9'] 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Check out code 14 | uses: actions/checkout@v2 15 | - name: Set up Python 16 | uses: actions/setup-python@v2 17 | with: 18 | python-version: '${{ matrix.python-version }}' 19 | - name: Upgrade packaging stack 20 | run: | 21 | python -m pip install --upgrade-strategy eager -U pip setuptools wheel 22 | - name: Install requirements 23 | run: | 24 | python -m pip install --upgrade-strategy eager -Ur requirements.txt 25 | - name: Run Cookiecutter 26 | run: | 27 | python -m cookiecutter --no-input . 28 | - name: Run tests (in project directory) 29 | run: | 30 | pytest tests/ 31 | working-directory: pypt 32 | - name: Install tree command 33 | run: | 34 | sudo apt-get update 35 | sudo apt-get install tree 36 | - name: Show directory tree 37 | run: | 38 | tree pypt 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.py[cod] 2 | __pycache__ 3 | 4 | # C extensions 5 | *.so 6 | 7 | # Packages 8 | *.egg 9 | *.egg-info 10 | dist 11 | build 12 | eggs 13 | parts 14 | var 15 | sdist 16 | develop-eggs 17 | .installed.cfg 18 | lib 19 | lib64 20 | 21 | # Installer logs 22 | pip-log.txt 23 | 24 | # Unit test / coverage reports 25 | .coverage 26 | .tox 27 | nosetests.xml 28 | 29 | # Mr Developer 30 | .mr.developer.cfg 31 | .project 32 | .pydevproject 33 | 34 | # GitHub token file 35 | .pypt/gh-token 36 | {{cookiecutter.repo_name}}/.pypt/gh-token 37 | 38 | #  39 | .DS_Store 40 | -------------------------------------------------------------------------------- /.venv: -------------------------------------------------------------------------------- 1 | cookiecutter 2 | -------------------------------------------------------------------------------- /CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | ============== 2 | PyPT Changelog 3 | ============== 4 | :Info: This is the changelog for PyPT. 5 | :Author: Chris Warrick 6 | :Copyright: © 2013-2023, Chris Warrick. 7 | :Date: 2023-01-01 8 | :Version: 2.3.3 9 | 10 | .. index:: CHANGELOG 11 | 12 | GitHub holds releases, too 13 | ========================== 14 | 15 | More information can be found on GitHub in the `releases section 16 | `_. 17 | 18 | Version History 19 | =============== 20 | 21 | 2.3.3 22 | * Update © dates to 2023 23 | 24 | 2.3.2 25 | * Update © dates to 2022 26 | 27 | 2.3.1 28 | * Update © dates to 2021 29 | * Support for Python 3.6+ 30 | 31 | 2.3.0 32 | * Switch CI to GitHub Actions (due to Travis CI closing). Tests are run on 33 | Ubuntu, Windows, and macOS, on multiple CPython 3 versions and PyPy. 34 | 35 | 2.2.0 36 | * Change license of the Template to 3-clause BSD + CC0. The 3-clause BSD 37 | license applies to certain larger components (such as the ``release`` 38 | script), and the rest is covered by the CC0 license. The template files 39 | are provided under CC0 and contain 3-clause BSD headers that can be 40 | replaced by a different license. 41 | 42 | 2.1.12 43 | * Update Python versions (support for 3.5+ by default) 44 | 45 | 2.1.11 46 | * Update © dates to 2020 47 | 48 | 2.1.10 49 | * Update © dates to 2019 50 | 51 | 2.1.9 52 | * Update © dates to 2018 53 | 54 | 2.1.8 55 | * README overhaul 56 | * ``entry_points`` created via cookiecutter question 57 | 58 | 2.1.7 59 | * Very minor README update (everything else unaffected) 60 | 61 | 2.1.6 62 | * Use Python 3 for AURvm client but ensure 2/3 compatibility 63 | 64 | 2.1.5 65 | * Add ``__main__.py`` 66 | * Update some parts of the PyPT README and ``setup.py`` 67 | 68 | 2.1.4 69 | * Fix some bugs in AUR stuff 70 | * Add new config variables: ``AUR_PKGNAME``, ``AUR_PKGNAME_GIT``, ``AUR_GIT_PACKAGE`` 71 | * Update AUR stuff when running ``PYPT-UPDATE`` 72 | 73 | 2.1.3 74 | * Create infrastructure to update AUR packages in an Arch virtual machine (``AURvm``) 75 | * Fix some minor typos in ``release`` 76 | 77 | 2.1.2 78 | * Update © dates to 2017 79 | 80 | 2.1.1 81 | * Fix ``commitlog`` crashing due to a regex glitch (turns out ``C(.*?)`` 82 | will match ``Chris``; changed to ``(C[A-Z]+)``) 83 | 84 | 2.1.0 85 | * Get rid of ``git flow`` — users should switch their main branch to 86 | ``master`` and delete ``develop``. This simplifies development and 87 | branching for most use cases. 88 | * Exit on errors in ``release`` 89 | 90 | 2.0.7 91 | * Make some minor changes to CONTRIBUTING.rst 92 | * Use Python 3.5 in Travis 93 | 94 | 2.0.6 95 | * Sign releases commits and tags 96 | * Use new PyPI URL scheme in PKGBUILDs 97 | * Use correct file name for coverage exclude 98 | * Use repo name for gettext domain 99 | * Experimental support for PyQt5 in ``localegen`` 100 | 101 | 2.0.5 102 | * Put test setup in ``setup.cfg`` 103 | * More modern ``setup.py`` (uses ``package_data`` and ``find_packages()``, does not use 104 | ``requirements.txt``, removes support for ``./setup.py test``) 105 | * Sample hook for AUR updates 106 | * Fixes to tests and ``localegen`` 107 | * Move Qt addons to ``pypt-extras/`` directory 108 | 109 | 2.0.4 110 | * Split out wildcard removal that may fail so that other cleanup works fine 111 | * Don’t remove the ``dist`` directory 112 | 113 | 2.0.3 114 | * Update dates to 2016 115 | 116 | 2.0.2 117 | * Add ``post-release.hook`` (at the very end, perfect for “Next steps” messages) 118 | 119 | 2.0.1 120 | * ``MAINFEST.in`` file 121 | * Minor bugfixes 122 | 123 | 2.0.0 124 | * Automation (using cookiecutter) 125 | 126 | 1.3.1 127 | 128 | .. code:: text 129 | 130 | ,---------------. 131 | / /``````|``````\\ 132 | / /_______|_______\\________ 133 | |] GTI |' | |] 134 | = .-:-. |________| .-:-. = 135 | ` -+- -------------- -+- ' 136 | '-:-' '-:-' 137 | 138 | 1.3.0 139 | * Use ``argparse`` in ``commitlog`` and ``ghrel`` instead of a ``sys.argv`` hack 140 | * Vendor ``textwrap.indent`` in ``commitlog`` for Python 2 compatibility 141 | * Use ``py.test`` in the ``release`` script 142 | * Run tests only if they exist 143 | * Create and upload wheels 144 | 145 | 146 | 1.2.1 147 | * Use new tests in .travis.yml. 148 | 149 | 150 | 1.2.0 151 | * Better tests, stored in a directory and using py.test instead of unittest. 152 | 153 | 154 | 1.1.2 155 | * Add ``.pypt/PYPT-UPDATE`` script (copy it somewhere else and customize to your liking) 156 | 157 | 158 | 1.1.1 159 | * Fix ``$cmfn`` variables in ``./release`` 160 | * Print correct release URL (``html_url`` for friendly webpage) 161 | * Support Transifex in locale generation (``-tx`` suffix) 162 | 163 | 164 | 1.1.0 165 | * Automate GitHub Releases posting. (For CMFN-based files, ``backticks`` are automatically corrected.) 166 | 167 | 1.0.9 168 | * Fix mismatched paths in the commit and changelog editor (cmfn) — requries update of ``.pypt/commitlog`` and ``release`` 169 | * PEP 257 compliance 170 | 171 | 1.0.8 172 | * Update Sphinx ``version`` field (previously, only ``release`` was updated) 173 | 174 | 1.0.7 175 | * no more AUR uploads due to AURv4 176 | 177 | 1.0.6 178 | * Use ``twine`` instead of ``setup.py upload`` 179 | * Fix ``aursend`` path 180 | 181 | 1.0.5 182 | Updating all dates to say 2015. 183 | 184 | 1.0.4 185 | * Rebranding: removing nickname from all *Author* lines. 186 | 187 | 1.0.3 188 | * changed e-mail address 189 | * setup.cfg 190 | * setuptools entry_points 191 | * py.test 192 | 193 | 1.0.2 194 | * Set the © fields to 2014. 195 | 196 | 1.0.1 197 | * Some small changes and fixes. 198 | 199 | 1.0.0 200 | * Initial release. 201 | 202 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The Python Project Template is provided under two licenses. 2 | 3 | The main license of the Template, all Template-related files, and some 4 | of the provided extras, is the 3-clause BSD license. The 3-clause BSD 5 | license is a simple open-source license, which requires you to include 6 | the text of the license and the copyright line (with Chris Warrick’s 7 | name) with all distributions of the software. 8 | 9 | The following files are under the 3-clause BSD license: 10 | 11 | * /.pypt/commitlog 12 | * /.pypt/ghrel 13 | * /.pypt/localegen 14 | * PyPT’s README (not the one installed by the template) 15 | * /pypt-extras/AUR/hooks/post-release.hook 16 | * /pypt-extras/AUR/AURvm/aurvm_client.py 17 | * /pypt-extras/AUR/AURvm/aurvm_host.py 18 | * /docs/CONTRIBUTING.rst 19 | * /CONTRIBUTING.rst 20 | * /release 21 | 22 | The remaining files are themselves dual-licensed under the CC0 23 | license. Note that some of the files contain 3-clause BSD license 24 | headers. The 3-clause BSD license is the one I recommend for your 25 | project, but I waive all copyright claims over these files to the 26 | extent permitted by law, as stated in the CC0 license text. This means 27 | that you are free to remove the license headers. You are also free to 28 | remove those license headers and pick any other license you want, and 29 | you are also free to use a commercial license. 30 | 31 | 3-CLAUSE BSD LICENSE 32 | -------------------- 33 | 34 | Copyright © 2013-2023, Chris Warrick. 35 | All rights reserved. 36 | 37 | Redistribution and use in source and binary forms, with or without 38 | modification, are permitted provided that the following conditions are 39 | met: 40 | 41 | 1. Redistributions of source code must retain the above copyright 42 | notice, this list of conditions, and the following disclaimer. 43 | 44 | 2. Redistributions in binary form must reproduce the above copyright 45 | notice, this list of conditions, and the following disclaimer in the 46 | documentation and/or other materials provided with the distribution. 47 | 48 | 3. Neither the name of the author of this software nor the names of 49 | contributors to this software may be used to endorse or promote 50 | products derived from this software without specific prior written 51 | consent. 52 | 53 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 54 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 55 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 56 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 57 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 58 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 59 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 60 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 61 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 62 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 63 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 64 | 65 | 66 | CC0 LICENSE 67 | ----------- 68 | Creative Commons Legal Code 69 | 70 | CC0 1.0 Universal 71 | 72 | CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE 73 | LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN 74 | ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS 75 | INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES 76 | REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS 77 | PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM 78 | THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED 79 | HEREUNDER. 80 | 81 | Statement of Purpose 82 | 83 | The laws of most jurisdictions throughout the world automatically confer 84 | exclusive Copyright and Related Rights (defined below) upon the creator 85 | and subsequent owner(s) (each and all, an "owner") of an original work of 86 | authorship and/or a database (each, a "Work"). 87 | 88 | Certain owners wish to permanently relinquish those rights to a Work for 89 | the purpose of contributing to a commons of creative, cultural and 90 | scientific works ("Commons") that the public can reliably and without fear 91 | of later claims of infringement build upon, modify, incorporate in other 92 | works, reuse and redistribute as freely as possible in any form whatsoever 93 | and for any purposes, including without limitation commercial purposes. 94 | These owners may contribute to the Commons to promote the ideal of a free 95 | culture and the further production of creative, cultural and scientific 96 | works, or to gain reputation or greater distribution for their Work in 97 | part through the use and efforts of others. 98 | 99 | For these and/or other purposes and motivations, and without any 100 | expectation of additional consideration or compensation, the person 101 | associating CC0 with a Work (the "Affirmer"), to the extent that he or she 102 | is an owner of Copyright and Related Rights in the Work, voluntarily 103 | elects to apply CC0 to the Work and publicly distribute the Work under its 104 | terms, with knowledge of his or her Copyright and Related Rights in the 105 | Work and the meaning and intended legal effect of CC0 on those rights. 106 | 107 | 1. Copyright and Related Rights. A Work made available under CC0 may be 108 | protected by copyright and related or neighboring rights ("Copyright and 109 | Related Rights"). Copyright and Related Rights include, but are not 110 | limited to, the following: 111 | 112 | i. the right to reproduce, adapt, distribute, perform, display, 113 | communicate, and translate a Work; 114 | ii. moral rights retained by the original author(s) and/or performer(s); 115 | iii. publicity and privacy rights pertaining to a person's image or 116 | likeness depicted in a Work; 117 | iv. rights protecting against unfair competition in regards to a Work, 118 | subject to the limitations in paragraph 4(a), below; 119 | v. rights protecting the extraction, dissemination, use and reuse of data 120 | in a Work; 121 | vi. database rights (such as those arising under Directive 96/9/EC of the 122 | European Parliament and of the Council of 11 March 1996 on the legal 123 | protection of databases, and under any national implementation 124 | thereof, including any amended or successor version of such 125 | directive); and 126 | vii. other similar, equivalent or corresponding rights throughout the 127 | world based on applicable law or treaty, and any national 128 | implementations thereof. 129 | 130 | 2. Waiver. To the greatest extent permitted by, but not in contravention 131 | of, applicable law, Affirmer hereby overtly, fully, permanently, 132 | irrevocably and unconditionally waives, abandons, and surrenders all of 133 | Affirmer's Copyright and Related Rights and associated claims and causes 134 | of action, whether now known or unknown (including existing as well as 135 | future claims and causes of action), in the Work (i) in all territories 136 | worldwide, (ii) for the maximum duration provided by applicable law or 137 | treaty (including future time extensions), (iii) in any current or future 138 | medium and for any number of copies, and (iv) for any purpose whatsoever, 139 | including without limitation commercial, advertising or promotional 140 | purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each 141 | member of the public at large and to the detriment of Affirmer's heirs and 142 | successors, fully intending that such Waiver shall not be subject to 143 | revocation, rescission, cancellation, termination, or any other legal or 144 | equitable action to disrupt the quiet enjoyment of the Work by the public 145 | as contemplated by Affirmer's express Statement of Purpose. 146 | 147 | 3. Public License Fallback. Should any part of the Waiver for any reason 148 | be judged legally invalid or ineffective under applicable law, then the 149 | Waiver shall be preserved to the maximum extent permitted taking into 150 | account Affirmer's express Statement of Purpose. In addition, to the 151 | extent the Waiver is so judged Affirmer hereby grants to each affected 152 | person a royalty-free, non transferable, non sublicensable, non exclusive, 153 | irrevocable and unconditional license to exercise Affirmer's Copyright and 154 | Related Rights in the Work (i) in all territories worldwide, (ii) for the 155 | maximum duration provided by applicable law or treaty (including future 156 | time extensions), (iii) in any current or future medium and for any number 157 | of copies, and (iv) for any purpose whatsoever, including without 158 | limitation commercial, advertising or promotional purposes (the 159 | "License"). The License shall be deemed effective as of the date CC0 was 160 | applied by Affirmer to the Work. Should any part of the License for any 161 | reason be judged legally invalid or ineffective under applicable law, such 162 | partial invalidity or ineffectiveness shall not invalidate the remainder 163 | of the License, and in such case Affirmer hereby affirms that he or she 164 | will not (i) exercise any of his or her remaining Copyright and Related 165 | Rights in the Work or (ii) assert any associated claims and causes of 166 | action with respect to the Work, in either case contrary to Affirmer's 167 | express Statement of Purpose. 168 | 169 | 4. Limitations and Disclaimers. 170 | 171 | a. No trademark or patent rights held by Affirmer are waived, abandoned, 172 | surrendered, licensed or otherwise affected by this document. 173 | b. Affirmer offers the Work as-is and makes no representations or 174 | warranties of any kind concerning the Work, express, implied, 175 | statutory or otherwise, including without limitation warranties of 176 | title, merchantability, fitness for a particular purpose, non 177 | infringement, or the absence of latent or other defects, accuracy, or 178 | the present or absence of errors, whether or not discoverable, all to 179 | the greatest extent permissible under applicable law. 180 | c. Affirmer disclaims responsibility for clearing rights of other persons 181 | that may apply to the Work or any use thereof, including without 182 | limitation any person's Copyright and Related Rights in the Work. 183 | Further, Affirmer disclaims responsibility for obtaining any necessary 184 | consents, permissions or other rights required for any use of the 185 | Work. 186 | d. Affirmer understands and acknowledges that Creative Commons is not a 187 | party to this document and has no duty or obligation with respect to 188 | this CC0 or use of the Work. 189 | -------------------------------------------------------------------------------- /PYPT-UPDATE: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | PYPT_ROOT=$HOME/git/python-project-template/{{cookiecutter.repo_name}} 3 | PYPT_COMPONENTS=(release .pypt/commitlog .pypt/ghrel) 4 | PYPT_PROJECTS=("$HOME/git/pkgbuilder") # fill in your own 5 | 6 | PYPT_AURVM_COMPONENTS=(hooks/post-release.hook AURvm/aurvm_client.py AURvm/aurvm_heartbeat.sh AURvm/aurvm_host.py) 7 | PYPT_AURVM_PROJECTS=("$HOME/git/cheqlist") # fill in your own 8 | 9 | for p in $PYPT_PROJECTS; do 10 | echo "==> $p" 11 | for c in $PYPT_COMPONENTS; do 12 | cp -v $PYPT_ROOT/$c $p/$c 13 | done 14 | done 15 | 16 | 17 | for p in $PYPT_AURVM_PROJECTS; do 18 | echo "==> $p" 19 | for c in $PYPT_AURVM_COMPONENTS; do 20 | cp -v $PYPT_ROOT/pypt-extras/AUR/$c $p/.pypt/$c 21 | done 22 | done 23 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | =============================================== 2 | Python Project Template. INSERT TAGLINE HERE.™ 3 | =============================================== 4 | :Info: This is the README file for the Python Project Template. 5 | :Author: Chris Warrick 6 | :Copyright: © 2013-2023, Chris Warrick. 7 | :Date: 2022-01-01 8 | :Version: 2.3.2 9 | 10 | .. index: README 11 | .. image:: https://github.com/Kwpolska/python-project-template/workflows/PyPT%20CI/badge.svg 12 | 13 | .. contents:: 14 | 15 | Requirements 16 | ============ 17 | 18 | Python Project Template is made possible by `Cookiecutter 19 | `_. To use the template, you will 20 | also need: 21 | 22 | * ``zsh`` installed (required by ``/release`` and ``/.pypt/localegen`` scripts) 23 | * Python with ``requests`` (required by ``/.pypt/{commitlog,ghrel}``) and 24 | ``twine`` (required by ``/release``) 25 | installed, as well as ``pytest``, ``coverage`` and ``pytest-cov`` — run ``pip 26 | install -r requirements.txt`` to install everything 27 | * A place to host Git repositories. GitHub is assumed, but can be changed 28 | (documented below) 29 | * PGP/GPG setup (for signing release commits and tags) 30 | 31 | Template contents 32 | ================= 33 | 34 | The template contains the following files to get you started: 35 | 36 | * pre-configured Sphinx with: 37 | 38 | * ``CONTRIBUTING.rst`` guide (shown by GitHub when sending a pull request or an issue) 39 | * ``LICENSE.rst`` 40 | * an empty ``CHANGELOG.rst`` 41 | * ``README.rst`` 42 | * a bare-bones ``index.rst`` page 43 | 44 | * The exact same files in ``/``, which are fragile and **MAY NOT** be modified 45 | as they are replaced with copies in ``/docs`` by the ``release`` script 46 | * ``__init__.py``, ``__main__.py`` and ``template.py`` files in the Python package directory 47 | * A ``setup.py`` file that could be good enough for people, and that supports 48 | ``entry_points`` (see https://go.chriswarrick.com/entry_points). 49 | * ``tests/`` containing some *Is My Python Sane?*-style tests (using ``pytest``) 50 | * GitHub Actions workflows for CI (that run tests using multiple OSes and 51 | Python versions) 52 | * An automated global update script (``.pypt/PYPT-UPDATE``) 53 | * Entry points configuration ready to be uncommented (and a matching 54 | ``__main__.py`` file) 55 | * Add-ons for Qt users (in ``pypt-extras/Qt``) 56 | * A sample hook for AUR updates (in ``pypt-extras/AUR``) 57 | * PKGBUILDs for the Arch Linux User Repository (AUR) 58 | * A state-of-the-art ``release`` script, the operations of which are: 59 | 60 | * querying the user for version number, commit message and changes 61 | * updating ``/docs/CHANGELOG.rst`` 62 | * bumping the version number in all the files, changing dates where necessary 63 | * copying over ``/docs/README.rst``, ``/docs/CHANGELOG.rst`` and ``/docs/CONTRIBUTING.rst`` to ``/`` 64 | * locale generation (via the ``.pypt/localegen`` script) 65 | * running ``import $PROJECTLC`` and the test suite 66 | * uploading a source distribution and a wheel to PyPI 67 | * Making a Git commit and tagging the release 68 | * creating a GitHub Releases entry 69 | * updating the AUR packages (by using hooks) 70 | 71 | Caveats and optional features 72 | ============================= 73 | 74 | AUR support (hooks, VM automation) 75 | ---------------------------------- 76 | 77 | This template includes full support for creating and updating AUR PKGBUILDs. 78 | Templates for stable and git packages are in the project directory. 79 | Furthermore, there are scripts to facilitate updating AUR packages. Those are: 80 | 81 | * /pypt-extras/AUR/hooks/post-release.hook 82 | * /pypt-extras/AUR/AURvm/aurvm_client.py 83 | * /pypt-extras/AUR/AURvm/aurvm_host.py 84 | * /pypt-extras/AUR/AURvm/aurvm_heartbeat.sh 85 | 86 | If you want to use those, copy (move) ``post-release.hook`` to 87 | ``.pypt/hooks/post-release.hook``. If you are doing releases on an Arch Linux 88 | system, you may want to switch the default from remote to local updates. If 89 | you are doing releases on any other Linux/\*nix system, you also need to copy 90 | the entire AURvm directory to ``.pypt/``, and put ``aurvm_host.py`` and 91 | ``aurvm_heartbeat.sh`` in your ``aur-pkgbuilds`` directory. 92 | 93 | The scripts assume a very specific setup, which is as follows: 94 | 95 | * repos for AUR packages in ``~/git/aur-pkgbuilds`` 96 | * ``UPDATE-REQUIREMENTS.py`` and ``aur.zsh`` scripts (see `Kwpolska/aur-pkgbuilds `_) 97 | * An Arch Linux virtual machine that is accessible using ``ssh arch`` (in ``.ssh/config``) 98 | * Probably some others. Those were written with only one use case in mind 99 | (mine, unsurprisingly). 100 | 101 | Qt support (locales, resources) 102 | ------------------------------- 103 | 104 | If you are using PyQt or PySide, make sure to put your UI code in a 105 | ``ui`` submodule. Copy the ``pypt-extras/Qt/resources.py`` file to that 106 | submodule, even if you are not using resources now. Make sure to create a 107 | ``.pro`` file with your sources and locales. 108 | 109 | If you do not want to use GitHub 110 | -------------------------------- 111 | 112 | Search for mentions of GitHub (case-insensitively) and remove them. They 113 | appear in some auto-generated links, for example. The ``release`` script 114 | assumes GitHub Releases, you can remove that part. Also remove ``.github`` 115 | (which contains the GitHub Actions setup). 116 | 117 | If you do not want to publish to the Arch User Repository 118 | --------------------------------------------------------- 119 | 120 | Remove ``PKGBUILD``, ``PKGBUILD-git``. Set ``aur_email`` to anything. 121 | 122 | Getting started 123 | =============== 124 | 125 | One time setup: virtualenvs and project directory 126 | ------------------------------------------------- 127 | 128 | If you don’t know how virtualenvs work and why you should use them, read `my guide about setting up a Python development environment `_. 129 | 130 | You will need to prepare two places: 131 | 132 | 1. A place where you store your projects (git repositories). You probably have 133 | a folder for that already; if you don’t, use ``~/Projects`` or ``~/git``. 134 | 2. Somewhere to store virtualenvs. Using virtualenvwrapper is recommended, but 135 | not necessary. Don’t put your virtualenvs next to your code. 136 | 137 | Create a virtualenv for PyPT named ``cookiecutter``. Clone the PyPT GitHub 138 | repository to your project space. Run ``pip install -r 139 | python-project-template/requirements.txt`` to install PyPT’s requirements to 140 | your environment. 141 | 142 | Starting a new project 143 | ---------------------- 144 | 145 | Activate the ``cookiecutter`` virtualenv. While in your project home, run 146 | ``cookiecutter python-project-template`` and answer the questions. 147 | (If ``aur_email`` and ``github_username`` don’t apply, set them to anything.) 148 | 149 | The script can optionally create an entry point to start your app from command 150 | line. Select ``cli`` or ``gui`` if you want one. Select ``none`` otherwise. If 151 | you don’t know why you would want one, read `my guide about entry_points `_. 152 | 153 | Fixing the things that cannot be automated 154 | ------------------------------------------ 155 | 156 | * You need to modify all documents that are stored in ``docs/``. Some of them 157 | need reST syntax fixes (title underlines). README needs real content. 158 | * Since your first commit will **not** use the ``release`` script, you need to copy files by hand: 159 | 160 | 1. ``/docs/README.rst`` to ``/README.rst`` and ``/README`` 161 | 2. ``/docs/CHANGELOG.rst`` to ``/CHANGELOG.rst`` 162 | 163 | * Modify ``/.pypt/config``. Verify that all settings are correct. 164 | * Choose a license. I recommend the 3-clause BSD license, and the template 165 | includes a LICENSE file and licensing headers with the text of the 3-clause 166 | BSD license. However, most of the template is provided to you under the CC0 167 | license, and you are free to choose any license for your project and you can 168 | replace those headers, **unless** a file includes a copyright header with 169 | Chris Warrick’s name, or is on the list in the PyPT’s LICENSE file (also 170 | reproduced at the end of this README document) – those specific files are 171 | under the 3-clause BSD license, which requires the copyright notices to be 172 | left intact. 173 | * If you’re using GitHub, generate a `GitHub Personal Access Token 174 | `_ in the ``repo`` scope and write it to 175 | a ``/.pypt/gh-token`` file. You may reuse tokens between different repos 176 | running PyPT. (This is used for automating GitHub Releases.) 177 | 178 | Preparing code 179 | -------------- 180 | 181 | * If you have any code, you can put it in your package already. Use 182 | ``template.py`` as a template for your Python files. (Remove it if you don’t 183 | need it, or store it somewhere else.) 184 | * Customize ``/setup.py`` to your liking. You should pay attention to the classifiers, requirements, and other things you desire to change. 185 | * If you enabled entry points, edit ``__main__.py``. Remember that ``main()`` must take no 186 | positional/non-default arguments! If you do not want to create scripts and 187 | don’t want command-line interfaces, remove ``__main__.py``. 188 | * Create a virtual environment for your project. Make sure to install 189 | ``requirements.txt``. 190 | 191 | Extras 192 | ------ 193 | 194 | If you want to use AUR or Qt extras, check out the documentation (`Caveats and optional features`_). 195 | Remove the ``pypt-extras`` directory if you don’t need anything else from it. 196 | 197 | If you have a ``PYPT-UPDATE`` script, add your new project to the list there. If not, you may want to copy it from the repository root and set it up. 198 | 199 | Your first commit 200 | ----------------- 201 | 202 | Run the following commands (assumes GitHub):: 203 | 204 | source .pypt/config 205 | git init 206 | git remote add origin git@github.com:$GITUSER/$GITREPO 207 | git add . 208 | git commit -sm 'initial commit via @Kwpolska’s Python Project Template' 209 | git push -u origin master 210 | 211 | Congratulations! 212 | 213 | If you’re ready to make your first release 214 | ------------------------------------------ 215 | 216 | Run ``./release`` and watch magic happen. Make sure your project virtualenv is 217 | active. 218 | 219 | But if this is your first project, you should check if: 220 | 221 | * GPG works on your system 222 | * you created the virtualenv with the Python version, installed requirements 223 | and have activated it 224 | * git works, and you have a GitHub access token (if desired) 225 | * the optional features are configured properly 226 | 227 | License 228 | ======= 229 | 230 | The Python Project Template is provided under two licenses. 231 | 232 | The main license of the Template, all Template-related files, and some 233 | of the provided extras, is the 3-clause BSD license. The 3-clause BSD 234 | license is a simple open-source license, which requires you to include 235 | the text of the license and the copyright line (with Chris Warrick’s 236 | name) with all distributions of the software. 237 | 238 | The following files are under the 3-clause BSD license: 239 | 240 | * /.pypt/commitlog 241 | * /.pypt/ghrel 242 | * /.pypt/localegen 243 | * PyPT’s README (not the one installed by the template) 244 | * /pypt-extras/AUR/hooks/post-release.hook 245 | * /pypt-extras/AUR/AURvm/aurvm_client.py 246 | * /pypt-extras/AUR/AURvm/aurvm_host.py 247 | * /docs/CONTRIBUTING.rst 248 | * /CONTRIBUTING.rst 249 | * /release 250 | 251 | The remaining files are themselves dual-licensed under the CC0 252 | license. Note that some of the files contain 3-clause BSD license 253 | headers. The 3-clause BSD license is the one I recommend for your 254 | project, but I waive all copyright claims over these files to the 255 | extent permitted by law, as stated in the CC0 license text. This means 256 | that you are free to remove the license headers. You are also free to 257 | remove those license headers and pick any other license you want, and 258 | you are also free to use a commercial license. 259 | 260 | 3-CLAUSE BSD LICENSE 261 | -------------------- 262 | 263 | Copyright © 2013-2023, Chris Warrick. 264 | All rights reserved. 265 | 266 | Redistribution and use in source and binary forms, with or without 267 | modification, are permitted provided that the following conditions are 268 | met: 269 | 270 | 1. Redistributions of source code must retain the above copyright 271 | notice, this list of conditions, and the following disclaimer. 272 | 273 | 2. Redistributions in binary form must reproduce the above copyright 274 | notice, this list of conditions, and the following disclaimer in the 275 | documentation and/or other materials provided with the distribution. 276 | 277 | 3. Neither the name of the author of this software nor the names of 278 | contributors to this software may be used to endorse or promote 279 | products derived from this software without specific prior written 280 | consent. 281 | 282 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 283 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 284 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 285 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 286 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 287 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 288 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 289 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 290 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 291 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 292 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 293 | 294 | 295 | CC0 LICENSE 296 | ----------- 297 | Creative Commons Legal Code 298 | 299 | CC0 1.0 Universal 300 | 301 | CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE 302 | LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN 303 | ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS 304 | INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES 305 | REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS 306 | PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM 307 | THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED 308 | HEREUNDER. 309 | 310 | Statement of Purpose 311 | 312 | The laws of most jurisdictions throughout the world automatically confer 313 | exclusive Copyright and Related Rights (defined below) upon the creator 314 | and subsequent owner(s) (each and all, an "owner") of an original work of 315 | authorship and/or a database (each, a "Work"). 316 | 317 | Certain owners wish to permanently relinquish those rights to a Work for 318 | the purpose of contributing to a commons of creative, cultural and 319 | scientific works ("Commons") that the public can reliably and without fear 320 | of later claims of infringement build upon, modify, incorporate in other 321 | works, reuse and redistribute as freely as possible in any form whatsoever 322 | and for any purposes, including without limitation commercial purposes. 323 | These owners may contribute to the Commons to promote the ideal of a free 324 | culture and the further production of creative, cultural and scientific 325 | works, or to gain reputation or greater distribution for their Work in 326 | part through the use and efforts of others. 327 | 328 | For these and/or other purposes and motivations, and without any 329 | expectation of additional consideration or compensation, the person 330 | associating CC0 with a Work (the "Affirmer"), to the extent that he or she 331 | is an owner of Copyright and Related Rights in the Work, voluntarily 332 | elects to apply CC0 to the Work and publicly distribute the Work under its 333 | terms, with knowledge of his or her Copyright and Related Rights in the 334 | Work and the meaning and intended legal effect of CC0 on those rights. 335 | 336 | 1. Copyright and Related Rights. A Work made available under CC0 may be 337 | protected by copyright and related or neighboring rights ("Copyright and 338 | Related Rights"). Copyright and Related Rights include, but are not 339 | limited to, the following: 340 | 341 | i. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work; 342 | ii. moral rights retained by the original author(s) and/or performer(s); 343 | iii. publicity and privacy rights pertaining to a person's image or likeness depicted in a Work; 344 | iv. rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below; 345 | v. rights protecting the extraction, dissemination, use and reuse of data in a Work; 346 | vi. database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and 347 | vii. other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof. 348 | 349 | 2. Waiver. To the greatest extent permitted by, but not in contravention 350 | of, applicable law, Affirmer hereby overtly, fully, permanently, 351 | irrevocably and unconditionally waives, abandons, and surrenders all of 352 | Affirmer's Copyright and Related Rights and associated claims and causes 353 | of action, whether now known or unknown (including existing as well as 354 | future claims and causes of action), in the Work (i) in all territories 355 | worldwide, (ii) for the maximum duration provided by applicable law or 356 | treaty (including future time extensions), (iii) in any current or future 357 | medium and for any number of copies, and (iv) for any purpose whatsoever, 358 | including without limitation commercial, advertising or promotional 359 | purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each 360 | member of the public at large and to the detriment of Affirmer's heirs and 361 | successors, fully intending that such Waiver shall not be subject to 362 | revocation, rescission, cancellation, termination, or any other legal or 363 | equitable action to disrupt the quiet enjoyment of the Work by the public 364 | as contemplated by Affirmer's express Statement of Purpose. 365 | 366 | 3. Public License Fallback. Should any part of the Waiver for any reason 367 | be judged legally invalid or ineffective under applicable law, then the 368 | Waiver shall be preserved to the maximum extent permitted taking into 369 | account Affirmer's express Statement of Purpose. In addition, to the 370 | extent the Waiver is so judged Affirmer hereby grants to each affected 371 | person a royalty-free, non transferable, non sublicensable, non exclusive, 372 | irrevocable and unconditional license to exercise Affirmer's Copyright and 373 | Related Rights in the Work (i) in all territories worldwide, (ii) for the 374 | maximum duration provided by applicable law or treaty (including future 375 | time extensions), (iii) in any current or future medium and for any number 376 | of copies, and (iv) for any purpose whatsoever, including without 377 | limitation commercial, advertising or promotional purposes (the 378 | "License"). The License shall be deemed effective as of the date CC0 was 379 | applied by Affirmer to the Work. Should any part of the License for any 380 | reason be judged legally invalid or ineffective under applicable law, such 381 | partial invalidity or ineffectiveness shall not invalidate the remainder 382 | of the License, and in such case Affirmer hereby affirms that he or she 383 | will not (i) exercise any of his or her remaining Copyright and Related 384 | Rights in the Work or (ii) assert any associated claims and causes of 385 | action with respect to the Work, in either case contrary to Affirmer's 386 | express Statement of Purpose. 387 | 388 | 4. Limitations and Disclaimers. 389 | 390 | a. No trademark or patent rights held by Affirmer are waived, abandoned, 391 | surrendered, licensed or otherwise affected by this document. 392 | b. Affirmer offers the Work as-is and makes no representations or 393 | warranties of any kind concerning the Work, express, implied, 394 | statutory or otherwise, including without limitation warranties of 395 | title, merchantability, fitness for a particular purpose, non 396 | infringement, or the absence of latent or other defects, accuracy, or 397 | the present or absence of errors, whether or not discoverable, all to 398 | the greatest extent permissible under applicable law. 399 | c. Affirmer disclaims responsibility for clearing rights of other persons 400 | that may apply to the Work or any use thereof, including without 401 | limitation any person's Copyright and Related Rights in the Work. 402 | Further, Affirmer disclaims responsibility for obtaining any necessary 403 | consents, permissions or other rights required for any use of the 404 | Work. 405 | d. Affirmer understands and acknowledges that Creative Commons is not a 406 | party to this document and has no duty or obligation with respect to 407 | this CC0 or use of the Work. 408 | -------------------------------------------------------------------------------- /cookiecutter.json: -------------------------------------------------------------------------------- 1 | { 2 | "full_name": "Chris Warrick", 3 | "email": "chris@chriswarrick.com", 4 | "aur_email": "aur@chriswarrick.com", 5 | "github_username": "Kwpolska", 6 | "project_name": "Python Project Template", 7 | "repo_name": "pypt", 8 | "project_short_description": "INSERT TAGLINE HERE.™", 9 | "release_date": "2017-01-01", 10 | "year": "2017", 11 | "version": "0.1.0", 12 | "entry_point": ["none", "cli", "gui"] 13 | } 14 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | requests 2 | twine 3 | cookiecutter 4 | pytest 5 | coverage 6 | pytest-cov 7 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: {{ cookiecutter.project_name }} CI 2 | on: [push, pull_request] 3 | 4 | jobs: 5 | tests: 6 | name: Test {{ cookiecutter.project_name }} {%raw%}(Python ${{ matrix.python-version }} on ${{ matrix.image }}) 7 | strategy: 8 | fail-fast: false 9 | matrix: 10 | python-version: [3.6, 3.7, 3.8, 3.9, pypy-3.7] 11 | image: 12 | - ubuntu-latest 13 | include: 14 | - python-version: 3.9 15 | image: macos-latest 16 | - python-version: 3.9 17 | image: windows-latest 18 | runs-on: '${{ matrix.image }}' 19 | steps: 20 | - name: Check out code 21 | uses: actions/checkout@v2 22 | - name: Set up Python 23 | uses: actions/setup-python@v2 24 | with: 25 | python-version: '${{ matrix.python-version }}' 26 | - name: Upgrade packaging stack 27 | run: | 28 | python -m pip install --upgrade-strategy eager -U pip setuptools wheel 29 | - name: Install requirements{% endraw %} 30 | run: | 31 | python -m pip install --upgrade-strategy eager -Ur requirements.txt 32 | - name: Install {{ cookiecutter.project_name }} 33 | run: | 34 | python -m pip install . 35 | - name: Run tests 36 | run: | 37 | pytest --cov {{ cookiecutter.repo_name }} --cov-report term-missing tests/ 38 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/.gitignore: -------------------------------------------------------------------------------- 1 | *.py[cod] 2 | __pycache__ 3 | 4 | # C extensions 5 | *.so 6 | 7 | # Packages 8 | *.egg 9 | *.egg-info 10 | dist 11 | build 12 | eggs 13 | parts 14 | var 15 | sdist 16 | develop-eggs 17 | .installed.cfg 18 | lib 19 | lib64 20 | 21 | # Installer logs 22 | pip-log.txt 23 | 24 | # Unit test / coverage reports 25 | .coverage 26 | .tox 27 | nosetests.xml 28 | .pytest_cache 29 | 30 | # Mr Developer 31 | .mr.developer.cfg 32 | .project 33 | .pydevproject 34 | 35 | # GitHub token file 36 | .pypt/gh-token 37 | 38 | #  39 | .DS_Store 40 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/.pypt/commitlog: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- encoding: utf-8 -*- 3 | # Kw’s Release Tools/Python Project Template 4 | # Commit and Changelog Parser 5 | # Copyright © 2013-2023, Chris Warrick. 6 | # All rights reserved. 7 | # 8 | # Redistribution and use in source and binary forms, with or without 9 | # modification, are permitted provided that the following conditions are 10 | # met: 11 | # 12 | # 1. Redistributions of source code must retain the above copyright 13 | # notice, this list of conditions, and the following disclaimer. 14 | # 15 | # 2. Redistributions in binary form must reproduce the above copyright 16 | # notice, this list of conditions, and the following disclaimer in the 17 | # documentation and/or other materials provided with the distribution. 18 | # 19 | # 3. Neither the name of the author of this software nor the names of 20 | # contributors to this software may be used to endorse or promote 21 | # products derived from this software without specific prior written 22 | # consent. 23 | # 24 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | 36 | 37 | """ 38 | Parse commits and changelogs for PyPT. 39 | 40 | Usage: .pypt/commitlog FILE BASEDIR NEWVERSION, where 41 | FILE is the path to the CMFN file to parse, 42 | BASEDIR is the project directory, 43 | NEWVERSION is the new version number. 44 | All paths should be absolute. 45 | """ 46 | 47 | 48 | import argparse 49 | import re 50 | import sys 51 | from os.path import join as pjoin 52 | 53 | 54 | # Stolen from textwrap in Python 3.4.3 with PEP257 fixes 55 | def indent(text, prefix, predicate=None): 56 | """Add 'prefix' to the beginning of selected lines in 'text'. 57 | 58 | If 'predicate' is provided, 'prefix' will only be added to the lines 59 | where 'predicate(line)' is True. If 'predicate' is not provided, 60 | it will default to adding 'prefix' to all non-empty lines that do not 61 | consist solely of whitespace characters. 62 | """ 63 | if predicate is None: 64 | def predicate(line): 65 | return line.strip() 66 | 67 | def prefixed_lines(): 68 | for line in text.splitlines(True): 69 | yield (prefix + line if predicate(line) else line) 70 | return ''.join(prefixed_lines()) 71 | 72 | 73 | def main(): 74 | """commitlog main function.""" 75 | parser = argparse.ArgumentParser( 76 | description="Commit and Changelog Parser " 77 | "(part of Chris Warrick's Python Project Template)") 78 | parser.add_argument('filename', metavar='FILE', nargs=1, 79 | help='File to parse') 80 | parser.add_argument('basedir', metavar='BASEDIR', nargs=1, 81 | help='Project directory') 82 | parser.add_argument('new_version', metavar='NEWVERSION', nargs=1, 83 | help='New version (X.Y.Z)') 84 | args = parser.parse_args() 85 | # nargs gets you lists, not strings 86 | filename = args.filename[0] 87 | basedir = args.basedir[0] 88 | new_version = args.new_version[0] 89 | 90 | with open(filename) as fh: 91 | e = re.findall('#~ (C[A-Z]+) MESSAGE START ~#\n(.*?)\n#~ (C[A-Z]+) MESSAGE ' 92 | 'END ~#', fh.read(), flags=re.S) 93 | 94 | for i in e: 95 | i = list(i) 96 | if i[0] != i[2]: 97 | print('ERROR: mismatched tags') 98 | return 1 99 | else: 100 | if i[0] == 'COMMIT': 101 | with open(filename + '-commit', 'w') as fh: 102 | fh.write(i[1]) 103 | elif i[0] == 'CHANGELOG': 104 | with open(pjoin(basedir, 'docs', 'CHANGELOG.rst')) as fh: 105 | currentfile = fh.read() 106 | 107 | # A bit fragile... 108 | currentver = re.search(':Version: (.*)', 109 | currentfile).groups()[0] 110 | clog = indent(i[1], 4 * ' ') 111 | 112 | with open(pjoin(basedir, 'docs', 'CHANGELOG.rst'), 'w') as fh: 113 | fh.write(currentfile.replace( 114 | '\n' + currentver, 115 | '\n{0}\n{1}\n\n{2}'.format( 116 | new_version, clog, currentver))) 117 | 118 | 119 | if __name__ == '__main__': 120 | sys.exit(main()) 121 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/.pypt/config: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Human-friendly project name. 3 | PROJECT="{{ cookiecutter.project_name }}" 4 | # Computer-friendly project name, [a-z0-9_\-] 5 | PROJECTLC="{{ cookiecutter.repo_name }}" 6 | 7 | # GitHub username. 8 | GITUSER="{{ cookiecutter.github_username }}" 9 | # Git repository name. Using $PROJECTLC is recommended. 10 | GITREPO=$PROJECTLC 11 | 12 | # Locale type. One of: 13 | # none Do not generate nor use any locales. 14 | # gettext Use GNU gettext (gettext module). 15 | # gettext-tx Use GNU gettext (gettext module) and send to Transifex. 16 | # pyqt4 Use the Qt locale tools (stock Qt + PyQt4). 17 | # pyqt4-tx Use the Qt locale tools (stock Qt + PyQt4) and send to Transifex. 18 | # pyside Use the Qt locale tools (stock Qt + PySide). 19 | # pyside-tx Use the Qt locale tools (stock Qt + PySide) and send to Transifex. 20 | LOCALETYPE="none" 21 | 22 | # Python versions supported. 23 | PYTHON2=1 24 | PYTHON3=1 25 | 26 | # AUR package names. You still need to change PKGBUILDs! 27 | AUR_PKGNAME=$PROJECTLC 28 | AUR_PKGNAME_GIT=$PROJECTLC"-git" 29 | 30 | # Whether or not to create AUR -git packages. m(true/false) 31 | AUR_GIT_PACKAGE="true" 32 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/.pypt/ghrel: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- encoding: utf-8 -*- 3 | # Kw’s Release Tools/Python Project Template 4 | # GitHub Release Creator 5 | # Copyright © 2013-2023, Chris Warrick. 6 | # All rights reserved. 7 | # 8 | # Redistribution and use in source and binary forms, with or without 9 | # modification, are permitted provided that the following conditions are 10 | # met: 11 | # 12 | # 1. Redistributions of source code must retain the above copyright 13 | # notice, this list of conditions, and the following disclaimer. 14 | # 15 | # 2. Redistributions in binary form must reproduce the above copyright 16 | # notice, this list of conditions, and the following disclaimer in the 17 | # documentation and/or other materials provided with the distribution. 18 | # 19 | # 3. Neither the name of the author of this software nor the names of 20 | # contributors to this software may be used to endorse or promote 21 | # products derived from this software without specific prior written 22 | # consent. 23 | # 24 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | 36 | """ 37 | Create GitHub releases out of changelogs. 38 | 39 | Usage: .pypt/commitlog FILE BASEDIR REPOSITORY TAG, where 40 | FILE is the path to the file to use, which can be 41 | a plain .md file or a CMFN file, 42 | BASEDIR is the project directory, 43 | REPOSITORY is the full GitHub repository name (user/repo), 44 | TAG is the tag to write to. 45 | All paths should be absolute. 46 | """ 47 | 48 | import argparse 49 | import json 50 | import re 51 | import requests 52 | import sys 53 | from os.path import join as pjoin 54 | 55 | 56 | def main(): 57 | """ghrel main function.""" 58 | parser = argparse.ArgumentParser( 59 | description="GitHub Release Creator " 60 | "(part of Chris Warrick's Python Project Template)") 61 | parser.add_argument('filename', metavar='FILE', nargs=1, 62 | help='File to parse (Markdown or commitlog)') 63 | parser.add_argument('basedir', metavar='BASEDIR', nargs=1, 64 | help='Project directory (must contain .pypt/gh-token)') 65 | parser.add_argument('repo', metavar='REPOSITORY', nargs=1, 66 | help='GitHub repository (owner/repo)') 67 | parser.add_argument('tag', metavar='TAG', nargs=1, 68 | help='Tag to create release for (vX.Y.Z)') 69 | args = parser.parse_args() 70 | # nargs gets you lists, not strings 71 | filename = args.filename[0] 72 | basedir = args.basedir[0] 73 | repo = args.repo[0] 74 | tag = args.tag[0] 75 | 76 | with open(pjoin(basedir, '.pypt', 'gh-token')) as fh: 77 | token = fh.read().strip() 78 | 79 | headers = { 80 | 'User-Agent': 'Kwpolska/python-project-template', 81 | 'Authorization': 'token ' + token, 82 | } 83 | 84 | with open(filename) as fh: 85 | fdata = fh.read() 86 | e = re.findall( 87 | '#~ CHANGELOG MESSAGE START ~#\n(.*?)\n' 88 | '#~ CHANGELOG MESSAGE END ~#', 89 | fdata, flags=re.S) 90 | 91 | if e: 92 | # parse as a CMFN file, replace backticks (reST -> Markdown) 93 | message = e[0].replace('``', '`') 94 | else: 95 | # parse as a plain Markdown file 96 | message = fdata 97 | 98 | r = requests.post( 99 | 'https://api.github.com/repos/{0}/releases'.format(repo), 100 | data=json.dumps({'tag_name': tag, 'body': message}), 101 | headers=headers) 102 | 103 | if r.status_code == 201: 104 | print("GitHub Release created: {0}".format(r.json()['html_url'])) 105 | else: 106 | print("GitHub Release failed: {0}".format(r.text)) 107 | return 1 108 | 109 | if __name__ == '__main__': 110 | sys.exit(main()) 111 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/.pypt/hooks/post-release.hook: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | . .pypt/config 3 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/.pypt/hooks/pre-sdist.hook: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | . .pypt/config 3 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/.pypt/localegen: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | # Kw’s Release Tools/Python Project Template 3 | # Locale Generator 4 | # Copyright © 2013-2023, Chris Warrick. 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are 9 | # met: 10 | # 11 | # 1. Redistributions of source code must retain the above copyright 12 | # notice, this list of conditions, and the following disclaimer. 13 | # 14 | # 2. Redistributions in binary form must reproduce the above copyright 15 | # notice, this list of conditions, and the following disclaimer in the 16 | # documentation and/or other materials provided with the distribution. 17 | # 18 | # 3. Neither the name of the author of this software nor the names of 19 | # contributors to this software may be used to endorse or promote 20 | # products derived from this software without specific prior written 21 | # consent. 22 | # 23 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 26 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 29 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 30 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | . .pypt/config 35 | 36 | case "$LOCALETYPE" in 37 | 'gettext' | 'gettext-tx') 38 | version=$(cat setup.py | grep 'version=' | sed -e 's/.*version=.//g' -e 's/.,$//g') 39 | date=$(date '+%Y-%m-%d') 40 | datel=$(date '+%Y-%m-%d %H:%M%z') 41 | datep=$(date '+%Y%m%d') 42 | 43 | xgettext -c ./$PROJECTLC/**/*.py localeprovider.py -o ./messages.pot 44 | 45 | sed '1,+17d' ./messages.pot > ./messages.pot.tmp 46 | 47 | pot='# '$PROJECT' pot file. 48 | # Copyright © {{ cookiecutter.year }}, {{ cookiecutter.full_name }}. 49 | # This file is distributed under the same license as the '$PROJECT' package. 50 | # {{ cookiecutter.full_name }} <{{ cookiecutter.email }}>, {{ cookiecutter.year }}. 51 | # 52 | msgid "" 53 | msgstr "" 54 | "Project-Id-Version: #version\\n" 55 | "Report-Msgid-Bugs-To: {{ cookiecutter.full_name }} <{{ cookiecutter.email }}>\\n" 56 | "POT-Creation-Date: #datel\\n" 57 | "PO-Revision-Date: #datel\\n" 58 | "Last-Translator: {{ cookiecutter.full_name }} <{{ cookiecutter.email }}>\\n" 59 | "Language-Team: {{ cookiecutter.full_name }} <{{ cookiecutter.email }}>\\n" 60 | "Language: en\\n" 61 | "MIME-Version: 1.0\\n" 62 | "Content-Type: text/plain; charset=UTF-8\\n" 63 | "Content-Transfer-Encoding: 8bit\\n"' 64 | 65 | echo $pot > messages.pot 66 | cat ./messages.pot.tmp >> messages.pot 67 | rm ./messages.pot.tmp 68 | 69 | sed "s/#version/$version/g" messages.pot -i 70 | sed "s/#datel/$datel/g" messages.pot -i 71 | 72 | if [[ "$LOCALETYPE" == "gettext-tx" ]]; then 73 | tx push -s 74 | tx pull 75 | fi 76 | 77 | for i in ./locale/*; do 78 | language=$(basename $i) 79 | 80 | podir="./locale/$language/LC_MESSAGES" 81 | popath="./locale/$language/LC_MESSAGES/$PROJECTLC.po" 82 | sed 's/\"Project-Id-Version: .*/\"Project-Id-Version: '$version'\\n\"/' $popath -i 83 | msgmerge $popath messages.pot -o $popath 84 | fuzzy=$(cat $popath | grep -c '#, fuzzy') 85 | empty=$(cat $popath | pcregrep -cM 'msgstr ""\n$') 86 | if [ $fuzzy != '0' ]; then 87 | echo "WARNING: $fuzzy fuzzy strings in language $language." 88 | fi 89 | 90 | if [ $empty != '0' ]; then 91 | echo "WARNING: $empty empty strings in language $language." 92 | fi 93 | 94 | msgfmt -o $podir/$PROJECTLC.mo $popath 95 | done 96 | ;; 97 | 'pyqt4' | 'pyqt4-tx') 98 | pylupdate4 -verbose $PROJECTLC.pro 99 | if [[ "$LOCALETYPE" == "pyqt4-tx" ]]; then 100 | tx push -s 101 | tx pull 102 | fi 103 | for i in ./locale/*.ts; do 104 | # pylupdate4 is dumb and mangles encodings 105 | sed -i -e 's|filename="|filename="../|g' -e \ 106 | 's|“|“|g' -e 's|”|”|g' -e \ 107 | 's|‘|‘|g' -e 's|’|’|g' -e \ 108 | 's|…|…|g' -e 's|–|–|g' -e \ 109 | 's|—|—|g' $i 110 | done 111 | lrelease $PROJECTLC.pro 112 | pyrcc4 -py2 $PROJECTLC.qrc -o $PROJECTLC/ui/resources2.py 113 | pyrcc4 -py3 $PROJECTLC.qrc -o $PROJECTLC/ui/resources3.py 114 | ;; 115 | 'pyqt5' | 'pyqt5-tx') 116 | pylupdate5 -verbose $PROJECTLC.pro 117 | if [[ "$LOCALETYPE" == "pyqt5-tx" ]]; then 118 | tx push -s 119 | tx pull 120 | fi 121 | for i in ./locale/*.ts; do 122 | # pylupdate5 is dumb and mangles encodings 123 | sed -i -e 's|filename="|filename="../|g' -e \ 124 | 's|“|“|g' -e 's|”|”|g' -e \ 125 | 's|‘|‘|g' -e 's|’|’|g' -e \ 126 | 's|…|…|g' -e 's|–|–|g' -e \ 127 | 's|—|—|g' $i 128 | done 129 | lrelease $PROJECTLC.pro 130 | pyrcc5 -py2 $PROJECTLC.qrc -o $PROJECTLC/ui/resources2.py 131 | pyrcc5 -py3 $PROJECTLC.qrc -o $PROJECTLC/ui/resources3.py 132 | ;; 133 | 'pyside' | 'pyside-tx') 134 | pyside-lupdate -verbose $PROJECTLC.pro 135 | if [[ "$LOCALETYPE" == "pyside-tx" ]]; then 136 | tx push -s 137 | tx pull 138 | fi 139 | for i in ./locale/*.ts; do 140 | # pyside may be dumb, too 141 | sed -i -e 's|filename="|filename="../|g' -e \ 142 | 's|“|“|g' -e 's|”|”|g' -e \ 143 | 's|‘|‘|g' -e 's|’|’|g' -e \ 144 | 's|…|…|g' -e 's|–|–|g' -e \ 145 | 's|—|—|g' $i 146 | done 147 | lrelease $PROJECTLC.pro 148 | pyside-rcc -py2 $PROJECTLC.qrc -o $PROJECTLC/ui/resources2.py 149 | pyside-rcc -py3 $PROJECTLC.qrc -o $PROJECTLC/ui/resources3.py 150 | 151 | 152 | ;; 153 | 'none') true ;; 154 | *) echo 'ERROR: unknown locale type.'; false 155 | esac 156 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/AUTHORS: -------------------------------------------------------------------------------- 1 | {{ cookiecutter.full_name }} <{{ cookiecutter.email }}> 2 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | ===================== 2 | Appendix C. Changelog 3 | ===================== 4 | :Info: This is the changelog for {{ cookiecutter.project_name }}. 5 | :Author: {{ cookiecutter.full_name }} <{{ cookiecutter.email }}> 6 | :Copyright: © {{ cookiecutter.year }}, {{ cookiecutter.full_name }}. 7 | :License: BSD (see /LICENSE or :doc:`Appendix B `.) 8 | :Date: {{ cookiecutter.release_date }} 9 | :Version: {{ cookiecutter.version }} 10 | 11 | .. index:: CHANGELOG 12 | 13 | GitHub holds releases, too 14 | ========================== 15 | 16 | More information can be found on GitHub in the `releases section 17 | `_. 18 | 19 | Version History 20 | =============== 21 | 22 | 0.1.0 23 | Initial release. 24 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/CONTRIBUTING.rst: -------------------------------------------------------------------------------- 1 | ============================== 2 | Appendix A. Contribution rules 3 | ============================== 4 | :Info: Those are the contribution rules for {{ cookiecutter.project_name }}. 5 | :Copyright: © 2012-2023, Chris Warrick. 6 | :License: 3-clause BSD 7 | 8 | .. index:: contributing 9 | 10 | Do you want to contribute to this project? Great! I’d love to see some help, 11 | but you must comply with some rules. 12 | 13 | The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL 14 | NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and 15 | “OPTIONAL” in this document are to be interpreted as described in 16 | RFC 2119. 17 | 18 | --------------- 19 | Issue reporting 20 | --------------- 21 | 22 | .. index:: issues 23 | 24 | GitHub Issues are the recommended way to report an issue. If you do not have an 25 | account there, get one or mail me. 26 | 27 | When pasting console sessions, you must paste them fully, *prompt-to-prompt*, 28 | to see all the messages and your input. Trim only stuff that you are 1000% 29 | sure that is not related to the project in question. 30 | 31 | -------------------------------------------- 32 | General preparations, rules and pull process 33 | -------------------------------------------- 34 | 35 | Prepare 36 | ======= 37 | 38 | A GitHub account is recommended. Patches by mail are accepted, but I’d prefer 39 | to work via GitHub. 40 | 41 | .. _Rules: 42 | 43 | Rules 44 | ===== 45 | 46 | 1. Commits must have short, informative and logical messages. Signoffs and 47 | long messages are recommended. “Fix #xxx” is required if an issue 48 | exists. 49 | 2. The following fancy Unicode characters should be used when 50 | needed: ``— “ ” ‘ ’``. ``…`` should not appear in console output, but may 51 | appear elsewhere. 52 | 3. For Python code, use the PEP 8 coding style and PEP 257 documentation style. 53 | For other languages, K&R style applies. Braces are mandatory in all blocks 54 | (even one-line blocks). Braces are on the same lines as class names and 55 | function signatures. Use 4-space indents. 56 | 57 | Request a Pull 58 | ============== 59 | 60 | Done? Go hit the **Pull Request** button over on GitHub! And if you don’t 61 | use GitHub, ``git format-patch``. Other formats are not accepted. 62 | 63 | Your commit should be pulled up in a (longer) while. If I like it. Because 64 | some commits may be bad. So, do your best not to do those bad commits. 65 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright © {{ cookiecutter.year }}, {{ cookiecutter.full_name }}. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions, and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions, and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | 3. Neither the name of the author of this software nor the names of 16 | contributors to this software may be used to endorse or promote 17 | products derived from this software without specific prior written 18 | consent. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/MANIFEST.in: -------------------------------------------------------------------------------- 1 | graft {{ cookiecutter.repo_name }} 2 | graft docs 3 | graft tests 4 | include README.rst AUTHORS LICENSE CHANGELOG.rst setup.py setup.cfg requirements.txt 5 | global-exclude __pycache__ *.pyc 6 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/PKGBUILD: -------------------------------------------------------------------------------- 1 | # Maintainer: {{ cookiecutter.full_name }} <{{ cookiecutter.aur_email }}> 2 | pkgbase=python-{{ cookiecutter.repo_name }} 3 | pkgname=('python-{{ cookiecutter.repo_name }}' 'python2-{{ cookiecutter.repo_name }}') 4 | _pyname={{ cookiecutter.repo_name }} 5 | pkgver=0.1.0 6 | pkgrel=1 7 | pkgdesc='{{ cookiecutter.project_short_description }}' 8 | arch=('any') 9 | url='https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.repo_name }}' 10 | license=('BSD') 11 | makedepends=('python' 'python2' 'python-setuptools' 'python2-setuptools') 12 | options=(!emptydirs) 13 | source=("https://pypi.io/packages/source/${_pyname:0:1}/${_pyname}/${_pyname}-${pkgver}.tar.gz") 14 | md5sums=('01189998819999197253aa0118999881') 15 | 16 | prepare() { 17 | cd "${srcdir}/${_pyname}-${pkgver}" 18 | cp -r "${srcdir}/${_pyname}-${pkgver}" "${srcdir}/${_pyname}-${pkgver}-py2" 19 | } 20 | 21 | package_python-{{ cookiecutter.repo_name }}() { 22 | depends=('python' 'python-setuptools') 23 | cd "${srcdir}/${_pyname}-${pkgver}" 24 | python3 setup.py install --root="${pkgdir}/" --optimize=1 25 | install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgbase}/LICENSE" 26 | } 27 | 28 | package_python2-{{ cookiecutter.repo_name }}() { 29 | depends=('python2' 'python2-setuptools') 30 | cd "${srcdir}/${_pyname}-${pkgver}-py2" 31 | python2 setup.py install --root="${pkgdir}/" --optimize=1 32 | } 33 | 34 | # vim:set ts=2 sw=2 et: 35 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/PKGBUILD-git: -------------------------------------------------------------------------------- 1 | # Maintainer: {{ cookiecutter.full_name }} <{{ cookiecutter.aur_email }}> 2 | pkgbase=python-{{ cookiecutter.repo_name }}-git 3 | pkgname=('python-{{ cookiecutter.repo_name }}-git' 'python2-{{ cookiecutter.repo_name }}-git') 4 | _pyname={{ cookiecutter.repo_name }} 5 | _gitname={{ cookiecutter.repo_name }} 6 | pkgver=20170101 7 | pkgrel=1 8 | pkgdesc='{{ cookiecutter.project_short_description }}' 9 | arch=('any') 10 | url='https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.repo_name }}' 11 | license=('BSD') 12 | makedepends=('git' 'python' 'python2' 'python-setuptools' 'python2-setuptools') 13 | options=(!emptydirs) 14 | source=("git+https://github.com/{{ cookiecutter.github_username }}/${_gitname}") 15 | md5sums=('SKIP') 16 | 17 | prepare() { 18 | cd "${srcdir}/${_gitname}" 19 | cp -R "${srcdir}/${_gitname}" "${srcdir}/${_gitname}-py2" 20 | } 21 | 22 | package_python-{{ cookiecutter.repo_name }}-git() { 23 | depends=('python' 'python-setuptools') 24 | provides=('python-{{ cookiecutter.repo_name }}') 25 | conflicts=('python-{{ cookiecutter.repo_name }}') 26 | cd "${srcdir}/${_gitname}" 27 | python3 setup.py install --root="${pkgdir}/" --optimize=1 28 | install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgbase}/LICENSE" 29 | } 30 | 31 | package_python2-{{ cookiecutter.repo_name }}-git() { 32 | depends=('python2' 'python2-setuptools') 33 | provides=('python2-{{ cookiecutter.repo_name }}') 34 | conflicts=('python2-{{ cookiecutter.repo_name }}') 35 | cd "${srcdir}/${_gitname}-py2" 36 | python2 setup.py install --root="${pkgdir}/" --optimize=1 37 | } 38 | 39 | pkgver() { 40 | cd "${srcdir}/${_gitname}" 41 | git describe --long | sed -E 's/([^-]*-g)/r\1/;s/-/./g;s/^v//' 42 | } 43 | 44 | # vim:set ts=2 sw=2 et: 45 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/README: -------------------------------------------------------------------------------- 1 | ============================================================================== 2 | {{ cookiecutter.project_name }}. {{ cookiecutter.project_short_description }} 3 | ============================================================================== 4 | :Info: This is the README file for {{ cookiecutter.project_name }}. 5 | :Author: {{ cookiecutter.full_name }} <{{ cookiecutter.email }}> 6 | :Copyright: © {{ cookiecutter.year }}, {{ cookiecutter.full_name }}. 7 | :Date: {{ cookiecutter.release_date }} 8 | :Version: {{ cookiecutter.version }} 9 | 10 | .. index: README 11 | .. image:: https://travis-ci.org/{{ cookiecutter.github_username }}/{{ cookiecutter.repo_name }}.svg?branch=master 12 | :target: https://travis-ci.org/{{ cookiecutter.github_username }}/{{ cookiecutter.repo_name }} 13 | 14 | PURPOSE 15 | ------- 16 | 17 | INSTALLATION 18 | ------------ 19 | 20 | USAGE 21 | ----- 22 | 23 | NOTES 24 | ----- 25 | 26 | COPYRIGHT 27 | --------- 28 | Copyright © {{ cookiecutter.year }}, {{ cookiecutter.full_name }}. 29 | All rights reserved. 30 | 31 | Redistribution and use in source and binary forms, with or without 32 | modification, are permitted provided that the following conditions are 33 | met: 34 | 35 | 1. Redistributions of source code must retain the above copyright 36 | notice, this list of conditions, and the following disclaimer. 37 | 38 | 2. Redistributions in binary form must reproduce the above copyright 39 | notice, this list of conditions, and the following disclaimer in the 40 | documentation and/or other materials provided with the distribution. 41 | 42 | 3. Neither the name of the author of this software nor the names of 43 | contributors to this software may be used to endorse or promote 44 | products derived from this software without specific prior written 45 | consent. 46 | 47 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 48 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 49 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 50 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 51 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 52 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 53 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 54 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 55 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 56 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 57 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 58 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/README.rst: -------------------------------------------------------------------------------- 1 | ============================================================================== 2 | {{ cookiecutter.project_name }}. {{ cookiecutter.project_short_description }} 3 | ============================================================================== 4 | :Info: This is the README file for {{ cookiecutter.project_name }}. 5 | :Author: {{ cookiecutter.full_name }} <{{ cookiecutter.email }}> 6 | :Copyright: © {{ cookiecutter.year }}, {{ cookiecutter.full_name }}. 7 | :Date: {{ cookiecutter.release_date }} 8 | :Version: {{ cookiecutter.version }} 9 | 10 | .. index: README 11 | .. image:: https://travis-ci.org/{{ cookiecutter.github_username }}/{{ cookiecutter.repo_name }}.svg?branch=master 12 | :target: https://travis-ci.org/{{ cookiecutter.github_username }}/{{ cookiecutter.repo_name }} 13 | 14 | PURPOSE 15 | ------- 16 | 17 | INSTALLATION 18 | ------------ 19 | 20 | USAGE 21 | ----- 22 | 23 | NOTES 24 | ----- 25 | 26 | COPYRIGHT 27 | --------- 28 | Copyright © {{ cookiecutter.year }}, {{ cookiecutter.full_name }}. 29 | All rights reserved. 30 | 31 | Redistribution and use in source and binary forms, with or without 32 | modification, are permitted provided that the following conditions are 33 | met: 34 | 35 | 1. Redistributions of source code must retain the above copyright 36 | notice, this list of conditions, and the following disclaimer. 37 | 38 | 2. Redistributions in binary form must reproduce the above copyright 39 | notice, this list of conditions, and the following disclaimer in the 40 | documentation and/or other materials provided with the distribution. 41 | 42 | 3. Neither the name of the author of this software nor the names of 43 | contributors to this software may be used to endorse or promote 44 | products derived from this software without specific prior written 45 | consent. 46 | 47 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 48 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 49 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 50 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 51 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 52 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 53 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 54 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 55 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 56 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 57 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 58 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/docs/CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | ===================== 2 | Appendix C. Changelog 3 | ===================== 4 | :Info: This is the changelog for {{ cookiecutter.project_name }}. 5 | :Author: {{ cookiecutter.full_name }} <{{ cookiecutter.email }}> 6 | :Copyright: © {{ cookiecutter.year }}, {{ cookiecutter.full_name }}. 7 | :License: BSD (see /LICENSE or :doc:`Appendix B `.) 8 | :Date: {{ cookiecutter.release_date }} 9 | :Version: {{ cookiecutter.version }} 10 | 11 | .. index:: CHANGELOG 12 | 13 | GitHub holds releases, too 14 | ========================== 15 | 16 | More information can be found on GitHub in the `releases section 17 | `_. 18 | 19 | Version History 20 | =============== 21 | 22 | 0.1.0 23 | Initial release. 24 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/docs/CONTRIBUTING.rst: -------------------------------------------------------------------------------- 1 | ============================== 2 | Appendix A. Contribution rules 3 | ============================== 4 | :Info: Those are the contribution rules for {{ cookiecutter.project_name }}. 5 | :Copyright: © 2012-2023, Chris Warrick. 6 | :License: 3-clause BSD 7 | 8 | .. index:: contributing 9 | 10 | Do you want to contribute to this project? Great! I’d love to see some help, 11 | but you must comply with some rules. 12 | 13 | The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL 14 | NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and 15 | “OPTIONAL” in this document are to be interpreted as described in 16 | RFC 2119. 17 | 18 | --------------- 19 | Issue reporting 20 | --------------- 21 | 22 | .. index:: issues 23 | 24 | GitHub Issues are the recommended way to report an issue. If you do not have an 25 | account there, get one or mail me. 26 | 27 | When pasting console sessions, you must paste them fully, *prompt-to-prompt*, 28 | to see all the messages and your input. Trim only stuff that you are 1000% 29 | sure that is not related to the project in question. 30 | 31 | -------------------------------------------- 32 | General preparations, rules and pull process 33 | -------------------------------------------- 34 | 35 | Prepare 36 | ======= 37 | 38 | A GitHub account is recommended. Patches by mail are accepted, but I’d prefer 39 | to work via GitHub. 40 | 41 | .. _Rules: 42 | 43 | Rules 44 | ===== 45 | 46 | 1. Commits must have short, informative and logical messages. Signoffs and 47 | long messages are recommended. “Fix #xxx” is required if an issue 48 | exists. 49 | 2. The following fancy Unicode characters should be used when 50 | needed: ``— “ ” ‘ ’``. ``…`` should not appear in console output, but may 51 | appear elsewhere. 52 | 3. For Python code, use the PEP 8 coding style and PEP 257 documentation style. 53 | For other languages, K&R style applies. Braces are mandatory in all blocks 54 | (even one-line blocks). Braces are on the same lines as class names and 55 | function signatures. Use 4-space indents. 56 | 57 | Request a Pull 58 | ============== 59 | 60 | Done? Go hit the **Pull Request** button over on GitHub! And if you don’t 61 | use GitHub, ``git format-patch``. Other formats are not accepted. 62 | 63 | Your commit should be pulled up in a (longer) while. If I like it. Because 64 | some commits may be bad. So, do your best not to do those bad commits. 65 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/docs/LICENSE.rst: -------------------------------------------------------------------------------- 1 | ======================================================= 2 | Appendix B. License for {{ cookiecutter.project_name }} 3 | ======================================================= 4 | :Info: This is the license for {{ cookiecutter.project_name }}. 5 | :Author: {{ cookiecutter.full_name }} <{{ cookiecutter.email }}> 6 | :Copyright: © {{ cookiecutter.year }}, {{ cookiecutter.full_name }}. 7 | :License: BSD (see /LICENSE or :doc:`Appendix B `.) 8 | :Date: {{ cookiecutter.release_date }} 9 | :Version: {{ cookiecutter.version }} 10 | 11 | .. index:: LICENSE 12 | 13 | Copyright © {{ cookiecutter.year }}, {{ cookiecutter.full_name }}. 14 | All rights reserved. 15 | 16 | Redistribution and use in source and binary forms, with or without 17 | modification, are permitted provided that the following conditions are 18 | met: 19 | 20 | 1. Redistributions of source code must retain the above copyright 21 | notice, this list of conditions, and the following disclaimer. 22 | 23 | 2. Redistributions in binary form must reproduce the above copyright 24 | notice, this list of conditions, and the following disclaimer in the 25 | documentation and/or other materials provided with the distribution. 26 | 27 | 3. Neither the name of the author of this software nor the names of 28 | contributors to this software may be used to endorse or promote 29 | products derived from this software without specific prior written 30 | consent. 31 | 32 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 33 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 34 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 35 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 36 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 37 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 38 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 39 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 40 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 41 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 42 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 43 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/docs/README.rst: -------------------------------------------------------------------------------- 1 | ============================================================================== 2 | {{ cookiecutter.project_name }}. {{ cookiecutter.project_short_description }} 3 | ============================================================================== 4 | :Info: This is the README file for {{ cookiecutter.project_name }}. 5 | :Author: {{ cookiecutter.full_name }} <{{ cookiecutter.email }}> 6 | :Copyright: © {{ cookiecutter.year }}, {{ cookiecutter.full_name }}. 7 | :Date: {{ cookiecutter.release_date }} 8 | :Version: {{ cookiecutter.version }} 9 | 10 | .. index: README 11 | .. image:: https://travis-ci.org/{{ cookiecutter.github_username }}/{{ cookiecutter.repo_name }}.svg?branch=master 12 | :target: https://travis-ci.org/{{ cookiecutter.github_username }}/{{ cookiecutter.repo_name }} 13 | 14 | PURPOSE 15 | ------- 16 | 17 | INSTALLATION 18 | ------------ 19 | 20 | USAGE 21 | ----- 22 | 23 | NOTES 24 | ----- 25 | 26 | COPYRIGHT 27 | --------- 28 | Copyright © {{ cookiecutter.year }}, {{ cookiecutter.full_name }}. 29 | All rights reserved. 30 | 31 | Redistribution and use in source and binary forms, with or without 32 | modification, are permitted provided that the following conditions are 33 | met: 34 | 35 | 1. Redistributions of source code must retain the above copyright 36 | notice, this list of conditions, and the following disclaimer. 37 | 38 | 2. Redistributions in binary form must reproduce the above copyright 39 | notice, this list of conditions, and the following disclaimer in the 40 | documentation and/or other materials provided with the distribution. 41 | 42 | 3. Neither the name of the author of this software nor the names of 43 | contributors to this software may be used to endorse or promote 44 | products derived from this software without specific prior written 45 | consent. 46 | 47 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 48 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 49 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 50 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 51 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 52 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 53 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 54 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 55 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 56 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 57 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 58 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/docs/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # {{ cookiecutter.project_name }} documentation build configuration file, created by 4 | # sphinx-quickstart on Fri Dec 14 21:02:58 2012. 5 | # 6 | # This file is execfile()d with the current directory set to its containing dir. 7 | # 8 | # Note that not all possible configuration values are present in this 9 | # autogenerated file. 10 | # 11 | # All configuration values have a default; values that are commented out 12 | # serve to show the default. 13 | 14 | import sys, os 15 | 16 | # If extensions (or modules to document with autodoc) are in another directory, 17 | # add these directories to sys.path here. If the directory is relative to the 18 | # documentation root, use os.path.abspath to make it absolute, like shown here. 19 | #sys.path.insert(0, os.path.abspath('.')) 20 | 21 | # -- General configuration ----------------------------------------------------- 22 | 23 | # If your documentation needs a minimal Sphinx version, state it here. 24 | #needs_sphinx = '1.0' 25 | 26 | # Add any Sphinx extension module names here, as strings. They can be extensions 27 | # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. 28 | extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.ifconfig', 'sphinx.ext.viewcode'] 29 | 30 | # Add any paths that contain templates here, relative to this directory. 31 | templates_path = ['_templates'] 32 | 33 | # The suffix of source filenames. 34 | source_suffix = '.rst' 35 | 36 | # The encoding of source files. 37 | #source_encoding = 'utf-8-sig' 38 | 39 | # The master toctree document. 40 | master_doc = 'index' 41 | 42 | # General information about the project. 43 | project = u'{{ cookiecutter.project_name }}' 44 | copyright = u'{{ cookiecutter.year }}, {{ cookiecutter.full_name }}' 45 | 46 | # The version info for the project you're documenting, acts as replacement for 47 | # |version| and |release|, also used in various other places throughout the 48 | # built documents. 49 | # 50 | # The short X.Y version. 51 | version = '{{ cookiecutter.version }}' 52 | # The full version, including alpha/beta/rc tags. 53 | release = '{{ cookiecutter.version }}' 54 | 55 | # The language for content autogenerated by Sphinx. Refer to documentation 56 | # for a list of supported languages. 57 | #language = None 58 | 59 | # There are two options for replacing |today|: either, you set today to some 60 | # non-false value, then it is used: 61 | #today = '' 62 | # Else, today_fmt is used as the format for a strftime call. 63 | #today_fmt = '%B %d, %Y' 64 | 65 | # List of patterns, relative to source directory, that match files and 66 | # directories to ignore when looking for source files. 67 | exclude_patterns = ['_build'] 68 | 69 | # The reST default role (used for this markup: `text`) to use for all documents. 70 | #default_role = None 71 | 72 | # If true, '()' will be appended to :func: etc. cross-reference text. 73 | #add_function_parentheses = True 74 | 75 | # If true, the current module name will be prepended to all description 76 | # unit titles (such as .. function::). 77 | #add_module_names = True 78 | 79 | # If true, sectionauthor and moduleauthor directives will be shown in the 80 | # output. They are ignored by default. 81 | #show_authors = False 82 | 83 | # The name of the Pygments (syntax highlighting) style to use. 84 | pygments_style = 'sphinx' 85 | 86 | # A list of ignored prefixes for module index sorting. 87 | #modindex_common_prefix = [] 88 | 89 | 90 | # -- Options for HTML output --------------------------------------------------- 91 | 92 | # The theme to use for HTML and HTML Help pages. See the documentation for 93 | # a list of builtin themes. 94 | html_theme = 'default' 95 | 96 | # Theme options are theme-specific and customize the look and feel of a theme 97 | # further. For a list of options available for each theme, see the 98 | # documentation. 99 | #html_theme_options = {} 100 | 101 | # Add any paths that contain custom themes here, relative to this directory. 102 | #html_theme_path = [] 103 | 104 | # The name for this set of Sphinx documents. If None, it defaults to 105 | # " v documentation". 106 | #html_title = None 107 | 108 | # A shorter title for the navigation bar. Default is the same as html_title. 109 | #html_short_title = None 110 | 111 | # The name of an image file (relative to this directory) to place at the top 112 | # of the sidebar. 113 | #html_logo = None 114 | 115 | # The name of an image file (within the static path) to use as favicon of the 116 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 117 | # pixels large. 118 | #html_favicon = None 119 | 120 | # Add any paths that contain custom static files (such as style sheets) here, 121 | # relative to this directory. They are copied after the builtin static files, 122 | # so a file named "default.css" will overwrite the builtin "default.css". 123 | html_static_path = ['_static'] 124 | 125 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 126 | # using the given strftime format. 127 | #html_last_updated_fmt = '%b %d, %Y' 128 | 129 | # If true, SmartyPants will be used to convert quotes and dashes to 130 | # typographically correct entities. 131 | #html_use_smartypants = True 132 | 133 | # Custom sidebar templates, maps document names to template names. 134 | #html_sidebars = {} 135 | 136 | # Additional templates that should be rendered to pages, maps page names to 137 | # template names. 138 | #html_additional_pages = {} 139 | 140 | # If false, no module index is generated. 141 | #html_domain_indices = True 142 | 143 | # If false, no index is generated. 144 | #html_use_index = True 145 | 146 | # If true, the index is split into individual pages for each letter. 147 | #html_split_index = False 148 | 149 | # If true, links to the reST sources are added to the pages. 150 | #html_show_sourcelink = True 151 | 152 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 153 | #html_show_sphinx = True 154 | 155 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 156 | #html_show_copyright = True 157 | 158 | # If true, an OpenSearch description file will be output, and all pages will 159 | # contain a tag referring to it. The value of this option must be the 160 | # base URL from which the finished HTML is served. 161 | #html_use_opensearch = '' 162 | 163 | # This is the file name suffix for HTML files (e.g. ".xhtml"). 164 | #html_file_suffix = None 165 | 166 | # Output file base name for HTML help builder. 167 | htmlhelp_basename = '{{ cookiecutter.project_name }}doc' 168 | 169 | 170 | # -- Options for LaTeX output -------------------------------------------------- 171 | 172 | # The paper size ('letter' or 'a4'). 173 | #latex_paper_size = 'letter' 174 | 175 | # The font size ('10pt', '11pt' or '12pt'). 176 | #latex_font_size = '10pt' 177 | 178 | # Grouping the document tree into LaTeX files. List of tuples 179 | # (source start file, target name, title, author, documentclass [howto/manual]). 180 | latex_documents = [ 181 | ('index', '{{ cookiecutter.repo_name }}.tex', u'{{ cookiecutter.project_name }} Documentation', 182 | u'{{ cookiecutter.full_name }}', 'manual'), 183 | ] 184 | 185 | latex_elements = {'papersize': 'a4paper', 'fontpkg': '\\usepackage{tgheros}', 186 | 'fncychap': '\\usepackage[Sonny]{fncychap}'} 187 | 188 | # The name of an image file (relative to this directory) to place at the top of 189 | # the title page. 190 | #latex_logo = None 191 | 192 | # For "manual" documents, if this is true, then toplevel headings are parts, 193 | # not chapters. 194 | #latex_use_parts = False 195 | 196 | # If true, show page references after internal links. 197 | #latex_show_pagerefs = False 198 | 199 | # If true, show URL addresses after external links. 200 | #latex_show_urls = False 201 | 202 | # Additional stuff for the LaTeX preamble. 203 | #latex_preamble = '' 204 | 205 | # Documents to append as an appendix to all manuals. 206 | #latex_appendices = [] 207 | 208 | # If false, no module index is generated. 209 | #latex_domain_indices = True 210 | 211 | 212 | # -- Options for manual page output -------------------------------------------- 213 | 214 | # One entry per manual page. List of tuples 215 | # (source start file, name, description, authors, manual section). 216 | man_pages = [ 217 | ('index', '{{ cookiecutter.repo_name }}', u'{{ cookiecutter.project_name }} Documentation', 218 | [u'{{ cookiecutter.full_name }}'], 1) 219 | ] 220 | 221 | 222 | # Example configuration for intersphinx: refer to the Python standard library. 223 | intersphinx_mapping = {'http://docs.python.org/': None} 224 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/docs/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Redirecting to Read The Docs 4 | 5 | The docs are at {{ cookiecutter.repo_name }}.readthedocs.org. 6 | You will be redirected there in a while. If not, click the link above. 7 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/docs/index.rst: -------------------------------------------------------------------------------- 1 | =============================== 2 | {{ cookiecutter.project_name }} 3 | =============================== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | README for {{ cookiecutter.project_name }} 9 | CONTRIBUTING 10 | LICENSE 11 | CHANGELOG 12 | 13 | Indices and tables 14 | ================== 15 | 16 | * :ref:`genindex` 17 | * :ref:`modindex` 18 | * :ref:`search` 19 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/pypt-extras/AUR/AURvm/aurvm_client.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # AURvm client script 4 | # Usage: ./aurvm_client.py $PROJECT $AUR_PKGNAME $AUR_PKGNAME_GIT $version use_git[true|false] 5 | # Part of the Python Project Template. 6 | # Copyright © 2013-2023, Chris Warrick. 7 | # All rights reserved. 8 | # 9 | # Redistribution and use in source and binary forms, with or without 10 | # modification, are permitted provided that the following conditions are 11 | # met: 12 | # 13 | # 1. Redistributions of source code must retain the above copyright 14 | # notice, this list of conditions, and the following disclaimer. 15 | # 16 | # 2. Redistributions in binary form must reproduce the above copyright 17 | # notice, this list of conditions, and the following disclaimer in the 18 | # documentation and/or other materials provided with the distribution. 19 | # 20 | # 3. Neither the name of the author of this software nor the names of 21 | # contributors to this software may be used to endorse or promote 22 | # products derived from this software without specific prior written 23 | # consent. 24 | # 25 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | 37 | import base64 38 | import io 39 | import json 40 | import subprocess 41 | import sys 42 | 43 | try: 44 | _, project, aur_pkgname, aur_pkgname_git, version, use_git = sys.argv 45 | except ValueError: 46 | sys.stderr.write("Usage: ./aurvm_client.py $PROJECT $AUR_PKGANME $AUR_PKGNAME_GIT $version use_git[true|false]\n") 47 | sys.exit(1) 48 | 49 | use_git = True if use_git == 'true' else False 50 | if use_git: 51 | gitver = subprocess.check_output(r"git describe --long | sed -E 's/([^-]*-g)/r\1/;s/-/./g;s/^v//g'", shell=True) 52 | gitver = gitver.decode('utf-8').strip() 53 | else: 54 | gitver = None 55 | 56 | with io.open('PKGBUILD', 'r', encoding='utf-8') as fh: 57 | pkgbuild = fh.read() 58 | 59 | data = json.dumps({ 60 | 'project': project, 61 | 'aur_pkgname': aur_pkgname, 62 | 'aur_pkgname_git': aur_pkgname_git, 63 | 'version': version, 64 | 'use_git': use_git, 65 | 'gitver': gitver, 66 | 'pkgbuild': pkgbuild, 67 | '_api': '2' 68 | }, ensure_ascii=True, sort_keys=True).encode('utf-8') 69 | 70 | print(base64.b64encode(data).decode('utf-8')) 71 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/pypt-extras/AUR/AURvm/aurvm_heartbeat.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo "AURvm OK" 3 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/pypt-extras/AUR/AURvm/aurvm_host.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # AURvm host script 4 | # Usage: base64-encoded JSON on stdin 5 | # Part of the Python Project Template. 6 | # Copyright © 2013-2023, Chris Warrick. 7 | # All rights reserved. 8 | # 9 | # Redistribution and use in source and binary forms, with or without 10 | # modification, are permitted provided that the following conditions are 11 | # met: 12 | # 13 | # 1. Redistributions of source code must retain the above copyright 14 | # notice, this list of conditions, and the following disclaimer. 15 | # 16 | # 2. Redistributions in binary form must reproduce the above copyright 17 | # notice, this list of conditions, and the following disclaimer in the 18 | # documentation and/or other materials provided with the distribution. 19 | # 20 | # 3. Neither the name of the author of this software nor the names of 21 | # contributors to this software may be used to endorse or promote 22 | # products derived from this software without specific prior written 23 | # consent. 24 | # 25 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | 37 | import base64 38 | import io 39 | import json 40 | import os 41 | import subprocess 42 | import sys 43 | 44 | BASEDIR = os.path.expanduser('~/git/aur-pkgbuilds') 45 | 46 | 47 | def commitaur(msg): 48 | with open('.SRCINFO', 'wb') as fh: 49 | fh.write(subprocess.check_output(['makepkg', '--printsrcinfo'])) 50 | subprocess.check_call(['git', 'add', '.']) 51 | subprocess.check_call(['git', 'commit', '-asm', msg]) 52 | subprocess.check_call(['git', 'push', '-u', 'origin', 'master']) 53 | 54 | 55 | data = base64.b64decode(sys.stdin.read().encode('utf-8')) 56 | data = json.loads(data.decode('utf-8')) 57 | if data['_api'] != '2': 58 | print("API version does not match") 59 | 60 | msg = data['project'] + ' v' + data['version'] 61 | sys.stderr.write("[host] Updating AUR packages...\n") 62 | sys.stderr.flush() 63 | 64 | os.chdir(BASEDIR) 65 | os.chdir(data['aur_pkgname']) 66 | with io.open('PKGBUILD', 'w', encoding='utf-8') as fh: 67 | fh.write(data['pkgbuild']) 68 | commitaur(msg) 69 | os.chdir(BASEDIR) 70 | 71 | if data['use_git']: 72 | os.chdir(data['aur_pkgname_git']) 73 | subprocess.check_call(["sed", "s/pkgver=.*/pkgver=" + data['gitver'] + "/", "PKGBUILD", "-i"]) 74 | commitaur(msg) 75 | os.chdir(BASEDIR) 76 | 77 | subprocess.check_call(['./UPDATE-REQUIREMENTS.py']) 78 | subprocess.check_call(['git', 'commit', '-asm', msg]) 79 | subprocess.check_call(['git', 'push']) 80 | sys.stderr.write("[host] Done!\n") 81 | sys.stderr.flush() 82 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/pypt-extras/AUR/hooks/post-release.hook: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | # AUR post-release hook 3 | # Part of the Python Project Template. 4 | # Copyright © 2013-2023, Chris Warrick. 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are 9 | # met: 10 | # 11 | # 1. Redistributions of source code must retain the above copyright 12 | # notice, this list of conditions, and the following disclaimer. 13 | # 14 | # 2. Redistributions in binary form must reproduce the above copyright 15 | # notice, this list of conditions, and the following disclaimer in the 16 | # documentation and/or other materials provided with the distribution. 17 | # 18 | # 3. Neither the name of the author of this software nor the names of 19 | # contributors to this software may be used to endorse or promote 20 | # products derived from this software without specific prior written 21 | # consent. 22 | # 23 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 26 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 29 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 30 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | 35 | . .pypt/config 36 | 37 | # To change the default option, move the ` || "$rln" == ""` condition 38 | # wherever you desire and change the capital letter in the prompt 39 | echo -n "Update AUR packages? [Remotely/locally/no] " 40 | read rln 41 | if [[ "$rln" == "N" || "$rln" == "n" ]]; then 42 | exit 0 43 | fi 44 | if [[ "$rln" == "L" || "$rln" == "l" ]]; then 45 | echo "Updating AUR packages..." 46 | gitver=$(git describe --long | sed -E 's/([^-]*-g)/r\1/;s/-/./g;s/^v//g') 47 | 48 | cp PKGBUILD ~/git/aur-pkgbuilds/$AUR_PKGNAME/PKGBUILD 49 | cd ~/git/aur-pkgbuilds 50 | . ~/git/aur-pkgbuilds/aur.zsh 51 | 52 | cd $AUR_PKGNAME 53 | commitaur "$PROJECT v$version" 54 | 55 | if [[ "$AUR_GIT_PACKAGE" == "true" ]]; then 56 | cd $AUR_PKGNAME_GIT 57 | sed "s/pkgver=.*/pkgver=$gitver/" PKGBUILD -i 58 | commitaur "$PROJECT v$version" 59 | fi 60 | 61 | ./UPDATE-REQUIREMENTS.py 62 | git commit -asm "$PROJECT v$version" 63 | git push 64 | 65 | echo "Done!" 66 | fi 67 | if [[ "$rln" == "R" || "$rln" == "r" || "$rln" == "" ]]; then 68 | avout="" 69 | echo "[local] Attempting to remote into Arch Linux VM (ssh arch)..." 70 | while [[ "$avout" != "AURvm OK" ]]; do 71 | echo "[local] Sending heartbeat..." 72 | avout=$(ssh arch git/aur-pkgbuilds/aurvm_heartbeat.sh) 73 | done 74 | echo "[local] Sending data..." 75 | .pypt/AURvm/aurvm_client.py $PROJECT $AUR_PKGNAME $AUR_PKGNAME_GIT $version $AUR_GIT_PACKAGE | ssh arch git/aur-pkgbuilds/aurvm_host.py 76 | echo "[local] Done!" 77 | fi 78 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/pypt-extras/Qt/resources.py: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | # {{ cookiecutter.project_name }} v{{ cookiecutter.version }} 3 | # {{ cookiecutter.project_short_description }} 4 | # Copyright © {{ cookiecutter.year }}, {{ cookiecutter.full_name }}. 5 | # See /LICENSE for licensing information. 6 | # This file was adapted from Chris Warrick’s Python Project Template. 7 | 8 | """ 9 | Adapt Qt resources to Python version. 10 | 11 | :Copyright: © {{ cookiecutter.year }}, {{ cookiecutter.full_name }}. 12 | :License: BSD (see /LICENSE). 13 | """ 14 | 15 | __all__ = () 16 | 17 | import sys 18 | 19 | if sys.version_info[0] == 2: 20 | import {{ cookiecutter.repo_name }}.ui.resources2 # NOQA 21 | elif sys.version_info[0] == 3: 22 | import {{ cookiecutter.repo_name }}.ui.resources3 # NOQA 23 | else: 24 | print('FATAL: python version does not match `2` nor `3`') 25 | sys.exit(0) 26 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/release: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | # The Release Script 3 | # Part of the Python Project Template. 4 | # Copyright © 2013-2023, Chris Warrick. 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are 9 | # met: 10 | # 11 | # 1. Redistributions of source code must retain the above copyright 12 | # notice, this list of conditions, and the following disclaimer. 13 | # 14 | # 2. Redistributions in binary form must reproduce the above copyright 15 | # notice, this list of conditions, and the following disclaimer in the 16 | # documentation and/or other materials provided with the distribution. 17 | # 18 | # 3. Neither the name of the author of this software nor the names of 19 | # contributors to this software may be used to endorse or promote 20 | # products derived from this software without specific prior written 21 | # consent. 22 | # 23 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 26 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 29 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 30 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | 35 | . .pypt/config 36 | function status { 37 | echo $@ 38 | } 39 | 40 | function warning { 41 | echo 'WARNING: '$@ 42 | } 43 | 44 | function error { 45 | echo 'ERROR: '$@ 46 | } 47 | 48 | function cleanup { 49 | rm -rf $PROJECTLC.egg-info build || true 50 | rm -rf **/__pycache__ || true 51 | } 52 | 53 | function cleanup_cmfn { 54 | [[ -e $cmfn ]] && rm $cmfn || true 55 | [[ -e $cmfn2 ]] && rm $cmfn2 || true 56 | } 57 | 58 | status '*** Chris Warrick’s Release Scripts (PyPT)' 59 | 60 | echo -n "Version number: " 61 | read version 62 | 63 | echo $version | grep '^[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}$' > /dev/null 64 | 65 | if [[ $? != 0 ]]; then 66 | echo $version | grep '^[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\-[0-9A-Za-z-]\{1,\}$' > /dev/null 67 | if [[ $? != 0 ]]; then 68 | warning 'version number is not compliant with versioning scheme (Semantic Versioning 2.0)' 69 | echo -n 'Continue? [y/N] ' 70 | read vercont 71 | if [[ $vercont == 'y' || $vercont == 'Y' ]]; then 72 | echo 'Continuing.' 73 | else 74 | exit 2 75 | fi 76 | else 77 | status 'NOTICE: pre-release version number in use.' 78 | echo -n 'Continue? [Y/n] ' 79 | read vercont 80 | if [[ $vercont == 'n' || $vercont == 'N' ]]; then 81 | exit 2 82 | else 83 | echo 'Continuing.' 84 | fi 85 | fi 86 | fi 87 | 88 | # Creating all the dates at the exact same time. 89 | date=$(date '+%Y-%m-%d') 90 | datel=$(date '+%Y-%m-%d %H:%M%z') 91 | #datep=$(date '+%Y%m%d') 92 | dates=$(date '+%s') 93 | 94 | cmfn=$PWD/.git/kwrs-$dates 95 | cmfn2=$cmfn"-commit" 96 | 97 | cleanup 98 | cleanup_cmfn 99 | git add -A --ignore-errors . 100 | 101 | cat > $cmfn <> $cmfn 121 | 122 | if [[ "$EDITOR" == 'vim' || "$EDITOR" == '/usr/bin/vim' ]]; then 123 | $EDITOR -c 'set filetype=gitcommit' $cmfn 124 | elif [[ $EDITOR == '' ]]; then 125 | vim -c 'set filetype=gitcommit' $cmfn 126 | else 127 | $EDITOR $cmfn 128 | fi 129 | 130 | .pypt/commitlog $cmfn $PWD $version 131 | 132 | status 'Replacing versions and dates in files...' 133 | sed "s/version=.*/version='$version',/g" setup.py -i 134 | sed "s/version = .*/version = '$version'/g" docs/conf.py -i 135 | sed "s/release = .*/release = '$version'/g" docs/conf.py -i 136 | sed "s/:Version: .*/:Version: $version/g" docs/**/*.rst -i 137 | sed "s/# $PROJECT v.*/# $PROJECT v$version/" $PROJECTLC/**/*.py -i 138 | sed "s/__version__ = .*/__version__ = '$version'/g" $PROJECTLC/__init__.py -i 139 | sed "s/:Date: .*/:Date: $date/g" docs/*.rst -i 140 | 141 | [[ -e "PKGBUILD" ]] && sed "s/pkgver=.*/pkgver=$version/g" PKGBUILD -i || true 142 | [[ -e "PKGBUILD-git" ]] && sed "s/pkgver=.*/pkgver=$version/g" PKGBUILD-git -i || true 143 | 144 | cp docs/README.rst docs/CHANGELOG.rst docs/CONTRIBUTING.rst . 145 | cp docs/README.rst README 146 | 147 | status 'Generating locales...' 148 | ./.pypt/localegen 149 | 150 | status 'Importing...' 151 | python -c "import $PROJECTLC" 152 | if [[ $? != 0 ]]; then 153 | error "Import failed. Fix your code or don't come back." 154 | exit 1 155 | fi 156 | 157 | if [[ -e tests ]]; then 158 | status 'Running tests...' 159 | pytest tests/ 160 | if [[ $? != 0 ]]; then 161 | error "Tests failed. Fix your code or don't come back." 162 | exit 1 163 | fi 164 | fi 165 | 166 | status 'Running pre-sdist.hook...' 167 | 168 | . .pypt/hooks/pre-sdist.hook 169 | 170 | status 'This is the last chance to quit. Hit ^C now if you want to.' 171 | read bailout 172 | 173 | ./setup.py sdist bdist_wheel || exit $? 174 | twine upload -s dist/$PROJECTLC-$version.tar.gz dist/$PROJECTLC-$version*.whl || exit $? 175 | 176 | if [[ -e PKGBUILD ]]; then 177 | status 'Updating AUR PKGBUILDs...' 178 | md5out=$(md5sum 'dist/'$PROJECTLC'-'$version'.tar.gz'|awk '{print $1}') 179 | sed "s/md5sums=.*/md5sums=('$md5out')/" PKGBUILD -i 180 | fi 181 | 182 | cleanup 183 | 184 | git add -A --ignore-errors . || exit $? 185 | 186 | git commit -S -asF $cmfn2 || exit $? 187 | git tag -sm "Version $version" v$version || exit $? 188 | git push --follow-tags origin master || exit $? 189 | 190 | .pypt/ghrel $cmfn $PWD $GITUSER/$GITREPO v$version 191 | 192 | cleanup_cmfn 193 | 194 | status "Done!" 195 | . .pypt/hooks/post-release.hook 196 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/requirements.txt: -------------------------------------------------------------------------------- 1 | requests 2 | twine 3 | pytest 4 | coverage 5 | pytest-cov 6 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/setup.cfg: -------------------------------------------------------------------------------- 1 | [flake8] 2 | ignore = E741 3 | max-line-length = 120 4 | exclude = docs/* 5 | 6 | [wheel] 7 | universal = 1 8 | 9 | [tool:pytest] 10 | norecursedirs = .git 11 | addopts = --cov={{cookiecutter.repo_name}} --cov-report term-missing 12 | 13 | [coverage:run] 14 | branch = True 15 | omit = tests/* 16 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- encoding: utf-8 -*- 3 | import io 4 | from setuptools import setup, find_packages 5 | 6 | 7 | setup(name='{{ cookiecutter.repo_name }}', 8 | version='{{ cookiecutter.version }}', 9 | description='{{ cookiecutter.project_short_description }}', 10 | keywords='{{ cookiecutter.repo_name }}', 11 | author='{{ cookiecutter.full_name }}', 12 | author_email='{{ cookiecutter.email }}', 13 | url='https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.repo_name }}', 14 | license='3-clause BSD', 15 | long_description=io.open( 16 | './docs/README.rst', 'r', encoding='utf-8').read(), 17 | platforms='any', 18 | zip_safe=False, 19 | # http://pypi.python.org/pypi?%3Aaction=list_classifiers 20 | classifiers=['Development Status :: 1 - Planning', 21 | 'Programming Language :: Python', 22 | 'Programming Language :: Python :: 3', 23 | 'Programming Language :: Python :: 3.6', 24 | 'Programming Language :: Python :: 3.7', 25 | 'Programming Language :: Python :: 3.8', 26 | 'Programming Language :: Python :: 3.9', 27 | 'Programming Language :: Python :: 3.10', 28 | 'Programming Language :: Python :: 3.11', 29 | ], 30 | packages=find_packages(exclude=('tests', 'tests.*')), 31 | include_package_data=True, 32 | install_requires=[],{% if cookiecutter.entry_point == 'gui' or cookiecutter.entry_point == 'cli' %} 33 | entry_points={ 34 | {% if cookiecutter.entry_point == 'gui' %}'gui_scripts': [{% else %}'console_scripts': [{% endif %} 35 | '{{ cookiecutter.repo_name }} = {{ cookiecutter.repo_name }}.__main__:main', 36 | ] 37 | },{% endif %} 38 | ) 39 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | # {{ cookiecutter.project_name }} test suite 3 | # Copyright © {{ cookiecutter.year }}, {{ cookiecutter.full_name }}. 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions, and the following disclaimer. 12 | # 13 | # 2. Redistributions in binary form must reproduce the above copyright 14 | # notice, this list of conditions, and the following disclaimer in the 15 | # documentation and/or other materials provided with the distribution. 16 | # 17 | # 3. Neither the name of the author of this software nor the names of 18 | # contributors to this software may be used to endorse or promote 19 | # products derived from this software without specific prior written 20 | # consent. 21 | # 22 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 26 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 28 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/tests/test_sanity.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- encoding: utf-8 -*- 3 | # {{ cookiecutter.project_name }} test suite 4 | # Copyright © {{ cookiecutter.year }}, {{ cookiecutter.full_name }}. 5 | # See /LICENSE for licensing information. 6 | 7 | 8 | import {{ cookiecutter.repo_name }} 9 | import {{ cookiecutter.repo_name }}.template 10 | 11 | 12 | def test_true(): 13 | """Test if True is truthy.""" 14 | assert True 15 | 16 | 17 | def test_false(): 18 | """Test if False is falsey.""" 19 | assert not False 20 | 21 | 22 | def test_trueexpr(): 23 | """Test if this evaluates as True.""" 24 | assert 1 == 1 25 | 26 | 27 | def test_falseexpr(): 28 | """Test if this evaluates as False.""" 29 | assert 1 != 2 30 | 31 | 32 | def test_math(): 33 | """Test basic arithmetic skills of Python.""" 34 | assert 2 + 2 == 4 35 | assert 2 - 2 == 0 36 | assert 2 * 2 == 4 37 | assert 2 / 2 == 1 38 | assert 3 % 2 == 1 39 | 40 | 41 | def test_bitwise(): 42 | """Test bitwise operators.""" 43 | assert 0b11 ^ 0b10 == 0b01 44 | assert 0b100 | 0b010 == 0b110 45 | assert 0b101 & 0b011 == 0b001 46 | assert 0b10 << 2 == 0b1000 47 | assert 0b1111 >> 2 == 0b11 48 | 49 | 50 | def test_import(): 51 | """Test imports.""" 52 | {{ cookiecutter.repo_name }} 53 | {{ cookiecutter.repo_name }}.template 54 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | # {{ cookiecutter.project_name }} v{{ cookiecutter.version }} 3 | # {{ cookiecutter.project_short_description }} 4 | # Copyright © {{ cookiecutter.year }}, {{ cookiecutter.full_name }}. 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are 9 | # met: 10 | # 11 | # 1. Redistributions of source code must retain the above copyright 12 | # notice, this list of conditions, and the following disclaimer. 13 | # 14 | # 2. Redistributions in binary form must reproduce the above copyright 15 | # notice, this list of conditions, and the following disclaimer in the 16 | # documentation and/or other materials provided with the distribution. 17 | # 18 | # 3. Neither the name of the author of this software nor the names of 19 | # contributors to this software may be used to endorse or promote 20 | # products derived from this software without specific prior written 21 | # consent. 22 | # 23 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 26 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 29 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 30 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | 35 | """ 36 | {{ cookiecutter.project_short_description }} 37 | 38 | :Copyright: © {{ cookiecutter.year }}, {{ cookiecutter.full_name }}. 39 | :License: BSD (see /LICENSE). 40 | """ 41 | 42 | __title__ = '{{ cookiecutter.project_name }}' 43 | __version__ = '{{ cookiecutter.version }}' 44 | __author__ = '{{ cookiecutter.full_name }}' 45 | __license__ = '3-clause BSD' 46 | __docformat__ = 'restructuredtext en' 47 | 48 | __all__ = () 49 | 50 | # import gettext 51 | # G = gettext.translation('{{ cookiecutter.repo_name }}', '/usr/share/locale', fallback='C') 52 | # _ = G.gettext 53 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/__main__.py: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | # {{ cookiecutter.project_name }} v{{ cookiecutter.version }} 3 | # {{ cookiecutter.project_short_description }} 4 | # Copyright © {{ cookiecutter.year }}, {{ cookiecutter.full_name }}. 5 | # See /LICENSE for licensing information. 6 | 7 | """ 8 | Main routine of {{ cookiecutter.project_name }}. 9 | 10 | :Copyright: © {{ cookiecutter.year }}, {{ cookiecutter.full_name }}. 11 | :License: BSD (see /LICENSE). 12 | """ 13 | 14 | __all__ = ('main',) 15 | 16 | 17 | def main(): 18 | """Main routine of {{ cookiecutter.project_name }}.""" 19 | print("Hello, world!") 20 | print("This is {{ cookiecutter.project_name }}.") 21 | print("You should customize __main__.py to your liking (or delete it).") 22 | 23 | 24 | if __name__ == '__main__': 25 | main() 26 | -------------------------------------------------------------------------------- /{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/template.py: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | # {{ cookiecutter.project_name }} v{{ cookiecutter.version }} 3 | # {{ cookiecutter.project_short_description }} 4 | # Copyright © {{ cookiecutter.year }}, {{ cookiecutter.full_name }}. 5 | # See /LICENSE for licensing information. 6 | 7 | """ 8 | INSERT MODULE DESCRIPTION HERE. 9 | 10 | :Copyright: © {{ cookiecutter.year }}, {{ cookiecutter.full_name }}. 11 | :License: BSD (see /LICENSE). 12 | """ 13 | 14 | __all__ = () 15 | --------------------------------------------------------------------------------