{"id":6043,"library":"pyartifactory","title":"pyartifactory","description":"pyartifactory is a Python library providing typed interactions with the JFrog Artifactory REST API, currently at version 2.11.2. It enables developers to manage Artifactory resources such as users, groups, permissions, repositories, artifacts, and access tokens in their applications. The library maintains an active release cadence with frequent updates to add features and address issues.","status":"active","version":"2.11.2","language":"en","source_language":"en","source_url":"https://github.com/anancarv/python-artifactory","tags":["artifactory","jfrog","rest-api","client","pydantic"],"install":[{"cmd":"pip install pyartifactory","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"symbol":"Artifactory","correct":"from pyartifactory import Artifactory"},{"note":"Models are directly under `pyartifactory.models` since version 1.0.0; older versions might have nested paths like `pyartifactory.models.User` or `pyartifactory.models.Group`.","wrong":"from pyartifactory.models.User import NewUser","symbol":"NewUser","correct":"from pyartifactory.models import NewUser"}],"quickstart":{"code":"import os\nfrom pyartifactory import Artifactory\nfrom pyartifactory.models import NewUser\n\nART_URL = os.environ.get('ARTIFACTORY_URL', 'http://localhost:8081/artifactory')\nART_USER = os.environ.get('ARTIFACTORY_USERNAME', 'admin')\nART_PASS = os.environ.get('ARTIFACTORY_PASSWORD', 'password')\n\ndef main():\n    try:\n        # Initialize the Artifactory client using basic authentication\n        # For Artifactory 6.6.0+ and permission management, consider api_version=2\n        art = Artifactory(url=ART_URL, auth=(ART_USER, ART_PASS), api_version=1)\n        print(f\"Successfully connected to Artifactory at {ART_URL}.\")\n\n        # Example: List users\n        users = art.users.list()\n        print(f\"Found {len(users)} users:\")\n        for user in users:\n            print(f\"- {user.name}\")\n\n        # Example: Create a new user (adjust name/email as needed)\n        new_user_data = NewUser(\n            name=\"test_user_ai\",\n            password=\"secure_password\",\n            email=\"test_user_ai@example.com\"\n        )\n        try:\n            created_user = art.users.create(new_user_data)\n            print(f\"User '{created_user.name}' created successfully.\")\n        except Exception as e:\n            print(f\"Could not create user 'test_user_ai' (might already exist): {e}\")\n        \n    except Exception as e:\n        print(f\"An error occurred: {e}\")\n\nif __name__ == \"__main__\":\n    main()","lang":"python","description":"This quickstart demonstrates how to initialize the `Artifactory` client using environment variables for credentials and then perform basic operations like listing users and creating a new user. It highlights the use of basic authentication and the `api_version` parameter for Artifactory 6.6.0+ permission management."},"warnings":[{"fix":"Initialize the client with `Artifactory(url=..., auth=..., api_version=2)` for permission management on Artifactory 6.6.0+.","message":"When managing permissions with Artifactory versions 6.6.0 or higher, you must explicitly pass `api_version=2` to the `Artifactory` constructor. Failing to do so will result in using the older API version (defaulting to 1) and potential errors or incorrect behavior for permission-related operations.","severity":"breaking","affected_versions":"All versions when interacting with Artifactory 6.6.0+"},{"fix":"Ensure you provide only one authentication method: either `auth=('USERNAME', 'PASSWORD')` or `access_token='YOUR_TOKEN'`, but not both if you intend to use basic auth.","message":"If both `access_token` and `auth` (username/password tuple) are provided to the `Artifactory` constructor, the `access_token` authentication method will take precedence. Your `auth` credentials will be ignored.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Update your code to handle potentially `None` values for fields that have become optional in newer `pyartifactory` versions, especially when working with `BuildArtifact` and checksums.","message":"Recent versions (e.g., v2.11.1, v2.8.1) have made certain model fields (like `BuildArtifact.type` and `OriginalChecksums` attributes) optional. While this fixed validation errors, users relying on these fields always being present or non-null in older code might encounter `None` values where they previously expected data.","severity":"gotcha","affected_versions":">=2.8.1"},{"fix":"If experiencing issues on `v2.6.0` or `v2.7.0`, upgrade to `v2.7.1` or a later version to benefit from the backward compatibility fix.","message":"Version `2.6.0` introduced backward compatibility issues that were later fixed in `v2.7.1`. Users upgrading from `v2.6.0` to `v2.7.0` (or newer if `v2.7.1` wasn't applied) may encounter regressions or unexpected behavior due to changes that were not initially backward-compatible.","severity":"breaking","affected_versions":"2.6.0 - 2.7.0"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z","problems":[]}