Skip to content

Commit

Permalink
PRO-49: Bump apolo and other dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
YevheniiSemendiak committed Sep 5, 2024
1 parent cbc4d2c commit 84868a8
Show file tree
Hide file tree
Showing 16 changed files with 229 additions and 207 deletions.
224 changes: 112 additions & 112 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,42 +20,42 @@ jobs:
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout commit
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Cache Python and its deps
uses: actions/cache@v3
with:
key: ${{ runner.os }}-python-3.11-${{ hashFiles('requirements/*.txt') }}
path: ${{ env.pythonLocation }}

- name: Cache pre-commit hooks
uses: actions/cache@v2
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-python-3.11-${{ hashFiles('.pre-commit-config.yaml') }}

- name: Install dependencies
run: |
python -m pip install -U pip
make setup
- name: Run linters
run: |
echo Linting ${{ github.event.pull_request.head.sha || github.sha }}
make lint
- name: Save the package version
id: version
run: |
echo "version=$(python setup.py --version)" >> $GITHUB_OUTPUT
- name: Checkout commit
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Cache Python and its deps
uses: actions/cache@v3
with:
key: ${{ runner.os }}-python-3.11-${{ hashFiles('requirements/*.txt') }}
path: ${{ env.pythonLocation }}

- name: Cache pre-commit hooks
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-python-3.11-${{ hashFiles('.pre-commit-config.yaml') }}

- name: Install dependencies
run: |
python -m pip install -U pip
make setup
- name: Run linters
run: |
echo Linting ${{ github.event.pull_request.head.sha || github.sha }}
make lint
- name: Save the package version
id: version
run: |
echo "version=$(python setup.py --version)" >> $GITHUB_OUTPUT
test:
if: |
Expand All @@ -65,86 +65,86 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout commit
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Cache Python and its deps
uses: actions/cache@v3
with:
key: ${{ runner.os }}-python-3.11-${{ hashFiles('requirements/*.txt') }}
path: ${{ env.pythonLocation }}

- name: Cache pre-commit hooks
uses: actions/cache@v2
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-python-3.11-${{ hashFiles('.pre-commit-config.yaml') }}

- name: Install dependencies
run: |
python -m pip install -U pip
make setup
- name: Configure Neu.ro CLI
env:
NEURO_TOKEN: ${{ secrets.COOKIECUTTER_TEST_E2E_TOKEN }}
NEURO_STAGING_URL: ${{ secrets.NEURO_STAGING_URL }}
run: |
neuro config login-with-token ${{ env.NEURO_TOKEN }} ${{ env.NEURO_STAGING_URL }}
neuro config switch-cluster onprem-poc
- name: Run tests
env:
WANDB_API_KEY: ${{ secrets.WANDB_API_KEY }}
run: |
make test
- name: Checkout commit
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Cache Python and its deps
uses: actions/cache@v3
with:
key: ${{ runner.os }}-python-3.11-${{ hashFiles('requirements/*.txt') }}
path: ${{ env.pythonLocation }}

- name: Cache pre-commit hooks
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-python-3.11-${{ hashFiles('.pre-commit-config.yaml') }}

- name: Install dependencies
run: |
python -m pip install -U pip
make setup
- name: Configure Neu.ro CLI
env:
NEURO_TOKEN: ${{ secrets.COOKIECUTTER_TEST_E2E_TOKEN }}
NEURO_STAGING_URL: ${{ secrets.NEURO_STAGING_URL }}
run: |
apolo config login-with-token ${{ env.NEURO_TOKEN }} ${{ env.NEURO_STAGING_URL }}
apolo config switch-cluster onprem-poc
- name: Run tests
env:
WANDB_API_KEY: ${{ secrets.WANDB_API_KEY }}
run: |
make test
deploy:
name: Build and push Docker image
needs: [lint, test]
runs-on: ubuntu-latest
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- name: Checkout commit
uses: actions/checkout@v3

- name: Sanity check for tag and version
run: |
export VERSION=${{ needs.lint.outputs.version }}
if [ "${{ github.ref }}" != "refs/tags/v$VERSION" ]
then
echo "Git tag '${{ github.ref }}' differs from hard-coded package version 'v$VERSION'"
exit 1
else
echo "OK, git tag matches hard-coded package version: 'v$VERSION'"
fi
- name: Login to Github container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build
env:
VERSION: ${{ needs.lint.outputs.version }}
COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
run: |
docker build \
-t "ghcr.io/neuro-inc/wabucketref:${VERSION}" \
-t "ghcr.io/neuro-inc/wabucketref:latest" \
--build-arg COMMIT_SHA=${COMMIT_SHA} \
.
- name: Push
env:
VERSION: ${{ needs.lint.outputs.version }}
run: |
docker push ghcr.io/neuro-inc/wabucketref --all-tags
- name: Checkout commit
uses: actions/checkout@v3

