Package: template-KCEvers
Template for building a Python packageThis package provides a basic template for a Python package with nested directories. If using PyCharm, there's no need to activate the virtual environment (https://setuptools.pypa.io/en/latest/userguide/development_mode.html). To ensure the directories are found, mark all directories as "Sources Root" (right click > Mark Directory As...).For starters, upgrade the following packages:py -m pip install --upgrade pippython -m pip install --upgrade pip-toolsUse pipreqs to make a requirements.txt file based on all packages in environmentpipreqs template_KCEversTo overwrite existing requirements.txt file:pipreqs --forceor use piptools to make a requirements.txt file based on dependencies specified in setup.py/setup.cfg/pyproject.toml (https://github.com/jazzband/pip-tools)python -m pip install pip-toolspip-compile -o requirements.txt pyproject.tomlTo update, run:pip-compile --output-file=requirements.txt pyproject.tomlHowever, this does not make sure that required packages are installed. Users would have to manually run:pip install -r requirements.txtTo specify which packages (and which versions) should be installed when installing the template_KCEvers package, packages need to be specified in the setup.cfg file under install_requires, e.g.install_requires =
    numpy==1.21.6
    pathlib==1.0.1or in the pyproject.toml file under dependencies, e.g.dependencies = [
    "numpy==1.21.6", 
    "pathlib==1.0.1"
    ](I haven't found a way of automatically generating a setup.cfg/pyproject.toml file with the required packages, so for now copy + paste from the requirements.txt file).Install the package in editable modecd template_KCEverspip install -e . # or equivalently, --editable rather than -ePublish on PyPi
For full instructions, followhttps://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/.Build source distribution and wheel (better than running "python setup.py sdist bdist_wheel"):py -m pip install --upgrade buildpython -m buildBefore trying to upload your distribution, you should check to see if your brief / long descriptions provided in setup.py are valid. You can do this by running twine check on your package files:py -m pip install --upgrade twinetwine check dist/*It's also highly recommended to first upload your package on TestPyPi (https://packaging.python.org/en/latest/tutorials/packaging-projects/#uploading-your-project-to-pypi). Your user name istoken, and your API token that you can generate athttps://test.pypi.org/manage/account/is the password (note that your password won't show as you're typing):py -m twine upload --repository testpypi dist/*Check whether the installation workedpy -m pip install --index-urlhttps://test.pypi.org/simple/--no-deps template_KCEversNote that you may have issues with imported packages (e.g. import numpy) using TestPyPi.Upload distribution to PyPi (your user name is still "token", checkhttps://pypi.org/manage/account/token/for your API token)twine upload dist/*The package can now be downloaded from PyPi by runningpip install template_KCEvers==0.0.1To upload the package, simply change the version number in pyproject.toml, delete the *.tar.gz and *.whl files in the dist/ directory, and rerunpy -m pip install --upgrade buildpy -m pip install --upgrade twinetwine check dist/*py -m buildtwine upload dist/*Now you can upgrade the package usingpip install --upgrade template-KCEversCheck which version is installed usingpip list