Skip to content

Commit fd73c84

Browse files
authored
CM-22829 - Migrate to Poetry; fix package structure; use dynamic versioning from Git Tags (#105)
1 parent a0ca07f commit fd73c84

File tree

84 files changed

+1019
-252
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+1019
-252
lines changed

.git_archival.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"hash-full": "$Format:%H$",
3+
"hash-short": "$Format:%h$",
4+
"timestamp": "$Format:%cI$",
5+
"refs": "$Format:%D$",
6+
"describe": "$Format:%(describe:tags=true,match=v[0-9]*)$"
7+
}

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.git_archival.json export-subst

.github/workflows/tests.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,22 @@ permissions:
77

88
jobs:
99
deploy:
10-
1110
runs-on: ubuntu-latest
1211

1312
steps:
14-
- uses: actions/checkout@v2
13+
- name: Checkout repository
14+
uses: actions/checkout@v2
15+
1516
- name: Set up Python
1617
uses: actions/setup-python@v2
1718
with:
18-
python-version: '3.x'
19+
python-version: '3.7'
20+
21+
- name: Setup Poetry
22+
run: curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python
23+
1924
- name: Install dependencies
20-
run: |
21-
python -m pip install --upgrade pip
22-
pip install -r requirements.txt
25+
run: poetry install
26+
2327
- name: Run Tests
24-
run: pytest
28+
run: poetry run pytest

Dockerfile

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
1-
FROM python:3.8.16-alpine3.17 as builder
1+
FROM python:3.8.16-alpine3.17 as base
22
WORKDIR /usr/cycode/app
3-
COPY . ./
4-
RUN python -m pip install --upgrade --no-cache-dir pip==22.0.4 setuptools==65.5.1 wheel==0.37.1
5-
RUN python3 setup.py sdist bdist_wheel
3+
RUN apk add git=2.38.5-r0
64

7-
FROM python:3.8.16-alpine3.17
8-
RUN apk add git=2.38.3-r1
9-
WORKDIR /usr/cycode/app
10-
COPY --from=builder usr/cycode/app/dist ./
5+
FROM base as builder
6+
ENV POETRY_VERSION=1.4.2
7+
8+
# deps are required to build cffi
9+
RUN apk add --no-cache --virtual .build-deps gcc=12.2.1_git20220924-r4 libffi-dev=3.4.4-r0 musl-dev=1.2.3-r4 && \
10+
pip install --no-cache-dir "poetry==$POETRY_VERSION" "poetry-dynamic-versioning[plugin]" && \
11+
apk del .build-deps gcc libffi-dev musl-dev
12+
13+
COPY pyproject.toml poetry.lock README.md ./
14+
# to be able to automatically detect version from Git Tag
15+
COPY .git ./.git
16+
# src
17+
COPY cycode ./cycode
18+
RUN poetry config virtualenvs.in-project true && \
19+
poetry --no-cache install --only=main --no-root && \
20+
poetry build
21+
22+
FROM base as final
23+
COPY --from=builder /usr/cycode/app/dist ./
1124
RUN pip install --no-cache-dir cycode*.whl
1225

1326
# Add cycode group and user, alpine way

VERSION.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

cli/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

cli/printers/__init__.py

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

cycode/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = '0.0.0' # placeholder. Will be filled automatically on poetry build from Git Tag
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)