Registry / devops / pyartifactory

pyartifactory

JSON →
library2.11.2pypypi✓ verified 87d ago

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.

pip install pyartifactory
INSTALL
IMPORT
SIG · PYARTIFACTORY
P
pyartifactory
devopspythonv2.11.2
Install
4.1s avg
Import
1801ms
Disk
33MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.11.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 1.858s · 34.3MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 4.1s · import 1.743s · 34MB
33MB installed
● package 33MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Artifactory
from pyartifactory import Artifactory
NewUser
from pyartifactory.models import NewUser
from pyartifactory.models.User import NewUser
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`.

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.

import os from pyartifactory import Artifactory from pyartifactory.models import NewUser ART_URL = os.environ.get('ARTIFACTORY_URL', 'http://localhost:8081/artifactory') ART_USER = os.environ.get('ARTIFACTORY_USERNAME', 'admin') ART_PASS = os.environ.get('ARTIFACTORY_PASSWORD', 'password') def main(): try: # Initialize the Artifactory client using basic authentication # For Artifactory 6.6.0+ and permission management, consider api_version=2 art = Artifactory(url=ART_URL, auth=(ART_USER, ART_PASS), api_version=1) print(f"Successfully connected to Artifactory at {ART_URL}.") # Example: List users users = art.users.list() print(f"Found {len(users)} users:") for user in users: print(f"- {user.name}") # Example: Create a new user (adjust name/email as needed) new_user_data = NewUser( name="test_user_ai", password="secure_password", email="test_user_ai@example.com" ) try: created_user = art.users.create(new_user_data) print(f"User '{created_user.name}' created successfully.") except Exception as e: print(f"Could not create user 'test_user_ai' (might already exist): {e}") except Exception as e: print(f"An error occurred: {e}") if __name__ == "__main__": main()
Debug
Known issues
breakingWhen 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.
fix
Initialize the client with `Artifactory(url=..., auth=..., api_version=2)` for permission management on Artifactory 6.6.0+.
affects: All versions when interacting with Artifactory 6.6.0+
gotchaIf 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.
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.
affects: All versions
gotchaRecent 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.
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.
affects: >=2.8.1
breakingVersion `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.
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.
affects: 2.6.0 - 2.7.0
Errors
Common errors & fixes
404 Client Error: Not Found for url: ...
This error typically indicates that the specified Artifactory URL, repository path, or the resource being accessed does not exist, or the authenticated user lacks the necessary permissions to see it. It can also occur if the API endpoint used by pyartifactory does not match the Artifactory server's configuration, especially with newer Artifactory versions and older pyartifactory clients for security APIs.
fix
Verify that the Artifactory URL and the path to the resource (e.g., repository, artifact, user group API endpoint) are correct. Ensure that the user credentials have the appropriate read/write permissions for the target resource. If managing permissions with Artifactory 6.6.0 or higher, ensure you pass `api_version=2` to the `Artifactory` constructor.
TypeError: Artifactory() got an unexpected keyword argument '...' (or similar for other methods)
This occurs when an unrecognized keyword argument is passed to a pyartifactory method or the `Artifactory` constructor. This is often due to using an outdated code snippet with a newer library version (or vice-versa), a typo in the argument name, or passing conflicting authentication parameters (e.g., both `auth` and `access_token`).
fix
Consult the official `pyartifactory` documentation for your installed version to confirm the correct parameters for the method being called. If providing authentication, ensure you pass either `auth=('USERNAME', 'PASSWORD_OR_API_KEY')` or `access_token='YOUR_TOKEN'`, but not both, as `access_token` takes precedence.
401 Client Error: Unauthorized for url: ...
This error signifies that the provided authentication credentials (username/password or access token) are incorrect, expired, or the user does not have the necessary permissions to access the Artifactory instance or perform the requested operation. It can also be caused by an incorrect `api_version` for certain operations.
fix
Double-check the username, password/API key, or access token for accuracy. Ensure the Artifactory user has the required permissions for the operation. When initializing the `Artifactory` client, explicitly set `api_version=2` if interacting with permission management on Artifactory versions 6.6.0 or higher.
AttributeError: 'Artifactory' object has no attribute '...'
This error indicates an attempt to access an attribute or method on the `Artifactory` client object that either does not exist, has been renamed in a newer version of the library, or is being used incorrectly. This can also happen due to a conflict with another Artifactory-related library or an outdated import.
fix
Verify the attribute or method name against the `pyartifactory` documentation for your installed version. Ensure that you are importing from `pyartifactory` and not a conflicting library (e.g., `artifactory` or `dohq-artifactory`) if both are installed. Update your code to use the correct API if it has changed between library versions.
Upgrade
Version history
2.11.2latest on PyPI · released Sep 23, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources
pyartifactory — pip install pyartifactory · libregistry