Package: packagingxx
InstallationDistributionLocalRemoteUploadDownloadDemoReferenceInstallationDistributionRunpython setup.py sdistto generate the source distribution, whereegganddistdirectories would be created.To create the wheel distribution, package "wheel" is necessary. Then runpython setup.py bdist_wheelto generate
distribution files. Checkbuildto verify if all modules and files needed for the distribution are included.Both distributions haveegganddistdirectory. Though files insideeggare the same, distribution viasdistis
a tar file, while that viabdist_wheelis a wheel file. Moreover, the wheel one includesbuilddirectory.Note that previous generated distribution would exist, so manual removal may be needed.LocalTo quickly test whether the configuration of "setup.py" is correct, simply runpip install -e .under this root
project directory.To install extra needed packages specified, runpip install ".[extra]"(double quote is recommended in case some
other shells like zsh fail to recognize).RemoteUploadNormally, file "$HOME/.pypirc" would be used to define the configuration. Below is the
usual format:[distutils]
  index-servers =
    default-repo
    testing-repo

[default-repo]
  repository = https://upload.pypi.org/legacy/
  username = {username}
  password = {password}

[testing-repo]
  repository = https://test.pypi.org/legacy/
  username = {username}
  password = {password}Be cautious that "[distutils]" is mandatory for uploading to repository.Looks like the API token mechanism in both official "pypi" repo are not working as expected,
the password should use the actual password since API token doesn't work.When the configuration is done, commandpython setup.py bdist_wheel upload -r default-repowould build the distribution and upload to the specified repo directly.However, it's recommended to applytwineto take of the uploading. After the distribution
is generated, runpython -m twine upload --repository {repo} dist/*to upload. For this
way, the process of distribution generation and uploading are separate, which is more manageable.DownloadSimilar to the uploading, file "$HOME/.pip/pip.conf" is the one for downloading configuration:[global]
  index-url =
    https://pypi.org/simple/

[install]
  index-url = https://test.pypi.org/simple/
  extra-index-url =
    {repo_1}
    {repo_2}When it comes to download a package from a repo, it's worth to mention that there is certain
config precedence (command line > environment variable > configuration in ""). In that
case,pip installwould look for the configuration following the precedence to download and install
the package specified.So be aware of there is no environment variables likePIP_INDEX_URLorPIP_EXTRA_INDEX_URLif you
want the configuration file to take effect.As long as the package is uploaded and the downloading configuration is properly set, then simply runpip install "{package[extra]}"would do the work. Otherwise, runpip install --index-url {repo} {package}to
ensure the repo is correct.DemoRun codes below for demo to see if the package is function:importcallerasdemofromcallerimportFruitdemo.entry.main()fruit=Fruit()fruit.printing()ReferencePackaging Python Projects:https://packaging.python.org/tutorials/packaging-projects/Including Data Files:https://setuptools.readthedocs.io/en/latest/userguide/quickstart.html#including-data-filesThe .pypirc file:https://packaging.python.org/specifications/pypirc/PIP Config Precedence:https://pip.pypa.io/en/stable/user_guide/#config-precedenceKeywords in setuptools:https://setuptools.readthedocs.io/en/latest/references/keywords.htmlMetadata for Python Software Packages:https://www.python.org/dev/peps/pep-0314Specifying package versions:https://pip.pypa.io/en/stable/user_guide/#understanding-your-error-message