Skip to content

Commit

Permalink
Merge pull request #47 from anancarv/generic-repo-actions
Browse files Browse the repository at this point in the history
Generic repo actions
  • Loading branch information
anancarv authored Apr 6, 2020
2 parents b6b2470 + 11f64f0 commit 755cfca
Show file tree
Hide file tree
Showing 12 changed files with 689 additions and 200 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/check_code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:

steps:
- uses: actions/checkout@v1
- name: Set up Python 3.6
- name: Set up Python 3.7
uses: actions/setup-python@350318022136c903b1dcf90854e65700f78938e1
with:
python-version: 3.6
python-version: 3.7

- name: Install Poetry
uses: dschep/install-poetry-action@db2e37f48d1b1cd1491c4590338ebc7699adb425
Expand All @@ -26,10 +26,6 @@ jobs:
- name: Install Dependencies
run: poetry install

- name: Type checking with mypy
run: |
poetry run mypy pyartifactory
- name: Lint with pre-commit
run: |
poetry run pre-commit run --all-files
Expand Down
10 changes: 7 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ repos:
rev: '19.10b0'
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v0.740'
- repo: local
hooks:
- id: mypy
- id: mypy
name: mypy
entry: mypy
language: system
types: [python]
files: pyartifactory/
- repo: https://github.com/Yelp/detect-secrets
rev: 'v0.13.0'
hooks:
Expand Down
33 changes: 22 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

`pyartifactory` is a Python library to access the [Artifactory REST API](https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API).

This library enables you to manage Artifactory resources such as users, groups, permissions, repositories, artifacts and access tokens in your applications.
It requires at least Python 3.6
This library enables you to manage Artifactory resources such as users, groups, permissions, repositories, artifacts and access tokens in your applications. Based on Python 3.6+ type hints.

<!-- toc -->

- [Requirements](#requirements)
- [Install](#install)
- [Usage](#usage)
* [Authentication](#authentication)
Expand All @@ -36,6 +36,11 @@ It requires at least Python 3.6

<!-- tocstop -->

## Requirements

* Python 3.6+


## Install

```python
Expand Down Expand Up @@ -184,26 +189,32 @@ Get the list of repositories:
repositories = art.repositories.list()
```

Get a single repository (Local, Virtual or Remote):
Get a single repository
```python
local_repo = art.repositories.get_local_repo("local_repo_name")
virtual_repo = art.repositories.get_virtual_repo("virtual_repo_name")
remote_repo = art.repositories.get_remote_repo("remote_repo_name")
repo = art.repositories.get_repo("repo_name")
# According to the repo type, you'll have either a local, virtual or remote repository returned
```

Create/Update a repository:
```python
from pyartifactory.models import LocalRepository, VirtualRepository, RemoteRepository

# Create a repository
# Create local repo
local_repo = LocalRepository(key="test_local_repo")
new_local_repo = art.repositories.create_local_repo(local_repo)
new_local_repo = art.repositories.create_repo(local_repo)

# Create virtual repo
virtual_repo = VirtualRepository(key="test_virtual_repo")
new_virtual_repo = art.repositories.create_repo(virtual_repo)

# Create remote repo
remote_repo = RemoteRepository(key="test_remote_repo")
new_remote_repo = art.repositories.create_repo(remote_repo)

# Update a repository
local_repo = art.repositories.get_repo("test_local_repo")
local_repo.description = "test_local_repo"
updated_local_repo = art.repositories.update_local_repo(local_repo)

# Same process for Virtual and Remote repositories
updated_local_repo = art.repositories.update_repo(local_repo)
```

Delete a repository:
Expand Down
1 change: 1 addition & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[mypy]
plugins = pydantic.mypy
warn_return_any = True
warn_unused_configs = True

Expand Down
Loading

0 comments on commit 755cfca

Please sign in to comment.