### Install Dependencies from Requirements Source: https://github.com/anthonyharrison/sbom4python/blob/main/README.md Alternatively, clone the repository and install dependencies using the provided requirements.txt file. This is useful for development or custom installations. ```bash pip install -U -r requirements.txt ``` -------------------------------- ### Install SBOM4Python Source: https://github.com/anthonyharrison/sbom4python/blob/main/README.md Install the SBOM4Python tool using pip. This command installs the package and its dependencies. ```bash pip install sbom4python ``` -------------------------------- ### Install development dependencies Source: https://github.com/anthonyharrison/sbom4python/blob/main/CONTRIBUTING.md Installs development-specific dependencies from the 'dev-requirements.txt' file. ```bash pip install -r dev-requirements.txt ``` -------------------------------- ### Install local copy for development Source: https://github.com/anthonyharrison/sbom4python/blob/main/CONTRIBUTING.md Installs the project locally in editable mode, allowing for development and testing without needing to package and reinstall. This command should be run from the main project directory. ```bash python3 -m pip install --user -e . ``` -------------------------------- ### Install virtualenv Source: https://github.com/anthonyharrison/sbom4python/blob/main/CONTRIBUTING.md Installs the virtualenv package, which is recommended for managing Python virtual environments to avoid dependency conflicts. ```bash pip install virtualenv ``` -------------------------------- ### Install libmagic on Linux Source: https://github.com/anthonyharrison/sbom4python/blob/main/README.md On Linux systems, install the 'libmagic' library using the system's package manager. This is a prerequisite for the 'python-magic' library. ```bash apt install libmagic-dev ``` -------------------------------- ### Install libmagic on MacOS Source: https://github.com/anthonyharrison/sbom4python/blob/main/README.md On MacOS, install the 'libmagic' library using Homebrew. This is a prerequisite for the 'python-magic' library. ```bash brew install libmagic ``` -------------------------------- ### Resolve python-magic Installation Error on Windows Source: https://github.com/anthonyharrison/sbom4python/blob/main/README.md If encountering an 'ImportError: failed to find libmagic' on Windows, uninstall and then reinstall 'python-magic' and 'python-magic-bin'. ```bash pip uninstall python-magic pip uninstall python-magic-bin pip install python-magic pip install python-magic-bin ``` -------------------------------- ### Create a Python 3.9 virtual environment Source: https://github.com/anthonyharrison/sbom4python/blob/main/CONTRIBUTING.md Creates a new virtual environment named 'venv3.9' in the specified directory using Python 3.9. ```bash virtualenv -p python3.9 ~/Code/venv3.9 ``` -------------------------------- ### SBOM4Python Command Line Usage Source: https://github.com/anthonyharrison/sbom4python/blob/main/README.md The main command-line interface for SBOM4Python. It accepts various options to specify input modules, requirements files, output formats, and more. ```bash usage: sbom4python [-h] [-m MODULE] [-r REQUIREMENT] [--system] [--exclude-license] [--include-file] [--include-service] [--use-pip] [--python PYTHON] [-d] [--sbom {spdx,cyclonedx}] [--format {tag,json,yaml}] [-o OUTPUT_FILE] [-g GRAPH] [-V] SBOM4Python generates a Software Bill of Materials for the specified installed Python module identifying all of the dependent components which are explicity defined (typically via requirements.txt file) or implicitly as a hidden dependency. options: -h, --help show this help message and exit -V, --version show program's version number and exit Input: -m MODULE, --module MODULE identity of python module -r REQUIREMENT, --requirement REQUIREMENT name of requirements file --system include all installed python modules within system --exclude-license suppress detecting the license of components --include-file include reporting files associated with module --include-service include reporting of endpoints --use-pip use pip for package management --python PYTHON use specified Python interpreter for pip Output: -d, --debug add debug information --sbom {spdx,cyclonedx} specify type of sbom to generate (default: spdx) --format {tag,json,yaml} specify format of software bill of materials (sbom) (default: tag) -o OUTPUT_FILE, --output-file OUTPUT_FILE output filename (default: output to stdout) -g GRAPH, --graph GRAPH filename for dependency graph ``` -------------------------------- ### Format all imports with isort Source: https://github.com/anthonyharrison/sbom4python/blob/main/CONTRIBUTING.md Recursively formats Python imports in all files within the current directory and its subdirectories using isort. ```bash isort --profile black . ``` -------------------------------- ### Format imports with isort Source: https://github.com/anthonyharrison/sbom4python/blob/main/CONTRIBUTING.md Formats Python imports alphabetically and by type using the isort tool. The '--profile black' flag ensures compatibility with the Black formatter. ```bash isort --profile black filename.py ``` -------------------------------- ### Activate a virtual environment Source: https://github.com/anthonyharrison/sbom4python/blob/main/CONTRIBUTING.md Activates the virtual environment located at '~/Code/venv3.9/bin/activate'. Once activated, 'python' and 'pip' commands will use the environment's specific Python version and packages. ```bash source ~/Code/venv3.9/bin/activate ``` -------------------------------- ### Format String using f-string Source: https://github.com/anthonyharrison/sbom4python/blob/main/CONTRIBUTING.md This snippet shows how to format a string using Python's f-string syntax to include variables like name and age. It demonstrates embedding variables directly within curly braces and highlights that type conversion is handled automatically. ```python #Program prints a string containing name and age of person name = "John Doe" age = 23 print(f"Name of the person is {name} and his age is {age}") #Output # "Name of the person is John Doe and his age is 23" ``` -------------------------------- ### Format code with Black Source: https://github.com/anthonyharrison/sbom4python/blob/main/CONTRIBUTING.md Applies automatic style formatting to a Python file using the Black formatter, ensuring PEP8 compliance. This should typically be run after isort. ```bash black filename.py ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.