### Install Project with Development Requirements Source: https://github.com/cleder/vercheck/blob/develop/docs/contributing.md Use this command to install the project and its development dependencies using Poetry. ```console $ poetry install ``` -------------------------------- ### Example output for version check with PKG-INFO Source: https://github.com/cleder/vercheck/blob/develop/README.md Illustrates the expected console output when checking a version against a PKG-INFO file, including a warning about the filename and confirmation of the directory being checked. ```console Warning: filename src does not end with '.py' Checking version in src Found 'src/vercheck.egg-info' ``` -------------------------------- ### Install Pre-commit Git Hooks with Nox Source: https://github.com/cleder/vercheck/blob/develop/docs/contributing.md Set up pre-commit as a Git hook using Nox to run linting and code formatting checks before committing. ```console $ nox --session=pre-commit -- install ``` -------------------------------- ### Run Interactive Python Session Source: https://github.com/cleder/vercheck/blob/develop/docs/contributing.md Start an interactive Python session within the project's environment managed by Poetry. ```console $ poetry run python ``` -------------------------------- ### Install Vercheck using pip Source: https://github.com/cleder/vercheck/blob/develop/README.md Install the Vercheck package from PyPI using pip. This command requires Python 3.10 or higher and has no external dependencies. ```console $ pip install vercheck ``` -------------------------------- ### Dynamic Version Metadata in pyproject.toml Source: https://github.com/cleder/vercheck/blob/develop/README.md Using dynamic metadata in `pyproject.toml` allows the version to be defined in a Python file, avoiding manual synchronization. This example shows how to configure `setuptools` to use an attribute for the version. ```toml [project] name = "mypkg" dynamic = "version" [tool.setuptools.dynamic.version] attr = "mypkg.about.__version__" ``` -------------------------------- ### CI/CD Version Check with GitHub Actions Source: https://github.com/cleder/vercheck/blob/develop/README.md This GitHub Actions workflow snippet installs `vercheck` and uses it to validate the Git tag name against the version specified in a Python file. It runs only for push events on tags. ```yaml - name: Check tag name if: >- github.event_name == 'push' && startsWith(github.ref, 'refs/tags') run: | pip install vercheck vercheck $GITHUB_REF_NAME src/vercheck/about.py ``` -------------------------------- ### Run Project Command-Line Interface Source: https://github.com/cleder/vercheck/blob/develop/docs/contributing.md Execute the project's command-line interface using Poetry. ```console $ poetry run vercheck ``` -------------------------------- ### Run Full Test Suite with Nox Source: https://github.com/cleder/vercheck/blob/develop/docs/contributing.md Execute all available tests and checks defined in Nox sessions. ```console $ nox ``` -------------------------------- ### List Available Nox Sessions Source: https://github.com/cleder/vercheck/blob/develop/docs/contributing.md Display a list of all runnable Nox sessions for the project. ```console $ nox --list-sessions ``` -------------------------------- ### Check version against package info file Source: https://github.com/cleder/vercheck/blob/develop/README.md Verify a version number against the PKG-INFO file within a package's metadata directory. This command may output a warning if the provided filename does not end with '.py'. ```bash vercheck 0.2.0 src/vercheck.egg-info/PKG-INFO ``` -------------------------------- ### Display Vercheck help message Source: https://github.com/cleder/vercheck/blob/develop/README.md View the available commands and options for the Vercheck CLI tool. This is useful for understanding its functionality and parameters. ```console usage: vercheck [-h] [--check-version-number-only] version [filename] Check if the version is PEP-440 conformant. positional arguments: version The version number to compare against. filename The path to the file containing the version information. options: -h, --help show this help message and exit --check-version-number-only Only check if the version number is PEP-440 compliant without trying to retrieve a version from a file. ``` -------------------------------- ### Check version against file content Source: https://github.com/cleder/vercheck/blob/develop/README.md Verify if a given version number is PEP-440 compliant and matches the version found in a specified Python file. No output is produced on success. ```bash vercheck 0.2.0 src/vercheck/about.py ``` -------------------------------- ### Accessing Package Version Source: https://github.com/cleder/vercheck/blob/develop/README.md A common practice to access a package's version is through a `__version__` attribute. Ensure this version conforms to PEP 440. ```python import package_name print(package_name.__version__) ``` -------------------------------- ### Run Specific Nox Session (Tests) Source: https://github.com/cleder/vercheck/blob/develop/docs/contributing.md Invoke a specific Nox session, such as the unit test suite. ```console $ nox --session=tests ``` -------------------------------- ### Check Version Against Non-Python File Source: https://github.com/cleder/vercheck/blob/develop/docs/index.md Compare a version number against content in a file that is not a Python file, such as an egg-info file. The tool may issue warnings for non-standard filenames. ```bash vercheck 0.2.0 src vercheck 0.2.0 src/vercheck.egg-info/PKG-INFO ``` -------------------------------- ### Check version compliance only Source: https://github.com/cleder/vercheck/blob/develop/README.md Validate if a version number adheres to the PEP-440 standard without attempting to read from any file. This is useful for standalone version checks. ```bash vercheck 0.2.0 --check-version-number-only ``` -------------------------------- ### PEP 440 Version Scheme Source: https://github.com/cleder/vercheck/blob/develop/README.md The canonical public version identifiers must comply with the PEP 440 scheme. This defines the structure for valid version numbers. ```text [N!]N(.N)*[{a|b|rc}N][.postN][.devN] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.