AaronZ Learning Python Package
Project description
AZPyPkg
AZ Learning Package
Set up
- Install envrionment manager: Anaconda(Or even smaller package of Miniconda)
- Install packages:
poetry
andcookiecutter
- Register for TestPyPI and PyPI
- Register for GitHub
- Install Python extensions in VSCode
Main
-
Create a new virtual env by Anaconda and make it enable in VSCode to working directory locally
-
Create a new package structure by below command and input a few info.
git init
the new foldercookiecutter https://github.com/py-pkgs/py-pkgs-cookiecutter.git
-
Create a new project in GitHub, link new package to remote repos. Commit and push:
-
Add new code as function into file 'azpypkg36':
-
Install current new package:
poetry install
-
Test new installed package:
Create test file 'zen.txt':
python -c "import this" > zen.txt
Test with Python Command:
Test with tests .py file:
-
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:
-
Check code coverage:
Install 'pytest' into project:
poetry add --dev pytest-cov
Run test coverage:
pytest tests/ --cov=azpypkg36
-
Documentation:
-
Add version:
git tag
+git push --tags
after regulargit commit
andgit push
-
Release on github:
-
Build package: the main reason for build is to generate a a wheel(.whl file) can be distributed
poetry build
-
Install locally:
cd dist
+pip install azpypkg36-0.1.0-py3-none-any.whl
-
Publish package:
-
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)
-
Publish to 'PyPI' & install by pip (pip uninstall first before testing):
Publish:
poetry publish
Install:
pip install azpypkg36
-
More details steps:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for azpypkg36-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3103ceee1b9d482c23744fc551286142b285c619320e08eaca4309f2f0b4c838 |
|
MD5 | 055ec6bac1c6a0cb79a8b22a4124ae91 |
|
BLAKE2b-256 | bfb73bcb87c4f0cdc0aa0daf802f4fdb598e9edcac7e54de8919572af4130481 |