Skip to main content

NIM python package

A reference python package.

Contains all config files for running properly in the pipeline.

Installation.

  1. create a virtual environment. It is strongly advised to create a separate environment for each repo you're working on.

    python -m venv venv

    And activate it.

  2. Install dependencies. Make sure you have the previous environment activated.

    # from inside the root folder of the repo
    
    # for dev purposes.
    pip install -e '.[dev,test]'
    

    This installs an editable version of your package including the dev and test requirements.

Build tooling.

The pipeline is build tooling agnostic. It will work with a setuptools, flit and poetry (not tested) build system.

If you want to, you can locally create a package (a wheel):

# inside the root of your repom with your virtualenv activated.

python -m build

# this creates a wheel file inside the dist folder of your repo (add this folder to gitignore.)

Development tooling.

All development and testing requirements are defined under the optional dependencies inside either the setup.py or pyproject.toml config file.

See the pyproject.toml file inside this repo.

TODO: Link to a project with a setup.py file.

Precommit

Pre-commit is useful for performing certain tasks before committing (and pushing) to your origin github repo. This guarantees code is always compliant with a base set of quality rules.

Pre-commit is automatically installed in the previous installation step. To activate it:

pre-commit install

From now on, each commit will be preceded by quality checks defined in .pre-commit-config.yaml

Configuration files

All, or most tooling used locally and in the pipeline are defined by local config files.

Most of these are in a pyproject.toml file. Flake8 does not yet support pyproject.toml and is configured inside setup.cfg.

Packaging.

Ultimately a python package needs to be published. Either to pypi or a private repository. The Tekton pipeline is managing this.

Only the Main/Master branch will publish packages.

Versioning flow.

We version our packages according to semver scheme (major.minor.patch). In addition to that versions must be PEP440 compliant.

PEP440 compliance is important to make your dependency resolvers (in pip or poetry) work properly.

Package versions are automatically created using the gitversion tool: https://gitversion.net/ The mainline strategy is used and generated versions are converted to a PEP440 compliant version name.

Full auto version: version patching

Each time a push is made to Main/Master a new version is created by bumping the patch version. (ie: 1.0.0 -> 1.0.1)

Non-full autoversion: minor and major patching.

If you're working on a feature branch which adds extra functionality (without breaking other stuff) you should bump the minor version. You do this by appending +semver: minor to one of your commit messages inside that branch:

git commit -am 'my commit message +semver: minor'

Once you have merged this into main, the gitversion tool will pickup this message and automatically bump the minor version (ie: 1.0.1 -> 1.1.0)

If you are working on a breaking change, you want to bump the major version. Create a git message like this:

git commit -am 'my commit message +semver: major'

On merge to main, gitversion will now pick up this message and bump the major version (ie: 1.1.0 -> 2.0.0)

For more detail see the flow below:

MAIN               DEV                       FEATURE

5.0.8  checkout    5.1.0a0
                   commit
                   5.1.0a1
                   |
5.0.9 <--merge-----┘ # gets merged as a patch version

        checkout   5.1.0a0
                   commit
                   5.1.0a1 ---checkout--->  5.1.0-just-a-test.1
                                            commit +semver:minor
                                            5.1.0-just-a-test.2
                                            |
                   5.1.0a2  <--merge--------┘
                   |
5.1.0 <--merge-----┘  # here is the +semver:minor in action.

        checkout   5.2.0a0 ---checkout--->  5.2.0-branchA.1
                                            commit +semver:minor
                           
                           ---checkout--->  5.2.0-branchB.1
                                            commit +semver:minor

                                            |
                   5.2.0a1 <--merge branchA-┘
                                           
                   5.2.0a2 <--merge branchB-┘
                   |
5.3.0 <--merge-----┘ # we merged two branches with both +semver:minor
                     # as result we have double minor version bump.


Tags/releases

Each time a package is created a release will be published on github, using the created version as the tag. You can manually create tags, but do not create tags which might interfere with the automatic tagging used by gitversion. So no "v1.0.0" tags as it might break the pipeline.

Release notes

Currently there is no strategy on how to both do automatic versioning and release management.

Metadata

Release files for nim_python_package 10.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nim_python_package 10.1.1
File Size Uploaded Provenance Actions
nim_python_package-10.1.1.tar.gz 6.8 kB Without provenance Details for nim_python_package-10.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nim_python_package 10.1.1
File Interpreter ABI Platform Actions
nim_python_package-10.1.1-py3-none-any.whl Python 3 none any Details for nim_python_package-10.1.1-py3-none-any.whl

Total release size: 11.6 kB

Release files / nim_python_package-10.1.1.tar.gz

Download URL nim_python_package-10.1.1.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e0d237f722d2afb5a471a29c765dca078dda3967e5a3d851b5bbc647794adb10
BLAKE2b-256 checksum
How to use checksums
58fffa2512c8733634f8d7ed2072d05b2c1ccc3b01c476143195523d2dcd0a39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.25.1

Release files / nim_python_package-10.1.1-py3-none-any.whl

Download URL nim_python_package-10.1.1-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
de4268ef05f3c722c2cd4fee3a75db67c25b9e490c76ff7be37fef0a66269c52
BLAKE2b-256 checksum
How to use checksums
90ec69edd94ab2f0cb4eee1939c49dd96e21962ebf6d3ee36e391075a47a1f19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.25.1

Security for nim_python_package 10.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

10.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page