Skip to content

chore(CI): Clean-up for the v2.0.0 release #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 37 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2598820
Tweak python version matrix for testing
jhodges10 Feb 7, 2022
62a8118
Refactor services -> resource
jhodges10 Mar 20, 2022
1f3a09a
Add #addVersionToAsset decorator to assets.add_version
jhodges10 Mar 20, 2022
9a631aa
Refactor, clean-up, and prep for release
jhodges10 Mar 22, 2022
a0fec77
Replace pipenv w/ poetry and update license
jhodges10 Mar 22, 2022
f4984b8
Version bump
jhodges10 Mar 22, 2022
6e95ea7
Modify orb for circleci
jhodges10 Mar 23, 2022
1939d32
Modify orb for circleci
jhodges10 Mar 23, 2022
fe09571
Drop 'latest' tag for CI
jhodges10 Mar 23, 2022
aba5008
Use correct test script
jhodges10 Mar 23, 2022
98811e3
Modify supported pythons
jhodges10 Mar 23, 2022
e825ec1
Use find_env instead of load_env
jhodges10 Mar 23, 2022
8773e6e
poetry updates
jhodges10 Mar 23, 2022
1663274
Use poetry in CI
jhodges10 Mar 23, 2022
1133eb9
Assume poetry already installed
jhodges10 Mar 23, 2022
d8e56e5
Tweak poetry install cmd slightly
jhodges10 Mar 23, 2022
467d3be
Tweak CI config further
jhodges10 Mar 23, 2022
4eb1a16
Restore poetry install step
jhodges10 Mar 23, 2022
2ab8c74
Update cimg/python
jhodges10 Mar 23, 2022
7a75706
Use specific python cimg
jhodges10 Mar 23, 2022
85bb5e2
Modify CI
jhodges10 Mar 23, 2022
c0f5f9b
Tweak CI for poetry
jhodges10 Mar 23, 2022
058d540
Add audit log crawler, and some other tests
jhodges10 Jun 1, 2022
841ad7e
Version bump
jhodges10 Jun 3, 2022
0d81d57
Add user search to the search class
jhodges10 Aug 19, 2022
f6d8f6f
Add missing furl dependency
jhodges10 Jul 25, 2023
2eccdf1
Clean-up examples
jhodges10 Jul 25, 2023
3f9d3a3
Fix audit log crawler example
jhodges10 Jul 25, 2023
c9923ab
Fix recursive upload function
jhodges10 Jul 25, 2023
071e004
Fix recursive upload resource function
jhodges10 Jul 25, 2023
bc627b6
Improve integration test dotenv import w/ find_dotenv()
jhodges10 Jul 25, 2023
1de0e5d
Update readme
jhodges10 Jul 25, 2023
8aeca41
Update readme further
jhodges10 Jul 25, 2023
83d676d
Add furl to the installation
jhodges10 Jul 25, 2023
cc8f142
Add additional examples
jhodges10 Jul 26, 2023
f255ad7
Add additional examples and improve Utils.stream() function
jhodges10 Jul 26, 2023
b6ff7cc
Add publishing information
jhodges10 Jul 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 22 additions & 75 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
version: 2.1

orbs:
python: circleci/[email protected]
win: circleci/[email protected]
python: circleci/[email protected]

workflows:
version: 2
Expand All @@ -23,7 +22,7 @@ workflows:
- gh-pages
matrix:
parameters:
python-version: ["3.6.5", "3.7.7", "3.8.6", "3.9.3", "latest"]
python-version: ["3.6.9", "3.7.7", "3.8.6", "3.9.3", "3.9.9", "3.9.10", "latest"]

- hold:
type: approval
Expand All @@ -40,37 +39,20 @@ workflows:
requires:
- hold

# - docs:
# requires:
# - deploy
# - build

# upload_test:
# triggers:
# - schedule:
# cron: "0,30 * * * *"
# filters:
# branches:
# only:
# - jh/use-xxhash-for-integration-test
# jobs:
# - build
# - upload_test_job:
# requires:
# - build

jobs:
build:
docker:
- image: circleci/python:latest
executor: python/default
steps:
- checkout:
name: Checkout Git
- python/install-packages:
pkg-manager:
poetry
- run:
name: Build Package
command: |
echo -e "Running sdist"
python setup.py sdist
poetry build
- persist_to_workspace:
root: /home/circleci/project/
paths:
Expand All @@ -82,72 +64,37 @@ jobs:
python-version:
type: string
docker:
- image: circleci/python:<< parameters.python-version >>
- image: cimg/python:<< parameters.python-version >>
steps:
- attach_workspace:
at: /tmp/artifact
name: Attach build artifact
- python/install-packages:
pkg-manager:
poetry
- run:
name: Install package
command: |
pip install --user '/tmp/artifact'
pip install poetry -U
- run:
name: Run integration test
name: Install package
command: |
python /tmp/artifact/tests/integration.py

