Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
fcc1501
black
octavian-ionescu Feb 19, 2024
9081a4e
dropped 2.7, 3.6, 3.7
octavian-ionescu Feb 19, 2024
1615e6d
dropped 2.7, 3.6, 3.7
octavian-ionescu Feb 19, 2024
7f0ffcc
poetry
octavian-ionescu Feb 19, 2024
3f06250
wip poetry
octavian-ionescu Feb 19, 2024
a8e7193
wip poetry
octavian-ionescu Feb 19, 2024
741d289
wip poetry
octavian-ionescu Feb 19, 2024
bf37c04
wip poetry
octavian-ionescu Feb 19, 2024
dc44ddb
wip poetry
octavian-ionescu Feb 19, 2024
5b2510f
wip poetry
octavian-ionescu Feb 19, 2024
06a25e0
wip poetry
octavian-ionescu Feb 19, 2024
c389c48
poetry dynamic versioning
octavian-ionescu Feb 20, 2024
a36d550
wip poetry tests
octavian-ionescu Feb 20, 2024
eecdf1f
wip poetry tests
octavian-ionescu Feb 20, 2024
98fa190
wip versioning
octavian-ionescu Feb 20, 2024
8cd993f
wip versioning
octavian-ionescu Feb 20, 2024
b1e59e0
plugin now writes version in _version.py file + pre-commit-config
octavian-ionescu Feb 26, 2024
1f648bd
poetry cicd
octavian-ionescu Feb 26, 2024
f9fecbb
poetry cicd
octavian-ionescu Feb 26, 2024
215a6d2
poetry cicd
octavian-ionescu Feb 26, 2024
67832ba
dubious ownership fix
octavian-ionescu Feb 26, 2024
7f0c7a7
dubious ownership fix
octavian-ionescu Feb 26, 2024
5aebadc
version file
octavian-ionescu Feb 26, 2024
0ce6f7b
removed setup.py
octavian-ionescu Feb 26, 2024
c35d027
black pre-commit set to 3.11
octavian-ionescu Feb 26, 2024
979a648
cicd feedback
octavian-ionescu Feb 26, 2024
b6191f4
typo
octavian-ionescu Feb 26, 2024
7b4539a
cicd twine dev dependency
octavian-ionescu Feb 26, 2024
4288f27
cicd typo
octavian-ionescu Feb 26, 2024
bd29554
cicd wip
octavian-ionescu Feb 27, 2024
dff7b81
cicd wip
octavian-ionescu Feb 27, 2024
c631474
cicd wip
octavian-ionescu Feb 27, 2024
2a724e7
cicd wip
octavian-ionescu Feb 27, 2024
4365287
cicd wip
octavian-ionescu Feb 27, 2024
eff4ac0
cicd wip
octavian-ionescu Feb 27, 2024
0ec9d8b
cicd wip
octavian-ionescu Feb 27, 2024
7f19839
cicd wip
octavian-ionescu Feb 27, 2024
0d26824
cicd wip
octavian-ionescu Feb 27, 2024
13d47e1
cicd wip
octavian-ionescu Feb 27, 2024
64e2b04
cicd wip
octavian-ionescu Feb 27, 2024
ce237a7
packages and pythonpath
octavian-ionescu Feb 27, 2024
951a487
feat: python 3.12 support (#32)
torsdag Feb 27, 2024
abdd4e2
deps
octavian-ionescu Feb 27, 2024
22a7787
feat: Replaced deprecated appdirs with platformdirs (#29)
henriknorin-ftrack Feb 27, 2024
b55a0c9
release notes
octavian-ionescu Feb 27, 2024
c31f245
updated release notes
octavian-ionescu Feb 27, 2024
4c23413
release notes update
octavian-ionescu Mar 4, 2024
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
34 changes: 27 additions & 7 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,37 @@ on:
pull_request:

jobs:
check-formatting:
runs-on: ubuntu-latest
container:
image: python:3
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Check formatting
uses: psf/black@stable
with:
options: "--check"
src: .
version: "~= 22.0"

run-tests:
runs-on: ubuntu-latest
name: Run tests (${{ matrix.python-version }})
strategy:
fail-fast: false
matrix:
python-version: ["2.7", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
runs-on: ubuntu-latest
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Run pytest
run: |
python setup.py test
curl -sSL https://install.python-poetry.org | python
poetry install
poetry run python -m pytest --disable-pytest-warnings
env:
FTRACK_SERVER: ${{ secrets.FTRACK_SERVER }}
FTRACK_API_USER: ${{ secrets.FTRACK_API_USER }}
Expand All @@ -37,10 +56,11 @@ jobs:
python-version: "3.x"
- name: Build
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
python setup.py sdist bdist_wheel --universal
twine check dist/*
curl -sSL https://install.python-poetry.org | python
poetry self add "poetry-dynamic-versioning[plugin]"
poetry install --only=dev --no-interaction
poetry build --format=wheel
poetry run twine check dist/*
- uses: actions/upload-artifact@v2
with:
name: dist
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,3 @@ Thumbs.db
.cache
test-reports/*
.pytest_cache/*

# SCM VERSION
source/ftrack_api/_version.py
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
language_version: python3.11
14 changes: 13 additions & 1 deletion doc/installing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ Installation is simple with `pip <http://www.pip-installer.org/>`_::

pip install ftrack-python-api

Development
===========

.. highlight:: bash

Install Poetry and pre-commit (for MacOS, this can be achieved using homebrew):

brew install Poetry
poetry shell
poetry install
pre-commit install

Building from source
====================

Expand Down Expand Up @@ -53,7 +65,7 @@ Dependencies
============

* `ftrack server <http://ftrack.rtd.ftrack.com/en/stable/>`_ >= 3.3.11
* `Python <http://python.org>`_ >=2.7.9, <4.0
* `Python <http://python.org>`_ >=3.8, <4.0
* `Requests <http://docs.python-requests.org>`_ >= 2, <3
* `Arrow <http://crsmithdev.com/arrow/>`_ >= 0.4.4, < 1
* `termcolor <https://pypi.python.org/pypi/termcolor>`_ >= 1.1.0, < 2
Expand Down
15 changes: 15 additions & 0 deletions doc/release/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ Release Notes

.. release:: Upcoming

.. change:: new
:tags: compatibility

Added support for Python 3.12

.. change:: changed
:tags: compatibility

Dropped support for Python 2.7, 3.6 and 3.7

.. change:: changed
:tags: path resolve

Replaced deprecated appdirs with platformdirs.

.. change:: changed
:tags: events, security

Expand Down
1,386 changes: 1,386 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

56 changes: 56 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[tool.poetry]
name = "ftrack-python-api"
version = "0.1.0"
description = "Python API for ftrack."
authors = ["ftrack <[email protected]>"]
readme = "README.rst"
packages = [
{ include = "ftrack_api", from = "source" },
]

[tool.poetry-dynamic-versioning]
enable = true

[tool.poetry-dynamic-versioning.substitution]
files = ["source/ftrack_api/_version.py"]

[tool.poetry-dynamic-versioning.files."source/ftrack_api/_version.py"]
persistent-substitution = true
initial-content = """
# These version placeholders will be replaced later during substitution.
__version__ = "0.0.0"
"""

[tool.poetry.dependencies]
python = "^3.8"
sphinx = ">=1.2.2, <1.6"
sphinx_rtd_theme = ">=0.1.6, <1"
lowdown = ">=0.1.0,<2"
setuptools = ">=30.3.0"
setuptools-scm = "^7.1.0"
requests = ">=2,<3"
arrow = ">=0.4.4,<1"
termcolor = ">=1.1.0,<2"
pyparsing = ">=2.0,<3"
clique = "==1.6.1"
websocket-client = ">=0.40.0,<1"
future = ">=0.16.0,<1"
six = ">=1.13.0,<2"
platformdirs = ">=4.0.0,<5"
wheel = "^0.41.2"

[tool.poetry.group.dev.dependencies]
black = "^23.7.0"
pre-commit = "^3.4.0"
twine = "^4.0.2"

[tool.poetry.group.test.dependencies]
pytest = "^7.4.1"
pytest-mock = "^3.11.1"
mock = "^5.1.0"
flaky = "^3.7.0"

[build-system]
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
build-backend = "poetry_dynamic_versioning.backend"

112 changes: 0 additions & 112 deletions setup.py

This file was deleted.

2 changes: 2 additions & 0 deletions source/ftrack_api/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# These version placeholders will be replaced later during substitution.
__version__ = "0.0.1.dev"
4 changes: 0 additions & 4 deletions source/ftrack_api/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,15 @@

'''

from future import standard_library
standard_library.install_aliases()
from builtins import str
from six import string_types
from builtins import object
import collections
from six.moves import collections_abc
import functools
import abc
import copy
import inspect
import re
import six

try:
# Python 2.x
Expand Down
2 changes: 0 additions & 2 deletions source/ftrack_api/event/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

from __future__ import absolute_import

from future import standard_library
standard_library.install_aliases()
from builtins import str
from builtins import range
from builtins import object
Expand Down
23 changes: 21 additions & 2 deletions source/ftrack_api/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import collections
import os
import uuid
import imp
import traceback

try:
Expand Down Expand Up @@ -41,6 +40,26 @@ def getfullargspec(func):
annotations={}
)

try:
from imp import load_source

except ImportError:
# The imp module is deprecated in version 3.12. Use importlib instead.
import importlib.util
import importlib.machinery

def load_source(modname, filename):
# https://docs.python.org/3/whatsnew/3.12.html#imp

loader = importlib.machinery.SourceFileLoader(modname, filename)
module = importlib.util.module_from_spec(
importlib.util.spec_from_file_location(modname, filename, loader=loader)
)

loader.exec_module(module)

return module


def discover(paths, positional_arguments=None, keyword_arguments=None):
'''Find and load plugins in search *paths*.
Expand Down Expand Up @@ -77,7 +96,7 @@ def discover(paths, positional_arguments=None, keyword_arguments=None):
unique_name = uuid.uuid4().hex

try:
module = imp.load_source(unique_name, module_path)
module = load_source(unique_name, module_path)
except Exception as error:
logger.warning(
'Failed to load plugin from "{0}": {1}'
Expand Down
4 changes: 2 additions & 2 deletions source/ftrack_api/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import requests.utils
import arrow
import clique
import appdirs
import platformdirs

import ftrack_api
import ftrack_api.exception
Expand Down Expand Up @@ -327,7 +327,7 @@ def __init__(
# rebuilding types)?
if schema_cache_path is not False:
if schema_cache_path is None:
schema_cache_path = appdirs.user_cache_dir()
schema_cache_path = platformdirs.user_cache_dir()
schema_cache_path = os.environ.get(
'FTRACK_API_SCHEMA_CACHE_PATH', schema_cache_path
)
Expand Down