Package: pySprida
Python Template RepositoryThis repository contains a fully-functionable package structure including (empty) tests.It's features include (but are not limited to):An already working package structureA working requirement handlingMinimal effort pypi releasesPre-Configured CI/CD (With Travis)Code coverage analysisPython Code Style ChecksIf you want to add something to this repo, please submit a PR. Contributions are very welcome.Customize it!To customize this repo, you need to have a look at the following chapters.Directory-NameYou might want to customize your package-name.To do this, you simply have to rename thetemplate-repodirectory to whatever you want.Make sure, to also change it inline 37 of your setup.py, or you won't be able to install your package anymore!Python Package MetadataTo customize your python package, you just have to change yoursetup.py.Currently the important part looks likesetup(name='template_package',version=_version,packages=find_packages(),url='https://github.com/justusschock/template-repo-python',test_suite="unittest",long_description=readme,long_description_content_type='text/markdown',install_requires=requirements,tests_require=["coverage"],python_requires=">=3.5",author="Paul Kruse",author_email="paul.kruse@posteo.de",license=license,)This includes the default information for me and must be adjusted to your needs:nameprovides the package-name you can later importversionprovides the package-version (which will currently be extracted from your package's__init__.py, but be also set manually)packagesis a list defining all packages (and their sub-packages and the sub-packages of their sub-packages and so on...), that should be installed. This is automatically extracted byfind_packages, which also accepts some sub-packages to ignore (besides some other arguments).urlspecifies the packages homepage (in this case the current GitHub repo); You might want to change it to your repos homepage.test_suitedefines the test-suite to use for your unittests. In this repo template, we'll python's built-in frameworkunittest, but you can change this too;Just make sure to also change this, when we get to CI/CD.long_descriptiondoes what it sayes: It provides a long description of your package. Currently this is parsed from yourREADME.mdlong_description_content_typedefines your description type; I set it to markdown in most casesinstall_requiresis a list containing all your package requirements. They are automatically parsed from arequirements.txtfiletests_requiredoes the same thing for your unittests.python_requiresspecifies the python version, your package can be installed to (here it's been set to python 3.5 or above, since this is what I usually use).Depending on the version you specify here, you might not be able to use all of python's latest featuresauthorandauthor_emailspecify who you are.licensespecifies the license you want to release your code with. This is parsed from aLICENSEfile.There are still many other options to include here, but these are the most basic ones.UnittestsIf you want to add/change some unit-tests, you should do this in a new python file starting withtest_.Hereis a good introduction on how to write unittests with theunittestframework. After you added these tests, you may run them with eithercoverage run -m unittestorpython -m unittest.They are basically doing the same, butcoverageadditionally checks, how many of your code-lines are currently covered by your tests.The unittests are also automatically triggered withinCI/CDSpecifying CodecovThe.codecov.ymlfile specifies, how coverage should behave, how to calculate the coverage (i.e. what files to include for line counting) etc.RequirementsIf you want to add new requirements, simply add them to therequirements.txtfile.Packaging on PyPiIf you plan to release your package on pypi, ship wheels for it, you might need theMANSIFEST.infile, since it specifies (among other things), which files to include to your binaries.Setup.cfgThesetup.cfgfile currently only specifies, which directories to exclude from style checking.GitignoreThe.gitignorefile is a real life saver. It prevents files and directories that match certain patterns from being added to your git repository, when you push new stuff to it. You may append more specific patterns here.CI/CDNow, we talked a lot about CI/CD. This repository usestravisas CI/CD and per default simply runs tests and style checks for your code.To use this feature, you have to enable travis for your repository.YAMl-SpecificationsThe.travis.ymlfile specifies the CI/CD behavior. Currently it only runs tests and style-checks  with Python 3.7 on Linux Xenial. You may also include additional cases to the test matrix or add deployment (e.g. deploying your docs to GitHub Pages or similar stuff).ScriptsThe scripts used b CI/CD to install the requirements and run your tests are lying atscripts/ci.
The file names indicate pretty well, what tey're doing. Of course you can customize them too.If you want Travis to automatically fix your code style where possible you have to add a github access token to travis, comment in thelines 6-28and change the environment variable and the repository inline 27.