upload_test_job:
description: Upload test
docker:
- image: circleci/python:latest
steps:
- attach_workspace:
at: /tmp/artifact
name: Attach build artifact
cd /tmp/artifact
poetry install --extras docs
- run:
name: Upload to pypi
name: Run integration test
command: |
cd /tmp/artifact
twine upload dist/*

# docs:
# docker:
# - image: circleci/python:latest

# steps:
# - attach_workspace:
# at: /tmp/artifact
# name: Attach build artifact

# - run:
# name: Install dependencies
# command: |
# cd /tmp/artifact/docs
# pip install -r requirements.txt

# - run:
# name: Build autodocs
# command: |
# cd /tmp/artifact/docs
# make jekyll

# - run:
# name: Publish autodocs
# command: |
# cd /tmp/artifact/docs
# python publish.py
python /tmp/artifact/tests/test_integration.py

deploy:
docker:
- image: circleci/python:latest
- image: cimg/python:3.10.2
steps:
- attach_workspace:
at: /tmp/artifact
name: Attach build artifact
- run:
name: Install dependencies
command: |
pip install setuptools wheel twine
- python/install-packages:
pkg-manager:
poetry
- run:
name: init .pypirc
command: |
Expand All @@ -159,4 +106,4 @@ jobs:
name: Upload to pypi
command: |
cd /tmp/artifact
twine upload dist/*
poetry publish
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,5 @@ Pipfile.lock
.vscode/launch.json
.vscode/settings.json

pyproject.toml
pyproject.toml
.vscode/settings.json
7 changes: 6 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"python.formatting.provider": "black"
"python.formatting.provider": "black",
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Frame.io
Copyright (c) 2022 Frame.io, an Adobe company.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ clean:
find . -name "*.pyc" -exec rm -f {} \;

test:
cd tests && pipenv run python integration.py
cd tests && poetry run python test_integration.py

package:
pipenv run python3 setup.py sdist bdist_wheel
poetry build

publish:
poetry publish

build-docker:
docker build . -t benchmark
Expand All @@ -32,7 +35,7 @@ format:
black frameioclient

view-docs:
cd docs && pip install -r requirements.txt && make dev
cd docs && poetry run make dev

publish-docs:
cd docs && pip install -r requirements.txt && make jekyll && make publish
cd docs && poetry run make jekyll
105 changes: 63 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,27 @@ Frame.io is a cloud-based collaboration hub that allows video professionals to s

### Installation

via Pip
```
via `pip`
```sh
$ pip install frameioclient
```

via Source
```
$ git clone https://github.com/frameio/python-frameio-client
$ pip install .
```

### Developing
Install the package into your development environment and link to it by running the following:

from source
```sh
pipenv install -e . -pre
$ git clone https://github.com/frameio/python-frameio-client
$ pip install -e .
```

## Documentation

[Frame.io API Documentation](https://developer.frame.io/docs)

### Use CLI
When you install this package, a cli tool called `fioctl` will also be installed to your environment.
When you install this package, a cli tool called `fioctfioclil` will also be installed to your environment.

**To upload a file or folder**
```sh
fioctl \
fiocli \
--token fio-u-YOUR_TOKEN_HERE \
--destination "YOUR TARGET FRAME.IO PROJECT OR FOLDER" \
--target "YOUR LOCAL SYSTEM DIRECTORY" \
Expand All @@ -49,33 +42,13 @@ fioctl \

**To download a file, project, or folder**
```sh
fioctl \
fiocli \
--token fio-u-YOUR_TOKEN_HERE \
--destination "YOUR LOCAL SYSTEM DIRECTORY" \
--target "YOUR TARGET FRAME.IO PROJECT OR FOLDER" \
--threads 2
```

### Links

**Sphinx Documentation**
- https://pythonhosted.org/sphinxcontrib-restbuilder/
- https://www.npmjs.com/package/rst-selector-parser
- https://sphinx-themes.org/sample-sites/furo/_sources/index.rst.txt
- https://developer.mantidproject.org/Standards/DocumentationGuideForDevs.html
- https://sublime-and-sphinx-guide.readthedocs.io/en/latest/code_blocks.html
- https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html
- https://stackoverflow.com/questions/64451966/python-sphinx-how-to-embed-code-into-a-docstring
- https://pythonhosted.org/an_example_pypi_project/sphinx.html

**Decorators**
- https://docs.python.org/3.7/library/functools.html
- https://realpython.com/primer-on-python-decorators/
- https://www.sphinx-doc.org/en/master/usage/quickstart.html
- https://www.geeksforgeeks.org/decorators-with-parameters-in-python/
- https://stackoverflow.com/questions/43544954/why-does-sphinx-autodoc-output-a-decorators-docstring-when-there-are-two-decora


## Usage

_Note: A valid token is required to make requests to Frame.io. Go to our [Developer Portal](https://developer.frame.io/) to get a token!_
Expand All @@ -87,9 +60,13 @@ In addition to the snippets below, examples are included in [/examples](/example
Get basic info on the authenticated user.

```python
import os
from frameioclient import FrameioClient

client = FrameioClient("TOKEN")
# We always recommend passing the token you'll be using via an environment variable and accessing it using os.getenv("FRAMEIO_TOKEN")
FRAMEIO_TOKEN = os.getenv("FRAMEIO_TOKEN")
client = FrameioClient(FRAMEIO_TOKEN)

me = client.users.get_me()
print(me['id'])
```
Expand All @@ -102,25 +79,69 @@ Create a new asset and upload a file. For `parent_asset_id` you must have the ro
import os
from frameioclient import FrameioClient

client = FrameioClient("TOKEN")
# We always recommend passing the token you'll be using via an environment variable and accessing it using os.getenv("FRAMEIO_TOKEN")
FRAMEIO_TOKEN = os.getenv("FRAMEIO_TOKEN")
client = FrameioClient(FRAMEIO_TOKEN)


# Create a new asset manually
asset = client.assets.create(
parent_asset_id="1234abcd",
client.assets.create(
parent_asset_id="0d98e024-d738-4d9a-ae89-19f02839116d",
name="MyVideo.mp4",
type="file",
filetype="video/mp4",
filesize=os.path.getsize("sample.mp4")
)

# Create a new folder
client.assets.create(
parent_asset_id="",
client.assets.create_folder(
parent_asset_id="63bfd7cc-8517-4a61-b655-0a59f5dec630",
name="Folder name",
type="folder" # this kwarg is what makes it a folder
)

# Upload a file
client.assets.upload(destination_id, "video.mp4")
```

## Contributing
Install the package into your development environment using Poetry. This should auto-link it within the current virtual-env that gets created during installation.

```sh
poetry install
```

### Publishing to PyPI

```sh
# Start by versioning
poetry version prerelease

# Then build
poetry build

# Now you can publish the new version
poetry publish --username=__token__ --password=INSERT_TOKEN_FROM_PYPI_OR_PASS_VIA_ENV_VARIABLE

# You can also build and publish in one go with
poetry publish --build --username=__token__ --password=INSERT_TOKEN_FROM_PYPI_OR_PASS_VIA_ENV_VARIABLE
```

### Ancillary links

**Sphinx Documentation**
- https://pythonhosted.org/sphinxcontrib-restbuilder/
- https://www.npmjs.com/package/rst-selector-parser
- https://sphinx-themes.org/sample-sites/furo/_sources/index.rst.txt
- https://developer.mantidproject.org/Standards/DocumentationGuideForDevs.html
- https://sublime-and-sphinx-guide.readthedocs.io/en/latest/code_blocks.html
- https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html
- https://stackoverflow.com/questions/64451966/python-sphinx-how-to-embed-code-into-a-docstring
- https://pythonhosted.org/an_example_pypi_project/sphinx.html

**Decorators**
- https://docs.python.org/3.7/library/functools.html
- https://realpython.com/primer-on-python-decorators/
- https://www.sphinx-doc.org/en/master/usage/quickstart.html
- https://www.geeksforgeeks.org/decorators-with-parameters-in-python/
- https://stackoverflow.com/questions/43544954/why-does-sphinx-autodoc-output-a-decorators-docstring-when-there-are-two-decora

2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

PACKAGE_TITLE = 'Frame.io Python SDK'
PACKAGE_NAME = 'frameioclient'
PACKAGE_DIR = '../frameioclient'
PACKAGE_DIR = '../'
AUTHOR_NAME = 'Frame.io'

try:
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Welcome to Frame.io's Python SDK documentation!
Welcome to the documentation for `frameioclient` !
===============================================

.. toctree::
Expand Down
Loading