Skip to main content

This is a quick start helper project for helping beginners create a python unit test package distribution

Project description

# Raga_Practise_Util This is a Python Packaging Helper Environment that helps beginner’s in python get acquainted with the concepts of Building,Packages and Managing them. This tutorial gives beginners a complete flow of how python packages are done in the industries.

Please do the following:

  1. Create a new git repository with git-init(1). Commit as desired. If you’re worried about losing any of the sample code that you’re writing, create a new GitHub repository, skim git-remote(1), and push your code to your new GitHub repository.

  2. Within this git repository, create the following directory structure:

    . ├── my_package │   └── tests.py └── setup.py

  3. Read the [unittest](https://docs.python.org/3.6/library/unittest.html) documentation from the beginning through section 26.4.2.0. (That is, read until section 26.4.2.1.) In addition, skim the list of methods exposed by [unittest.TestCase](https://docs.python.org/3.6/library/unittest.html#unittest.TestCase).

  4. Create a test case in tests.py. Within this test case, create one test method for each of the following assertions:

    • ‘0.1’ is equal to ‘0.1’

    • ‘0.1’ is less than ‘0.2’

    • ‘0.2’ is greater than ‘0.10’

    Do not use the assertTrue method for these assertions. There are other, more targeted methods, as mentioned in step 3. Verify that the tests pass.

  5. Read [packaging and distributing projects](https://packaging.python.org/guides/distributing-packages-using-setuptools/). Feel free to skim the “setup() args” section.

  6. Create a virtualenv using python3 -m venv …, and activate it. Populate your setup.py with just enough information to be valid. Install your package into the virtualenv in “editable mode,” e.g. with pip install –editable .. Change to an entirely different directory (e.g. with cd ~), and verify that you can execute tests with python -m unittest my_package.tests.

  7. Add [install_requires](https://packaging.python.org/guides/distributing-packages-using-setuptools/#install-requires) to setup.py, and depend on [packaging](https://pypi.org/project/packaging/). Verify that pip install –editable . pulls in the packaging library. You can verify this with pip freeze.

  8. Add a new test case into the tests.py file. Within this test case, create one test method for each of the following assertions:

    • Version(‘0.1’) is equal to Version(‘0.1’)

    • Version(‘0.1’) is less than Version(‘0.2’)

    • Version(‘0.2’) is less than Version(‘0.10’)

    Do not use the assertTrue method for these assertions. There are other, more targeted methods, as mentioned in step 3. Verify that the tests pass.

  9. Add extras_require to setup.py, and create a “dev” section that lists “pylint.” See the [docs](http://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-extras-optional-features-with-their-own-dependencies) for an example of how to do this. Verify that pip install –editable .[dev] pulls in pylint. You can verify this with pip freeze.

  10. Execute pylint my_package. Fix all warnings.

  11. Deactivate your virtualenv. Blow it away, e.g. with rm -rf path/to/virtualenv. Create a new one. Install your Python package into this virtualenv. Verify that you can move to a different directory and successfully execute the tests, e.g. with cd ~ && python -m unittest my_package.tests.

  12. Once Done with managing the packages locally, The package can be distributed to the remote. This works by creating [aPypI](https://pypi.org/account/register/) account first. Install twine pip install twine. Setting up the Build files using python setup.py sdist and pip install wheel followed by python setup.py bdist_wheel –universal. Then run the upload by using twine upload dist/*. for more infor refer [docs](https://packaging.python.org/guides/distributing-packages-using-setuptools/#id77)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

raga_practice_util-0.0.1.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

raga_practice_util-0.0.1-py2.py3-none-any.whl (3.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file raga_practice_util-0.0.1.tar.gz.

File metadata

File hashes

Hashes for raga_practice_util-0.0.1.tar.gz
Algorithm Hash digest
SHA256 3245c31a31498074e09f4264d99d115bd6248769dbfdd60238ec8ee7624ca2a8
MD5 2effe0b865b756456df6fe6b1cc73a12
BLAKE2b-256 d2b69a77e34782c2afa27fda6452ac88335b746ce450e81120593ba3eb851e80

See more details on using hashes here.

File details

Details for the file raga_practice_util-0.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for raga_practice_util-0.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5fa54025af9ab322ef48f4b7820b545298c840fc2fe178e5b8db81f17dbf6c6e
MD5 b300dbeb5128b37ec6f43ab98c260432
BLAKE2b-256 e8a785c028c8b6d0899f38fab9e97794e4a5dabf1d35b8653ca061590065efce

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page