Skip to main content

CDK python package

Project description

cdk pip packages

this project shows how to package cdk constructs as pip modules and import and use them in our projects

install required tools

pip install setuptools
pip install twine
pip install wheel

.pypirc

you must have a file named .pypirc in your user folder
content must be some like this :

[distutils]
index-servers=pypi

[pypi]
repository = https://upload.pypi.org/legacy/
username=change2yourusername
password=change2yourpassword

project structure

cdk_pip_modules
├── LICENSE
├── wunger_cdk_constructs ( folder with the constructs, content will be packaged as pip module)
│ ├── init.py
│ ├── cdk classes
│ ├── ...
├── stacks (wrapper stacks to test the constructs before creating the pip module)
├── usage ( stacks that will import and use the final pip modules)
├── README.md
├── app.py ( main python file, entry point )
└── setup.py

-please create your constructs in the folder wunger_cdk_constructs or your own folder ( my_cdk_constructs)
-adapt setup.py
-adapt the app.py
-build the module and install locally
-upload to remote repo
-use the module by cdk stacks in usage folder, see example

check

python setup.py check

create package

python setup.py bdist_wheel

python -m pip install dist/wunger_cdk-0.0.2-py3-none-any.whl install same version new python -m pip install dist/wunger_cdk-0.0.2-py3-none-any.whl --force

upload

twine upload -r pypi dist/wunger_cdk-0.0.2-py3-none-any.whl

use in client project

setup requirements.txt: wunger-cdk==0.0.1

pip install -r requirements.txt or explicit : pip install wunger-cdk

import class: from wunger_cdk.ecr_repo import WUngerEcrConstruct

https://betterscientificsoftware.github.io/python-for-hpc/tutorials/python-pypi-packaging/

https://packaging.python.org/

https://dzone.com/articles/executable-package-pip-install

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

wunger_cdk-0.0.2-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file wunger_cdk-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: wunger_cdk-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.1

File hashes

Hashes for wunger_cdk-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3ade7cc52720318679a19cb65288c254502d1aa259466be3477c49a93fc07123
MD5 683ff64d16cf39078076eed6531ab671
BLAKE2b-256 4aff5242e61aae82b96426fc067194850d25f4d04c081e80f0ddd607e21975e7

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