Skip to content

Commit 3eac98b

Browse files
authored
CI Integration (#1)
CI Integration
2 parents 4b76061 + 7be9ed7 commit 3eac98b

File tree

5 files changed

+128
-54
lines changed

5 files changed

+128
-54
lines changed

.github/test.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Python CI
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python: [3.7, 3.8]
12+
13+
steps:
14+
- uses: actions/checkout@v1
15+
- name: Setup Python
16+
uses: actions/setup-python@v1
17+
with:
18+
python-version: ${{ matrix.python }}
19+
- name: Install Tox and any other packages
20+
run: pip install -r requirements/test.txt
21+
- name: Run Tox
22+
run: tox -e py

.github/workflows/publish.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Upload Python Package
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v1
12+
- name: Set up Python
13+
uses: actions/setup-python@v1
14+
with:
15+
python-version: '3.x'
16+
- name: Install dependencies
17+
run: |
18+
python -m pip install --upgrade pip
19+
pip install setuptools wheel twine
20+
- name: Build and publish
21+
env:
22+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
23+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
24+
run: |
25+
python setup.py sdist bdist_wheel
26+
twine upload dist/*

.github/workflows/test.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Python package
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python: [3.7, 3.8]
12+
13+
steps:
14+
- uses: actions/checkout@v1
15+
- name: Setup Python
16+
uses: actions/setup-python@v1
17+
with:
18+
python-version: ${{ matrix.python }}
19+
- name: Install Tox and any other packages
20+
run: pip install -r requirements/test.txt
21+
- name: Run Tox
22+
run: tox -e py

README.md

Lines changed: 57 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Python SDK for ImageKit
22

3+
[![Python CI](https://github.com/imagekit-developer/imagekit-python/workflows/Python%20CI/badge.svg)](https://github.com/imagekit-developer/imagekitio-python/)
4+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5+
[![Twitter Follow](https://img.shields.io/twitter/follow/imagekitio?label=Follow&style=social)](https://twitter.com/ImagekitIo)
6+
37
Python SDK for [ImageKit](https://imagekit.io/) that implements the new APIs and interface for performing different file
48
operations.
59

@@ -90,16 +94,16 @@ https://ik.imagekit.io/your_imagekit_id/endpoint/default-image.jpg?tr=h-300%2Cw-
9094

9195
The ```.url()``` method accepts the following parameters
9296

93-
| Option | Description |
94-
| :----------------| :----------------------------- |
95-
| url_endpoint | Optional. The base URL to be appended before the path of the image. If not specified, the URL Endpoint specified at the time of SDK initialization is used. For example, https://ik.imagekit.io/your_imagekit_id/endpoint/ |
96-
| path | Conditional. This is the path at which the image exists. For example, `/path/to/image.jpg`. Either the `path` or `src` parameter need to be specified for URL generation. |
97-
| src | Conditional. This is the complete URL of an image already mapped to ImageKit. For example, `https://ik.imagekit.io/your_imagekit_id/endpoint/path/to/image.jpg`. Either the `path` or `src` parameter need to be specified for URL generation. |
98-
| transformation | Optional. An array of objects specifying the transformation to be applied in the URL. The transformation name and the value should be specified as a key-value pair in the object. Different steps of a [chained transformation](https://docs.imagekit.io/imagekit-docs/chained-transformations) can be specified as different objects of the array. The complete list of supported transformations in the SDK and some examples of using them are given later. If you use a transformation name that is not specified in the SDK, it gets applied as it is in the URL. |
99-
| transformation_position | Optional. Default value is `path` that places the transformation string as a path parameter in the URL. Can also be specified as `query` which adds the transformation string as the query parameter `tr` in the URL. If you use `src` parameter to create the URL, then the transformation string is always added as a query parameter. |
100-
| query_parameters | Optional. These are the other query parameters that you want to add to the final URL. These can be any query parameters and not necessarily related to ImageKit. Especially useful, if you want to add some versioning parameter to your URLs. |
101-
| signed | Optional. Boolean. Default is `false`. If set to `true`, the SDK generates a signed image URL adding the image signature to the image URL. This can only be used if you are creating the URL with the `url_endpoint` and `path` parameters, and not with the `src` parameter. |
102-
| expire_seconds | Optional. Integer. Meant to be used along with the `signed` parameter to specify the time in seconds from now when the URL should expire. If specified, the URL contains the expiry timestamp in the URL and the image signature is modified accordingly. |
97+
| Option | Description |
98+
| :---------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
99+
| url_endpoint | Optional. The base URL to be appended before the path of the image. If not specified, the URL Endpoint specified at the time of SDK initialization is used. For example, https://ik.imagekit.io/your_imagekit_id/endpoint/ |
100+
| path | Conditional. This is the path at which the image exists. For example, `/path/to/image.jpg`. Either the `path` or `src` parameter need to be specified for URL generation. |
101+
| src | Conditional. This is the complete URL of an image already mapped to ImageKit. For example, `https://ik.imagekit.io/your_imagekit_id/endpoint/path/to/image.jpg`. Either the `path` or `src` parameter need to be specified for URL generation. |
102+
| transformation | Optional. An array of objects specifying the transformation to be applied in the URL. The transformation name and the value should be specified as a key-value pair in the object. Different steps of a [chained transformation](https://docs.imagekit.io/imagekit-docs/chained-transformations) can be specified as different objects of the array. The complete list of supported transformations in the SDK and some examples of using them are given later. If you use a transformation name that is not specified in the SDK, it gets applied as it is in the URL. |
103+
| transformation_position | Optional. Default value is `path` that places the transformation string as a path parameter in the URL. Can also be specified as `query` which adds the transformation string as the query parameter `tr` in the URL. If you use `src` parameter to create the URL, then the transformation string is always added as a query parameter. |
104+
| query_parameters | Optional. These are the other query parameters that you want to add to the final URL. These can be any query parameters and not necessarily related to ImageKit. Especially useful, if you want to add some versioning parameter to your URLs. |
105+
| signed | Optional. Boolean. Default is `false`. If set to `true`, the SDK generates a signed image URL adding the image signature to the image URL. This can only be used if you are creating the URL with the `url_endpoint` and `path` parameters, and not with the `src` parameter. |
106+
| expire_seconds | Optional. Integer. Meant to be used along with the `signed` parameter to specify the time in seconds from now when the URL should expire. If specified, the URL contains the expiry timestamp in the URL and the image signature is modified accordingly. |
103107

104108

105109
## Examples of generating URLs
@@ -180,49 +184,49 @@ If a transformation is supported in ImageKit, but a name for it cannot be found
180184
transformation code from ImageKit docs as the name when using in the ```url``` function.
181185

182186
| Supported Transformation Name | Translates to parameter |
183-
|-------------------------------|-------------------------|
184-
| height | h |
185-
| width | w |
186-
| aspect_ratio | ar |
187-
| quality | q |
188-
| crop | c |
189-
| crop_mode | cm |
190-
| x | x |
191-
| y | y |
192-
| focus | fo |
193-
| format | f |
194-
| radius | r |
195-
| background | bg |
196-
| border | bo |
197-
| rotation | rt |
198-
| blur | bl |
199-
| named | n |
200-
| overlay_image | oi |
201-
| overlay_x | ox |
202-
| overlay_y | oy |
203-
| overlay_focus | ofo |
204-
| overlay_height | oh |
205-
| overlay_width | ow |
206-
| overlay_text | ot |
207-
| overlay_text_font_size | ots |
208-
| overlay_text_font_family | otf |
209-
| overlay_text_color | otc |
210-
| overlay_alpha | oa |
211-
| overlay_text_typography | ott |
212-
| overlay_background | obg |
213-
| overlay_image_trim | oit |
214-
| progressive | pr |
215-
| lossless | lo |
216-
| trim | t |
217-
| metadata | md |
218-
| color_profile | cp |
219-
| default_image | di |
220-
| dpr | dpr |
221-
| effect_sharpen | e-sharpen |
222-
| effect_usm | e-usm |
223-
| effect_contrast | e-contrast |
224-
| effect_gray | e-grayscale |
225-
| original | orig |
187+
| ----------------------------- | ----------------------- |
188+
| height | h |
189+
| width | w |
190+
| aspect_ratio | ar |
191+
| quality | q |
192+
| crop | c |
193+
| crop_mode | cm |
194+
| x | x |
195+
| y | y |
196+
| focus | fo |
197+
| format | f |
198+
| radius | r |
199+
| background | bg |
200+
| border | bo |
201+
| rotation | rt |
202+
| blur | bl |
203+
| named | n |
204+
| overlay_image | oi |
205+
| overlay_x | ox |
206+
| overlay_y | oy |
207+
| overlay_focus | ofo |
208+
| overlay_height | oh |
209+
| overlay_width | ow |
210+
| overlay_text | ot |
211+
| overlay_text_font_size | ots |
212+
| overlay_text_font_family | otf |
213+
| overlay_text_color | otc |
214+
| overlay_alpha | oa |
215+
| overlay_text_typography | ott |
216+
| overlay_background | obg |
217+
| overlay_image_trim | oit |
218+
| progressive | pr |
219+
| lossless | lo |
220+
| trim | t |
221+
| metadata | md |
222+
| color_profile | cp |
223+
| default_image | di |
224+
| dpr | dpr |
225+
| effect_sharpen | e-sharpen |
226+
| effect_usm | e-usm |
227+
| effect_contrast | e-contrast |
228+
| effect_gray | e-grayscale |
229+
| original | orig |
226230

227231
## File Upload
228232

tests/test_generate_url.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class TestGenerateURL(unittest.TestCase):
88
def setUp(self) -> None:
99
self.client = ImageKit(
10-
private_key=os.environ.get("private_key"),
10+
private_key="fake111",
1111
public_key="fake122",
1212
url_endpoint="https://ik.imagekit.io/your_imagekit_id/",
1313
)

0 commit comments

Comments
 (0)