File tree Expand file tree Collapse file tree 12 files changed +96
-22
lines changed
Expand file tree Collapse file tree 12 files changed +96
-22
lines changed Original file line number Diff line number Diff line change @@ -9,3 +9,6 @@ max_line_length = 80
99
1010[* .md ]
1111trim_trailing_whitespace = false
12+
13+ [* .{yaml,yml} ]
14+ indent_size = 2
Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ name: Python package
22
33on : [push, pull_request]
44
5+ env :
6+ DOCKER_BUILDKIT : ' 1'
7+
58jobs :
69 flake8 :
710 runs-on : ubuntu-latest
Original file line number Diff line number Diff line change 1+ name : Release
2+
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ tag :
7+ description : " Release Tag WITHOUT `v` Prefix (e.g. 6.0.0)"
8+ required : true
9+ dry-run :
10+ description : ' Dry run'
11+ required : false
12+ type : boolean
13+ default : true
14+
15+ jobs :
16+ publish :
17+ runs-on : ubuntu-22.04
18+ steps :
19+ - uses : actions/checkout@v3
20+
21+ - uses : actions/setup-python@v4
22+ with :
23+ python-version : ' 3.10'
24+
25+ - run : python setup.py sdist bdist_wheel
26+ env :
27+ SETUPTOOLS_SCM_PRETEND_VERSION_FOR_DOCKER : ${{ inputs.tag }}
28+
29+ - name : Publish to PyPI
30+ uses : pypa/gh-action-pypi-publish@release/v1
31+ if : ! inputs.dry-run
32+ with :
33+ password : ${{ secrets.PYPI_API_TOKEN }}
34+
35+ - name : Create GitHub release
36+ uses : ncipollo/release-action@v1
37+ if : ! inputs.dry-run
38+ with :
39+ artifacts : " dist/*"
40+ generateReleaseNotes : true
41+ draft : true
42+ commit : ${{ github.sha }}
43+ token : ${{ secrets.GITHUB_TOKEN }}
44+ tag : ${{ inputs.tag }}
Original file line number Diff line number Diff line change @@ -13,6 +13,10 @@ html/*
1313_build /
1414README.rst
1515
16+ # setuptools_scm
17+ _version.py
18+
1619env /
1720venv /
1821.idea /
22+ * .iml
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ ARG PYTHON_VERSION=3.10
22
33FROM python:${PYTHON_VERSION}
44
5- RUN mkdir /src
65WORKDIR /src
76
87COPY requirements.txt /src/requirements.txt
@@ -11,5 +10,6 @@ RUN pip install --no-cache-dir -r requirements.txt
1110COPY test-requirements.txt /src/test-requirements.txt
1211RUN pip install --no-cache-dir -r test-requirements.txt
1312
14- COPY . /src
13+ COPY . .
14+ ARG SETUPTOOLS_SCM_PRETEND_VERSION_DOCKER
1515RUN pip install --no-cache-dir .
Original file line number Diff line number Diff line change 44from .context import Context
55from .context import ContextAPI
66from .tls import TLSConfig
7- from .version import version , version_info
7+ from .version import __version__
88
9- __version__ = version
109__title__ = 'docker'
Original file line number Diff line number Diff line change 11import sys
2- from .version import version
2+ from .version import __version__
33
44DEFAULT_DOCKER_API_VERSION = '1.41'
55MINIMUM_DOCKER_API_VERSION = '1.21'
2828IS_WINDOWS_PLATFORM = (sys .platform == 'win32' )
2929WINDOWS_LONGPATH_PREFIX = '\\ \\ ?\\ '
3030
31- DEFAULT_USER_AGENT = f"docker-sdk-python/{ version } "
31+ DEFAULT_USER_AGENT = f"docker-sdk-python/{ __version__ } "
3232DEFAULT_NUM_POOLS = 25
3333
3434# The OpenSSH server default value for MaxSessions is 10 which means we can
Original file line number Diff line number Diff line change 1- version = "6.0.0-dev"
2- version_info = tuple (int (d ) for d in version .split ("-" )[0 ].split ("." ))
1+ try :
2+ from ._version import __version__
3+ except ImportError :
4+ try :
5+ # importlib.metadata available in Python 3.8+, the fallback (0.0.0)
6+ # is fine because release builds use _version (above) rather than
7+ # this code path, so it only impacts developing w/ 3.7
8+ from importlib .metadata import version , PackageNotFoundError
9+ try :
10+ __version__ = version ('docker' )
11+ except PackageNotFoundError :
12+ __version__ = '0.0.0'
13+ except ImportError :
14+ __version__ = '0.0.0'
Original file line number Diff line number Diff line change 6363# |version| and |release|, also used in various other places throughout the
6464# built documents.
6565#
66- with open ('../docker/version.py' ) as vfile :
67- exec (vfile .read ())
68- # The full version, including alpha/beta/rc tags.
69- release = version
70- # The short X.Y version.
71- version = f'{ version_info [0 ]} .{ version_info [1 ]} '
66+ # see https://github.com/pypa/setuptools_scm#usage-from-sphinx
67+ from importlib .metadata import version
68+ release = version ('docker' )
69+ # for example take major/minor
70+ version = '.' .join (release .split ('.' )[:2 ])
7271
7372# The language for content autogenerated by Sphinx. Refer to documentation
7473# for a list of supported languages.
Original file line number Diff line number Diff line change 1+ [build-system ]
2+ requires = [" setuptools>=45" , " setuptools_scm[toml]>=6.2" ]
3+
4+ [tool .setuptools_scm ]
5+ write_to = ' docker/_version.py'
You can’t perform that action at this time.
0 commit comments