Initial commit
This commit is contained in:
		
						commit
						fc8cc85a04
					
				
					 14 changed files with 321 additions and 0 deletions
				
			
		
							
								
								
									
										38
									
								
								.github/workflows/build_documentation.yml
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								.github/workflows/build_documentation.yml
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,38 @@ | ||||||
|  | name: Build documentation | ||||||
|  | 
 | ||||||
|  | on: | ||||||
|  |   workflow_dispatch: | ||||||
|  |   release: | ||||||
|  |     types: [published] | ||||||
|  | 
 | ||||||
|  | jobs: | ||||||
|  |   build: | ||||||
|  |     runs-on: ubuntu-latest | ||||||
|  |     strategy: | ||||||
|  |       matrix: | ||||||
|  |         python-version: [3.10] | ||||||
|  | 
 | ||||||
|  |     steps: | ||||||
|  |       - uses: actions/checkout@v2 | ||||||
|  | 
 | ||||||
|  |       - name: Set up Python ${{ matrix.python-version }} | ||||||
|  |         uses: actions/setup-python@v2 | ||||||
|  |         with: | ||||||
|  |           python-version: ${{ matrix.python-version }} | ||||||
|  | 
 | ||||||
|  |       - name: Install dependencies | ||||||
|  |         run: | | ||||||
|  |           python -m pip install --upgrade pip | ||||||
|  |           pip install pdoc | ||||||
|  |           if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||||||
|  | 
 | ||||||
|  |       - name: Build docs | ||||||
|  |         run: | | ||||||
|  |           chmod +x ./scripts/build_documentation.sh | ||||||
|  |           bash ./scripts/build_documentation.sh | ||||||
|  | 
 | ||||||
|  |       - name: Deploy | ||||||
|  |         uses: JamesIves/github-pages-deploy-action@4.1.4 | ||||||
|  |         with: | ||||||
|  |           branch: documentation | ||||||
|  |           folder: ./documentation | ||||||
							
								
								
									
										38
									
								
								.github/workflows/publish_to_pypi.yml
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								.github/workflows/publish_to_pypi.yml
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,38 @@ | ||||||
|  | name: Upload Python Package to PyPI | ||||||
|  | 
 | ||||||
|  | on: | ||||||
|  |   release: | ||||||
|  |     types: [published] | ||||||
|  | 
 | ||||||
|  | jobs: | ||||||
|  |   deploy: | ||||||
|  |     runs-on: ubuntu-latest | ||||||
|  | 
 | ||||||
|  |     steps: | ||||||
|  |     - uses: actions/checkout@v2 | ||||||
|  | 
 | ||||||
|  |     - name: Set up Python | ||||||
|  |       uses: actions/setup-python@v2 | ||||||
|  |       with: | ||||||
|  |         python-version: '^3.6' | ||||||
|  | 
 | ||||||
|  |     - name: Install dependencies | ||||||
|  |       run: | | ||||||
|  |         python -m pip install --upgrade pip | ||||||
|  |         python -m pip install pytest | ||||||
|  |         if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||||||
|  |      | ||||||
|  |     - name: Test with pyTest | ||||||
|  |       run: | | ||||||
|  |         python -m pytest -v | ||||||
|  | 
 | ||||||
|  |     - name: Build package | ||||||
|  |       run: | | ||||||
|  |         chmod +x ./scripts/compile_for_pypi.sh | ||||||
|  |         ./scripts/compile_for_pypi.sh | ||||||
|  | 
 | ||||||
|  |     - name: Publish package | ||||||
|  |       uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | ||||||
|  |       with: | ||||||
|  |         user: __token__ | ||||||
|  |         password: ${{ secrets.PYPI_API_TOKEN }} | ||||||
							
								
								
									
										25
									
								
								.github/workflows/pytest.yml
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								.github/workflows/pytest.yml
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,25 @@ | ||||||
|  | name: Test with pyTest | ||||||
|  | 
 | ||||||
|  | on: [workflow_dispatch, push, pull_request] | ||||||
|  | 
 | ||||||
|  | jobs: | ||||||
|  |   deploy: | ||||||
|  |     runs-on: ubuntu-latest | ||||||
|  | 
 | ||||||
|  |     steps: | ||||||
|  |     - uses: actions/checkout@v2 | ||||||
|  | 
 | ||||||
