{"id":2937,"library":"dohq-artifactory","title":"dohq-artifactory: A Python Client for Artifactory","description":"dohq-artifactory is an active Python interface library for JFrog Artifactory, released as version 1.0.1. It functions as a logical descendant of Python's `pathlib`, aiming for a similar interface, and was forked from the `parallels/artifactory` project to provide continued support and development. It supports Python versions 3.8 through 3.13. The library enables interaction with Artifactory for tasks such as managing artifacts, searching repositories, and handling administrative functions. It generally follows an on-demand release cadence based on feature development and bug fixes.","status":"active","version":"1.0.1","language":"en","source_language":"en","source_url":"https://github.com/devopshq/artifactory","tags":["artifactory","jfrog","devops","filesystem","pathlib","client","artifact-management"],"install":[{"cmd":"pip install dohq-artifactory","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"HTTP client for Artifactory API communication","package":"requests","optional":false},{"reason":"Date and time utilities","package":"python-dateutil","optional":false},{"reason":"JSON Web Token support for authentication","package":"PyJWT","optional":false}],"imports":[{"note":"Despite the package name `dohq-artifactory`, the primary class `ArtifactoryPath` is imported directly from the `artifactory` module. This is due to it being a fork of a previous 'artifactory' library and maintaining the original module import path.","wrong":"from dohq_artifactory import ArtifactoryPath","symbol":"ArtifactoryPath","correct":"from artifactory import ArtifactoryPath"},{"note":"While `import artifactory` works, accessing `ArtifactoryPath` would require `artifactory.ArtifactoryPath`. Direct import of the class is more common.","wrong":"import artifactory","symbol":"ArtifactoryPath","correct":"from artifactory import ArtifactoryPath"}],"quickstart":{"code":"import os\nfrom artifactory import ArtifactoryPath\n\nART_URL = os.environ.get('ARTIFACTORY_URL', 'https://artifactory.example.com/artifactory')\nART_USER = os.environ.get('ARTIFACTORY_USERNAME', 'admin')\nART_PASS = os.environ.get('ARTIFACTORY_PASSWORD', 'password') # Or API Key/Access Token\n\ntry:\n    # Initialize ArtifactoryPath with URL and authentication\n    artifactory_path = ArtifactoryPath(ART_URL, auth=(ART_USER, ART_PASS))\n\n    # Example: List contents of a repository (e.g., 'libs-release')\n    repo = artifactory_path / \"libs-release\"\n    print(f\"Contents of {repo}:\")\n    for item in repo:\n        print(f\"  - {item.name} ({'dir' if item.is_dir() else 'file'})\")\n\n    # Example: Access a specific artifact (assuming it exists)\n    artifact_path = repo / \"com\" / \"example\" / \"myapp\" / \"1.0.0\" / \"myapp-1.0.0.jar\"\n    if artifact_path.exists():\n        print(f\"\\nArtifact found: {artifact_path.name}\")\n        print(f\"  Size: {artifact_path.stat().size} bytes\")\n    else:\n        print(f\"\\nArtifact not found: {artifact_path}\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")","lang":"python","description":"This quickstart demonstrates how to connect to an Artifactory instance using `ArtifactoryPath` and basic authentication. It then shows how to list contents of a repository and check for the existence and properties of a specific artifact, leveraging the `pathlib`-like interface."},"warnings":[{"fix":"Always use `from artifactory import ArtifactoryPath` for imports.","message":"The library is imported via `from artifactory import ...` despite the PyPI package name being `dohq-artifactory`. This can lead to confusion if users expect `from dohq_artifactory import ...` or if another `artifactory` package exists in the environment.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Prefer using username/password tuples (`auth=('user', 'password')`) or explicit access tokens (`token='your_access_token'`) for authentication with `ArtifactoryPath`, especially with modern Artifactory instances. Consult JFrog documentation for the latest authentication recommendations.","message":"JFrog Artifactory itself has deprecated API keys as an authentication method. As of Artifactory version 7.98 (Q4 2024), creation of new API keys is disabled, with a push towards reference tokens. While `dohq-artifactory` still supports passing an API key via the `auth` or `apikey` parameter, users of newer Artifactory server versions should consider migrating to username/password or access tokens to avoid future compatibility issues.","severity":"deprecated","affected_versions":"All versions of dohq-artifactory when used with Artifactory server versions 7.98+ or in 2025 onwards."},{"fix":"Familiarize yourself with Python's `pathlib` module and the `dohq-artifactory` documentation to understand its filesystem-like approach to Artifactory resources.","message":"This library is designed as a 'logical descendant of pathlib', meaning interactions often mimic filesystem operations. Users accustomed to traditional HTTP client libraries might find this paradigm different and should review the documentation for `pathlib`-like methods such as `exists()`, `is_dir()`, `iterdir()`, and path concatenation (`/`).","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}