Skip to content

Commit ce878c4

Browse files
octavian-ionescutorsdaghenriknorin-ftrack
authored
feat: drop py2 support / add black and poetry (#30)
Co-authored-by: Eric Hermelin <eric.hermelin@ftrack.com> Co-authored-by: Henrik Norin <112491360+henriknorin-ftrack@users.noreply.github.com>
1 parent 3f62026 commit ce878c4

File tree

13 files changed

+1530
-133
lines changed

13 files changed

+1530
-133
lines changed

.github/workflows/cicd.yml

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,37 @@ on:
1010
pull_request:
1111

1212
jobs:
13+
check-formatting:
14+
runs-on: ubuntu-latest
15+
container:
16+
image: python:3
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v3
20+
- name: Check formatting
21+
uses: psf/black@stable
22+
with:
23+
options: "--check"
24+
src: .
25+
version: "~= 22.0"
26+
1327
run-tests:
28+
runs-on: ubuntu-latest
1429
name: Run tests (${{ matrix.python-version }})
1530
strategy:
1631
fail-fast: false
1732
matrix:
18-
python-version: ["2.7", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
19-
runs-on: ubuntu-latest
33+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
2034
steps:
2135
- uses: actions/checkout@v3
36+
- uses: actions/setup-python@v4
37+
with:
38+
python-version: ${{ matrix.python-version }}
2239
- name: Run pytest
2340
run: |
24-
python setup.py test
41+
curl -sSL https://install.python-poetry.org | python
42+
poetry install
43+
poetry run python -m pytest --disable-pytest-warnings
2544
env:
2645
FTRACK_SERVER: ${{ secrets.FTRACK_SERVER }}
2746
FTRACK_API_USER: ${{ secrets.FTRACK_API_USER }}
@@ -37,10 +56,11 @@ jobs:
3756
python-version: "3.x"
3857
- name: Build
3958
run: |
40-
python -m pip install --upgrade pip
41-
pip install setuptools wheel twine
42-
python setup.py sdist bdist_wheel --universal
43-
twine check dist/*
59+
curl -sSL https://install.python-poetry.org | python
60+
poetry self add "poetry-dynamic-versioning[plugin]"
61+
poetry install --only=dev --no-interaction
62+
poetry build --format=wheel
63+
poetry run twine check dist/*
4464
- uses: actions/upload-artifact@v2
4565
with:
4666
name: dist

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,3 @@ Thumbs.db
4343
.cache
4444
test-reports/*
4545
.pytest_cache/*
46-
47-
# SCM VERSION
48-
source/ftrack_api/_version.py

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/psf/black
5+
rev: 23.7.0
6+
hooks:
7+
- id: black
8+
language_version: python3.11

doc/installing.rst

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@ Installation is simple with `pip <http://www.pip-installer.org/>`_::
1313

1414
pip install ftrack-python-api
1515

16+
Development
17+
===========
18+
19+
.. highlight:: bash
20+
21+
Install Poetry and pre-commit (for MacOS, this can be achieved using homebrew):
22+
23+
brew install Poetry
24+
poetry shell
25+
poetry install
26+
pre-commit install
27+
1628
Building from source
1729
====================
1830

@@ -53,7 +65,7 @@ Dependencies
5365
============
5466

5567
* `ftrack server <http://ftrack.rtd.ftrack.com/en/stable/>`_ >= 3.3.11
56-
* `Python <http://python.org>`_ >=2.7.9, <4.0
68+
* `Python <http://python.org>`_ >=3.8, <4.0
5769
* `Requests <http://docs.python-requests.org>`_ >= 2, <3
5870
* `Arrow <http://crsmithdev.com/arrow/>`_ >= 0.4.4, < 1
5971
* `termcolor <https://pypi.python.org/pypi/termcolor>`_ >= 1.1.0, < 2

doc/release/release_notes.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,21 @@ Release Notes
1616

1717
.. release:: Upcoming
1818

19+
.. change:: new
20+
:tags: compatibility
21+
22+
Added support for Python 3.12
23+
24+
.. change:: changed
25+
:tags: compatibility
26+
27+
Dropped support for Python 2.7, 3.6 and 3.7
28+
29+
.. change:: changed
30+
:tags: path resolve
31+
32+
Replaced deprecated appdirs with platformdirs.
33+
1934
.. change:: changed
2035
:tags: events, security
2136

poetry.lock

Lines changed: 1386 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
[tool.poetry]
2+
name = "ftrack-python-api"
3+
version = "0.1.0"
4+
description = "Python API for ftrack."
5+
authors = ["ftrack <support@ftrack.com>"]
6+
readme = "README.rst"
7+
packages = [
8+
{ include = "ftrack_api", from = "source" },
9+
]
10+
11+
[tool.poetry-dynamic-versioning]
12+
enable = true
13+
14+
[tool.poetry-dynamic-versioning.substitution]
15+
files = ["source/ftrack_api/_version.py"]
16+
17+
[tool.poetry-dynamic-versioning.files."source/ftrack_api/_version.py"]
18+
persistent-substitution = true
19+
initial-content = """
20+
# These version placeholders will be replaced later during substitution.
21+
__version__ = "0.0.0"
22+
"""
23+
24+
[tool.poetry.dependencies]
25+
python = "^3.8"
26+
sphinx = ">=1.2.2, <1.6"
27+
sphinx_rtd_theme = ">=0.1.6, <1"
28+
lowdown = ">=0.1.0,<2"
29+
setuptools = ">=30.3.0"
30+
setuptools-scm = "^7.1.0"
31+
requests = ">=2,<3"
32+
arrow = ">=0.4.4,<1"
33+
termcolor = ">=1.1.0,<2"
34+
pyparsing = ">=2.0,<3"
35+
clique = "==1.6.1"
36+
websocket-client = ">=0.40.0,<1"
37+
future = ">=0.16.0,<1"
38+
six = ">=1.13.0,<2"
39+
platformdirs = ">=4.0.0,<5"
40+
wheel = "^0.41.2"
41+
42+
[tool.poetry.group.dev.dependencies]
43+
black = "^23.7.0"
44+
pre-commit = "^3.4.0"
45+
twine = "^4.0.2"
46+
47+
[tool.poetry.group.test.dependencies]
48+
pytest = "^7.4.1"
49+
pytest-mock = "^3.11.1"
50+
mock = "^5.1.0"
51+
flaky = "^3.7.0"
52+
53+
[build-system]
54+
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
55+
build-backend = "poetry_dynamic_versioning.backend"
56+

setup.py

Lines changed: 0 additions & 112 deletions
This file was deleted.

source/ftrack_api/_version.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# These version placeholders will be replaced later during substitution.
2+
__version__ = "0.0.1.dev"

source/ftrack_api/cache.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,15 @@
1515
1616
'''
1717

18-
from future import standard_library
19-
standard_library.install_aliases()
2018
from builtins import str
2119
from six import string_types
2220
from builtins import object
23-
import collections
2421
from six.moves import collections_abc
2522
import functools
2623
import abc
2724
import copy
2825
import inspect
2926
import re
30-
import six
3127

3228
try:
3329
# Python 2.x

0 commit comments

Comments
 (0)