|  |     - name: Set up Python | ||||||
|  |       uses: actions/setup-python@v2 | ||||||
|  |       with: | ||||||
|  |         python-version: '^3.6' | ||||||
|  | 
 | ||||||
|  |     - name: Install dependencies | ||||||
|  |       run: | | ||||||
|  |         python -m pip install --upgrade pip | ||||||
|  |         python -m pip install pytest | ||||||
|  |         if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||||||
|  |      | ||||||
|  |     - name: Test with pyTest | ||||||
|  |       run: | | ||||||
|  |         python -m pytest -v | ||||||
							
								
								
									
										10
									
								
								.gitignore
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								.gitignore
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,10 @@ | ||||||
|  | # TODO: Your editor's folder | ||||||
|  | # .vscode/ | ||||||
|  | __pycache__/ | ||||||
|  | env/ | ||||||
|  | 
 | ||||||
|  | .pytest-cache | ||||||
|  | documentation/ | ||||||
|  | 
 | ||||||
|  | dist/* | ||||||
|  | *.egg-info | ||||||
							
								
								
									
										16
									
								
								.vscode/launch.json
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								.vscode/launch.json
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,16 @@ | ||||||
|  | { | ||||||
|  |     "version": "0.2.0", | ||||||
|  |     "configurations": [ | ||||||
|  |         // Pre-made Python debugger (automatically sets `PYTHONPATH` to workspace root directory) | ||||||
|  |         { | ||||||
|  |             "name": "Python: Current File", | ||||||
|  |             "type": "python", | ||||||
|  |             "request": "launch", | ||||||
|  |             "program": "${file}", | ||||||
|  |             "env": { | ||||||
|  |                 "PYTHONPATH": "${workspaceRoot}" | ||||||
|  |             }, | ||||||
|  |             "console": "integratedTerminal" | ||||||
|  |         } | ||||||
|  |     ] | ||||||
|  | } | ||||||
							
								
								
									
										21
									
								
								LICENSE
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								LICENSE
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,21 @@ | ||||||
|  | MIT License | ||||||
|  | 
 | ||||||
|  | Copyright (c) 2021 SKevo | ||||||
|  | 
 | ||||||
|  | Permission is hereby granted, free of charge, to any person obtaining a copy | ||||||
|  | of this software and associated documentation files (the "Software"), to deal | ||||||
|  | in the Software without restriction, including without limitation the rights | ||||||
|  | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||||||
|  | copies of the Software, and to permit persons to whom the Software is | ||||||
|  | furnished to do so, subject to the following conditions: | ||||||
|  | 
 | ||||||
|  | The above copyright notice and this permission notice shall be included in all | ||||||
|  | copies or substantial portions of the Software. | ||||||
|  | 
 | ||||||
|  | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||||
|  | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||||
|  | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||||
|  | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||||
|  | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||||||
|  | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||||||
|  | SOFTWARE. | ||||||
							
								
								
									
										62
									
								
								README.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								README.md
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,62 @@ | ||||||
|  | # Python project template | ||||||
|  | 
 | ||||||
|  | A template for new Python projects. | ||||||
|  | 
 | ||||||
|  | ## Features | ||||||
|  | 
 | ||||||
|  | - Automatically builds [PDoc](https://pdoc3.github.io/pdoc/) documentation & uploads package to [PyPI](https://pypi.org) on new GitHub release, thanks to GitHub actions; | ||||||
|  | - Tests with pyTest before uploading to PyPI (or you can test manually with `workflow-dispatch`); | ||||||
|  | - Ready-to-go `setup.py` file; | ||||||
|  | - Scripts to build documentation and compile as a Python package; | ||||||
|  | - A to-do list below; | ||||||
|  | - Possibly more ;) | ||||||
|  | 
 | ||||||
|  | ## Your to-do list | ||||||
|  | 
 | ||||||
|  | (*Approx. time to set up:* 15 - 25 minutes) | ||||||
|  | 
 | ||||||
|  | - [ ] Edit `# FIXME` lines to match your project; | ||||||
|  |   - [ ] setup.py | ||||||
|  |     - [ ] Package name | ||||||
|  |     - [ ] License | ||||||
|  |     - [ ] Version | ||||||
|  |     - [ ] Author | ||||||
|  |     - [ ] Author email | ||||||
|  |     - [ ] Description | ||||||
|  |     - [ ] Keywords | ||||||
|  |     - [ ] Classifiers | ||||||
|  |     - [ ] Repository URL | ||||||
|  | - [ ] Setup virtualenv (`scripts/setup_virtualenv_windows.ps1` for Windows); | ||||||
|  | - [ ] Rename `python_project_template` folder and start writing your source code; | ||||||
|  | - [ ] Add your dependencies to `requirements.txt`; | ||||||
|  | - [ ] Update .gitingore with your stuff; | ||||||
|  | - [ ] Replace this `README.md` file with a fancier one; | ||||||
|  | - [ ] Upload code to your GitHub repository; | ||||||
|  | - [ ] Turn on GitHub pages and use `documentation` as your pages branch; | ||||||
|  | - [ ] Add your editior to `.gitignore`; | ||||||
|  | - [ ] Add your PyPI API key to GitHub secrets (`PYPI_API_TOKEN`); | ||||||
|  | - [ ] When your are done, make a new release at GitHub to build documentation and upload to PyPI; | ||||||
|  |   - Don't forget to bump version in `setup.py` everytime you do a new release!!! | ||||||
|  | 
 | ||||||
|  | That should be it. Happy coding! | ||||||
|  | 
 | ||||||
|  | If you have any questions or found a bug, please open a new issue in this repository. | ||||||
|  | 
 | ||||||
|  | ## 🎁 Support me | ||||||
|  | 
 | ||||||
|  | I create free software to benefit people. | ||||||
|  | If this project helps you and you like it, consider supporting me by donating via cryptocurrency: | ||||||
|  | 
 | ||||||
|  | - Bitcoin: `bc1q6n7f4mllak9xts355wlyq2n3rce60w2r5aswxa`; `1LMS4u41beDGMb9AXmXzfH7ZkZSwGSkSyx` | ||||||
|  | - Ethereum: `0x12C598b3bC084710507c9d6d19C9434fD26864Cc` | ||||||
|  | - Litecoin: `LgHQK1NQrRQ56AKvVtSxMubqbjSWh7DTD2` | ||||||
|  | - Dash: `Xe7TYoRCYPdZyiQYDjgzCGxR5juPWV8PgZ` | ||||||
|  | - Zcash: `t1Pesobv3SShMHGfrZWe926nsnBo2pyqN3f` | ||||||
|  | - Dogecoin: `DALxrKSbcCXz619QqLj9qKXFnTp8u2cS12` | ||||||
|  | - Ripple: `rNQsgQvMbbBAd957XyDeNudA4jLH1ANERL` | ||||||
|  | - Monero: `48TfTddnpgnKBn13MdJNJwHfxDwwGngPgL3v6bNSTwGaXveeaUWzJcMUVrbWUyDSyPDwEJVoup2gmDuskkcFuNG99zatYFS` | ||||||
|  | - Bitcoin Cash: `qzx6pqzcltm7ely24wnhpzp65r8ltrqgeuevtrsj9n` | ||||||
|  | - Ethereum Classic: `0x383Dc3B83afBD66b4a5e64511525FbFeb2C023Db` | ||||||
|  | 
 | ||||||
|  | More cryptocurrencies are supported. If you are interested in donating with a different one, please [E-mail me](mailto:me@kevo.link). | ||||||
|  | No other forms of donation are currently supported. | ||||||
							
								
								
									
										25
									
								
								python_project_template/__init__.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								python_project_template/__init__.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,25 @@ | ||||||
|  | from typing import Generator | ||||||
|  | from random import random as rand | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | def infinitum(multiplier: int = 314) -> Generator[int, None, None]: | ||||||
|  |     """ | ||||||
|  |         Generates an infinite sequence of random numbers. | ||||||
|  |     """ | ||||||
|  |          | ||||||
|  |     while True: | ||||||
|  |         yield round(((rand() + 1) ** multiplier) % 21768543) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | if __name__ == "__main__": | ||||||
|  |     count = 0 | ||||||
|  |     max_count = 10 | ||||||
|  | 
 | ||||||
|  |     for random in infinitum(): | ||||||
|  |         print(random) | ||||||
|  |         count += 1 | ||||||
|  | 
 | ||||||
|  |         if count >= max_count: | ||||||
|  |             break | ||||||
							
								
								
									
										1
									
								
								requirements.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								requirements.txt
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | ||||||
|  | pytest | ||||||
							
								
								
									
										4
									
								
								scripts/build_documentation.sh
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								scripts/build_documentation.sh
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,4 @@ | ||||||
|  | cd "$(dirname "$0")" | ||||||
|  | cd ../ | ||||||
|  | 
 | ||||||
|  | pdoc -o documentation python_project_template # FIXME | ||||||
							
								
								
									
										4
									
								
								scripts/compile_everything.sh
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								scripts/compile_everything.sh
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,4 @@ | ||||||
|  | cd "$(dirname "$0")" | ||||||
|  | 
 | ||||||
|  | bash ./build_documentation.sh | ||||||
|  | bash ./compile_for_pypi.sh | ||||||
							
								
								
									
										4
									
								
								scripts/compile_for_pypi.sh
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								scripts/compile_for_pypi.sh
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,4 @@ | ||||||
|  | cd "$(dirname "$0")" | ||||||
|  | cd ../ | ||||||
|  | 
 | ||||||
|  | python setup.py sdist | ||||||
							
								
								
									
										61
									
								
								setup.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								setup.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,61 @@ | ||||||
|  | from pathlib import Path | ||||||
|  | 
 | ||||||
|  | import sys | ||||||
|  | sys.path.append('.') | ||||||
|  | 
 | ||||||
|  | import setuptools | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | __description__ = "Python Project Template" # FIXME | ||||||
|  | __author__      = "SKevo" | ||||||
|  | __copyright__   = "Copyright (c) 2021, SKevo" | ||||||
|  | __credits__     = ["SKevo"] | ||||||
|  | __license__     = "MIT" | ||||||
|  | __version__     = "v1.0.0-beta" | ||||||
|  | __maintainer__  = "SKevo" | ||||||
|  | __email__       = "me@kevo.link" | ||||||
|  | __status__      = "4 - Beta" | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | README_PATH = Path(__file__).parent.absolute() / Path('README.md') | ||||||
|  | 
 | ||||||
|  | try: | ||||||
|  |     with open(README_PATH, 'r', encoding="UTF-8") as readme: | ||||||
|  |         __readme__ = readme.read() | ||||||
|  | 
 | ||||||
|  | except: | ||||||
|  |     __readme__ = "Failed to read README.md!" | ||||||
|  | 
 | ||||||
|  | __doc__ = __readme__ | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | setuptools.setup( | ||||||
|  |     name = 'python_project_template', # FIXME | ||||||
|  |     packages = setuptools.find_packages(exclude=('tests',)), | ||||||
|  | 
 | ||||||
|  |     long_description=__readme__, | ||||||
|  |     long_description_content_type='text/markdown', | ||||||
|  | 
 | ||||||
|  |     version = __version__, | ||||||
|  |     license = __license__, | ||||||
|  |     description = __description__, | ||||||
|  |     keywords = [], # FIXME | ||||||
|  | 
 | ||||||
|  |     author = __author__, | ||||||
|  |     author_email = __email__, | ||||||
|  | 
 | ||||||
|  |     url = 'https://github.com/CWKevo/python-project-template', # FIXME | ||||||
|  | 
 | ||||||
|  |     install_requires=[], # FIXME | ||||||
|  | 
 | ||||||
|  |     classifiers=[ | ||||||
|  |         f'Development Status :: {__status__}', | ||||||
|  |         'Intended Audience :: Developers', | ||||||
|  |         'License :: OSI Approved :: MIT License', | ||||||
|  |         'Programming Language :: Python :: 3.6', | ||||||
|  |         'Programming Language :: Python :: 3.7', | ||||||
|  |         'Programming Language :: Python :: 3.8', | ||||||
|  |         'Programming Language :: Python :: 3.9', | ||||||
|  |     ], | ||||||
|  | ) | ||||||
							
								
								
									
										12
									
								
								tests/test_infinite_random_numbers.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								tests/test_infinite_random_numbers.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,12 @@ | ||||||
|  | from python_project_template import infinitum | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | def test_infinitum(): | ||||||
|  |     """ | ||||||
|  |         Tests the infinite random number generator. | ||||||
|  |     """ | ||||||
|  | 
 | ||||||
|  |     for random in infinitum(): | ||||||
|  |         assert type(random) == int | ||||||
|  |         break | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue