Skip to content

Commit

Permalink
work on
Browse files Browse the repository at this point in the history
  • Loading branch information
YevheniiSemendiak committed Sep 5, 2024
1 parent 73074a2 commit 8925422
Show file tree
Hide file tree
Showing 21 changed files with 145 additions and 158 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ jobs:
- name: Configure environment
run: |
neuro config login-with-token ${{ secrets.CLIENT_TEST_E2E_USER_NAME }} https://dev.neu.ro/api/v1
neuro --color=no config show
apolo config login-with-token ${{ secrets.CLIENT_TEST_E2E_USER_NAME }} https://dev.neu.ro/api/v1
apolo --color=no config show
- uses: webfactory/[email protected]
# Authenticates ssh on worker to pull repos under github.com/neuro-actions via ssh
Expand All @@ -58,6 +58,6 @@ jobs:
- name: Run tests
env:
NEURO_USER: ${{ secrets.CLIENT_TEST_E2E_USER_NAME }}
APOLO_USER: ${{ secrets.CLIENT_TEST_E2E_USER_NAME }}
run: |
make test
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.4.0'
rev: 'v4.6.0'
hooks:
- id: check-merge-conflict
- 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.3.0'
rev: '24.8.0'
hooks:
- id: black
language_version: python3 # Should be a command that runs python3.6+
args: ['--line-length', '88']
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.4.0'
rev: 'v4.6.0'
hooks:
- id: check-case-conflict
- id: check-yaml
Expand All @@ -32,17 +32,17 @@ repos:
- id: debug-statements
# 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.2'
rev: 'v3.17.0'
hooks:
- id: pyupgrade
args: ['--py36-plus']
- repo: https://github.com/PyCQA/flake8
rev: '6.0.0'
rev: '7.1.1'
hooks:
- id: flake8
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2019 Neuromation Ltd.
Copyright 2024 Apolo Cloud Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
LINTER_DIRS := tests
NEURO_COMMAND=neuro --verbose --show-traceback --color=no
APOLO_COMMAND=apolo --verbose --show-traceback --color=no
TMP_DIR := $(shell mktemp -d)
VERSION_FILE := version.txt

.PHONY: setup init
setup init:
pip install -r requirements/dev.txt
pipx install neuro-all
pipx install apolo-all
pre-commit install

.PHONY: get-version
Expand Down Expand Up @@ -36,8 +36,8 @@ test:

.PHONY: changelog-draft
changelog-draft: update-version $(VERSION_FILE)
towncrier --draft --name "Neuro Platform Flow Template" --version `cat version.txt`
towncrier --draft --name "Apolo Platform Flow Template" --version `cat version.txt`

.PHONY: changelog
changelog: update-version $(VERSION_FILE)
towncrier --name "Neuro Platform Flow Template" --version `cat version.txt` --yes
towncrier --name "Apolo Platform Flow Template" --version `cat version.txt` --yes
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Neu.ro Platform Project Template
Apolo Platform Flow Template
===============================

