Skip to main content

AaronZ Learning Python Package

Project description

AZPyPkg

AZ Learning Package

Set up

  1. Install envrionment manager: Anaconda(Or even smaller package of Miniconda)
  2. Install packages: poetry and cookiecutter
  3. Register for TestPyPI and PyPI
  4. Register for GitHub
  5. Install Python extensions in VSCode

Main

  1. Create a new virtual env by Anaconda and make it enable in VSCode to working directory locally

  2. Create a new package structure by below command and input a few info. git init the new folder

    cookiecutter https://github.com/py-pkgs/py-pkgs-cookiecutter.git

  3. Create a new project in GitHub, link new package to remote repos. Commit and push:

  4. Add new code as function into file 'azpypkg36':

  5. Install current new package: poetry install

  6. Test new installed package:

    Create test file 'zen.txt': python -c "import this" > zen.txt

    Test with Python Command:

    Test with tests .py file:

  7. Create tests in 'tests' directory and run test: pytest tests/ Install 'pytest' into project: poetry add --dev pytest

    Create unit test code: KEY: both file name and function name, must include 'test_XXX' or 'XXX_test'

    Run unit test:

  8. Check code coverage:

    Install 'pytest' into project: poetry add --dev pytest-cov

    Run test coverage: pytest tests/ --cov=azpypkg36

  9. Documentation:

    (TBSummary)

  10. Add version:

    git tag + git push --tags after regular git commit and git push

  11. Release on github:

  12. Build package: the main reason for build is to generate a a wheel(.whl file) can be distributed poetry build

  13. Install locally: cd dist + pip install azpypkg36-0.1.0-py3-none-any.whl

  14. Publish package:

    1. Publish to 'TestPyPI' & install by pip (pip uninstall first before testing):

      Publish: poetry config repositories.test-pypi https://test.pypi.org/legacy/ poetry publish -r test-pypi

      ![](Pic/21.png)
      
      ![](Pic/22.png)
      
      ![](Pic/23.png)
      

      Install: pip install -i https://test.pypi.org/simple/ azpypkg36

      ![](Pic/24.png)
      
    2. Publish to 'PyPI' & install by pip (pip uninstall first before testing):

      Publish: poetry publish

      Install: pip install azpypkg36

More details steps:

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

azpypkg36-0.1.0.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

azpypkg36-0.1.0-py3-none-any.whl (3.3 kB view hashes)

Uploaded Python 3

Supported by

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