- name: Sanity check for tag and version
run: |
export VERSION=${{ needs.lint.outputs.version }}
if [ "${{ github.ref }}" != "refs/tags/v$VERSION" ]
then
echo "Git tag '${{ github.ref }}' differs from hard-coded package version 'v$VERSION'"
exit 1
else
echo "OK, git tag matches hard-coded package version: 'v$VERSION'"
fi
- name: Login to Github container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build
env:
VERSION: ${{ needs.lint.outputs.version }}
COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
run: |
docker build \
-t "ghcr.io/neuro-inc/wabucketref:${VERSION}" \
-t "ghcr.io/neuro-inc/wabucketref:latest" \
--build-arg COMMIT_SHA=${COMMIT_SHA} \
.
- name: Push
env:
VERSION: ${{ needs.lint.outputs.version }}
run: |
docker push ghcr.io/neuro-inc/wabucketref --all-tags
20 changes: 10 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.4.0'
rev: 'v4.6.0'
hooks:
- id: check-merge-conflict
exclude: "rst$"
- repo: https://github.com/asottile/yesqa
rev: v1.4.0
rev: v1.5.0
hooks:
- id: yesqa
- repo: https://github.com/PyCQA/isort
rev: '5.12.0'
rev: '5.13.2'
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: '23.1.0'
rev: '24.8.0'
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.4.0'
rev: 'v4.6.0'
hooks:
- id: check-case-conflict
- id: debug-statements
Expand All @@ -28,24 +28,24 @@ repos:
- id: check-symlinks
# Another entry is required to apply file-contents-sorter to another file
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.4.0'
rev: 'v4.6.0'
hooks:
- id: file-contents-sorter
files: |
.gitignore
- repo: https://github.com/asottile/pyupgrade
rev: 'v3.3.1'
rev: 'v3.17.0'
hooks:
- id: pyupgrade
args: ['--py37-plus']
- repo: https://github.com/pycqa/flake8
rev: '6.0.0'
rev: '7.1.1'
hooks:
- id: flake8
args:
- "--max-line-length=88"
- repo: https://github.com/rhysd/actionlint
rev: v1.6.23
rev: v1.7.1
hooks:
- id: actionlint-docker
args:
Expand All @@ -58,7 +58,7 @@ repos:
- -ignore
- 'SC2193:'
- repo: https://github.com/sirosen/check-jsonschema
rev: 0.21.0
rev: 0.29.2
hooks:
- id: check-github-actions
ci:
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.9.19
4 changes: 2 additions & 2 deletions CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ wabucket link [OPTIONS] BUCKET_PATH
| _-t, --type TEXT_ | W&B artifact type to assign \[required\] |
| _-a, --alias TEXT_ | W&B artifact alias to assign. If not set, the artifact alias will autogenerated in form of UUID \(default behaviour\). WaBucket could also use a SHA value computed of run's arguments if this option is set to `'!run-config-hash'`. This could be used to prevent artifacts overwrites. |
| _-m, --metadata KEY=VALUE_ | Metainfo, which will be pinned to the artifact after upload. |
| _-s, --suffix TEXT_ | Suffix to append to the output names `artifact\_type`, `artifact\_name` and `artifact\_alias`, which are read by the Neuro-Flow. This is usefull if you need to upload several artifacts from within a single job. |
| _-s, --suffix TEXT_ | Suffix to append to the output names `artifact\_type`, `artifact\_name` and `artifact\_alias`, which are read by the Apolo-Flow. This is usefull if you need to upload several artifacts from within a single job. |
| _--help_ | Show this message and exit. |

### wabucket upload
Expand All @@ -88,5 +88,5 @@ wabucket upload [OPTIONS] SRC_DIR
| _-a, --alias TEXT_ | W&B artifact alias to assign. If not set, the artifact alias will autogenerated in form of UUID \(default behaviour\). WaBucket could also use a SHA value computed of run's arguments if this option is set to `'!run-config-hash'`. This could be used to prevent artifacts overwrites. |
| _-m, --metadata KEY=VALUE_ | Metainfo, which will be pinned to the artifact after upload. |
| _--reff / --no-reff_ | Whether to upload artifact to bucket and use it as reference in W&B, or directly upload the folder to W&B servers. |
| _-s, --suffix TEXT_ | Suffix to append to the output names `artifact\_type`, `artifact\_name` and `artifact\_alias`, which are read by the Neuro-Flow. This is usefull if you need to upload several artifacts from within a single job. |
| _-s, --suffix TEXT_ | Suffix to append to the output names `artifact\_type`, `artifact\_name` and `artifact\_alias`, which are read by the Apolo-Flow. This is usefull if you need to upload several artifacts from within a single job. |
| _--help_ | Show this message and exit. |
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/neuro-inc/neuro-extras:23.7.0
FROM ghcr.io/neuro-inc/apolo-extras:24.8.0

LABEL org.opencontainers.image.source = "https://github.com/neuro-inc/mlops-wandb-bucket-ref"

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ format:
.PHONY: image
image:
git push
neuro-extras image build . image:wabucketref:$(CURRENT_COMMIT) --build-arg COMMIT_SHA=$(CURRENT_COMMIT)
apolo-extras image build . image:wabucketref:$(CURRENT_COMMIT) --build-arg COMMIT_SHA=$(CURRENT_COMMIT)

.PHONY: test
test:
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
requires = ["setuptools>=51", "wheel>=0.36"]
build-backend = "setuptools.build_meta"

[tool.towncrier]
package = "wabucketref"
package_dir = "."
Expand Down
3 changes: 1 addition & 2 deletions requirements/python-base.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
neuro-cli>=23.7.0
wandb[aws]>=0.10.33,<=0.15.5
-e .
10 changes: 5 additions & 5 deletions requirements/python-dev.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-r python-base.txt

mypy==1.1.1
pre-commit==3.1.1
pytest==7.2.2
pytest-asyncio==0.20.3
towncrier==22.12.0
mypy==1.11.2
pre-commit==3.8.0
pytest==8.3.2
pytest-asyncio==0.24.0
towncrier==24.8.0
Loading

0 comments on commit 84868a8

Please sign in to comment.