Base template for the [Neu.ro](https://neu.ro) platform projects based on [cookiecutter project](https://github.com/cookiecutter/cookiecutter).
Base template for the [apolo.us](https://apolo.us) platform projects based on [cookiecutter template](https://github.com/cookiecutter/cookiecutter).

Usage
-----
Expand Down
16 changes: 8 additions & 8 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Release instructions
====================

Neuro CLI [uses `release` branch](https://github.com/neuro-inc/platform-client-python/blob/d00a75504d665acdbcdda24f3999ee4b2223054d/neuromation/cli/project.py#L43-L48) to scaffold projects, so to do a release we need to update `release` branch.
Apolo CLI uses `release` branch to scaffold flow configuration and structure.


Instructions:
Expand All @@ -16,16 +16,16 @@ Instructions:
```
$ cookiecutter gh:neuro-inc/cookiecutter-neuro-project -c master
flow_name [My flow]:
flow_dir [neuro project]:
flow_id [neuro_project]:
flow_dir [my flow]:
flow_id [my_flow]:
code_directory [modules]:
preserve Neuro Flow template hints [yes]:
$ cd neuro project
preserve Apolo Flow template hints [yes]:
$ cd my project
$ ls
Dockerfile HELP.md README.md apt.txt config data modules notebooks requirements.txt results setup.cfg update_actions.py
$ neuro-flow build train
$ neuro-flow upload ALL
$ neuro-flow run jupyter
$ apolo-flow build train
$ apolo-flow upload ALL
$ apolo-flow run jupyter
...
```
3. Generate changelog:
Expand Down
2 changes: 1 addition & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"flow_dir": "{{ cookiecutter.flow_name.lower() }}",
"flow_id": "{{ cookiecutter.flow_name.lower().replace(' ', '_').replace('-', '_') }}",
"code_directory": "modules",
"preserve Neuro Flow template hints": "yes",
"preserve Apolo Flow template hints": "yes",
"_copy_without_render": [
".github/*"
]
Expand Down
11 changes: 6 additions & 5 deletions hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,27 @@
try:
import asyncio

import neuro_sdk
import apolo_sdk

async def get_project_name() -> str:
async with await neuro_sdk.get() as client:
async with await apolo_sdk.get() as client:
return client.config.project_name_or_raise

PROJECT_NAME = asyncio.run(get_project_name())

except Exception:
import subprocess

if shutil.which("neuro"):
if shutil.which("apolo"):
result = subprocess.run(
["neuro", "config", "show"], stdout=subprocess.PIPE, stderr=subprocess.PIPE
["apolo", "config", "show"], stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
if result.returncode == 0:
cli_output = result.stdout.decode().splitlines()
for line in cli_output:
if "current project" in line.lower():
PROJECT_NAME = line.split()[2]
break
if PROJECT_NAME:
proj_file = Path("./.neuro/project.yml")
content = proj_file.read_text()
Expand Down Expand Up @@ -58,7 +59,7 @@ async def get_project_name() -> str:
"false": False,
}
PRESERVE_HINTS_ANSWER = (
"{{ cookiecutter['preserve Neuro Flow template hints'] | lower }}"
"{{ cookiecutter['preserve Apolo Flow template hints'] | lower }}"
)
if PRESERVE_HINTS_ANSWER not in PRESERVE_HINTS_VARIANS:
print(
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cookiecutter==2.1.1
cookiecutter==2.6.0
2 changes: 1 addition & 1 deletion tests/unit/test_bake_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def test_flow_name(
if venv_install_packages:
venv.install_package(venv_install_packages, installer="pip")
venv.run(
"neuro config login-with-token $NEURO_USER https://dev.neu.ro/api/v1"
"neuro config login-with-token $APOLO_USER https://dev.neu.ro/api/v1"
)

venv.run(
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v23.07.10
v24.9.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Update apolo-flow action tags
on:
schedule:
- cron: 0 0 * * *
jobs:
auto-update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: pip install -U "PyGithub==1.55"
- id: run_updater
name: Run update actions script
run: python update_actions.py ".neuro/*.y*ml"
- id: generate_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.BOT_APP_ID }}
private_key: ${{ secrets.BOT_PRIVATE_KEY }}
- name: Create Pull Request
uses: peter-evans/[email protected]
with:
token: ${{ steps.generate_token.outputs.token }}
branch: update/actions-tags
title: Auto-update actions tags
commit-message: Auto-update apolo-flow actions tags
body: |
Updated apolo-flow action version tags in the following
files: ${{ steps.run_updater.outputs.updated_files }}

This file was deleted.

2 changes: 1 addition & 1 deletion {{cookiecutter.flow_dir}}/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Neuro Template:
# Apolo Flow Template:
/data/**/*

!/**/.gitkeep
Expand Down
Loading

0 comments on commit 8925422

Please sign in to comment.