Commit 12adb64b authored by Duggan, John's avatar Duggan, John
Browse files

Update template

parent 8a05e3ac
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
# Please do not edit or delete this file. It is needed to be able to update project from template.
_commit: '0.39'
_commit: '0.44'
_src_path: https://code.ornl.gov/ndip/project-templates/nova-application-template.git
application_type: Nova Application
framework: Trame
@@ -7,4 +7,3 @@ multitabs: true
project_name: IPS Fastran GUI
python_package: ips-fastran-gui
tool_category: fusion
use_mantid: false
+8 −9
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ before_script:
  - docker login -u $NDIP_DOCKER_USER -p $NDIP_DOCKER_PASSWORD $NDIP_DOCKER_REPOSITORY
  - export VERSION=$(cat pyproject.toml | grep "version =" | head -n 1 | awk '{ print $3 }' | tr -d '"')


after_script:
  - curl https://code.ornl.gov/rse-deployment/rse-sharables/raw/master/rse-bash-modules.sh -O
  - source rse-bash-modules.sh
@@ -35,9 +34,9 @@ lint-check:
  stage: lint
  script:
    - docker build -f dockerfiles/Dockerfile --target source -t image .
    - docker run -u `id -u`:`id -g` image poetry run ruff check
    - docker run -u `id -u`:`id -g` image poetry run ruff format --check
    - docker run -u `id -u`:`id -g` image poetry run mypy .
    - docker run -u `id -u`:`id -g` image ruff check
    - docker run -u `id -u`:`id -g` image ruff format --check
    - docker run -u `id -u`:`id -g` image mypy .
    - docker tag image ${IMAGE_NAME}:src-${CI_COMMIT_SHA}
    - docker push ${IMAGE_NAME}:src-${CI_COMMIT_SHA}
  tags:
@@ -48,9 +47,9 @@ unit-tests:
  stage: test
  script:
    - mkdir reports
    - docker run -u `id -u`:`id -g` -v `pwd`/reports:/src/reports ${IMAGE_NAME}:src-${CI_COMMIT_SHA} poetry run coverage run
    - docker run -u `id -u`:`id -g` -v `pwd`/reports:/src/reports ${IMAGE_NAME}:src-${CI_COMMIT_SHA} poetry run coverage report
    - docker run -u `id -u`:`id -g` -v `pwd`/reports:/src/reports ${IMAGE_NAME}:src-${CI_COMMIT_SHA} poetry run coverage xml -o reports/coverage.xml
    - docker run -u `id -u`:`id -g` -v `pwd`/reports:/src/reports ${IMAGE_NAME}:src-${CI_COMMIT_SHA} coverage run
    - docker run -u `id -u`:`id -g` -v `pwd`/reports:/src/reports ${IMAGE_NAME}:src-${CI_COMMIT_SHA} coverage report
    - docker run -u `id -u`:`id -g` -v `pwd`/reports:/src/reports ${IMAGE_NAME}:src-${CI_COMMIT_SHA} coverage xml -o reports/coverage.xml
    - sed -i "s:<source>/src:<source>${CI_BUILDS_DIR}/${CI_PROJECT_PATH}:" reports/coverage.xml

  coverage: '/TOTAL.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
@@ -147,8 +146,8 @@ package-build:
      -u `id -u`:`id -g`
      ${IMAGE_NAME}:src-${CI_COMMIT_SHA}
      bash -c "
      poetry config repositories.gitlab_repo ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi &&
      poetry publish -u gitlab-ci-token -p ${CI_JOB_TOKEN} -r gitlab_repo
      pixi run hatch build &&
      pixi run hatch publish -r ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi -u gitlab-ci-token -p ${CI_JOB_TOKEN} -r gitlab_repo
      "
  when: manual
  tags:
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ repos:
  hooks:
    - id: mypy
      name: mypy
      entry: poetry run mypy .
      entry: pixi run mypy .
      language: system
      types: [python]
      verbose: true
+11 −13
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ the IPS Fastran GUI project.

## Starting from the template

- Add other Python dependencies you project need with `poetry add xxx` or `poetry add --dev xxx`
- Add other Python dependencies you project need with [`pixi add`](https://pixi.sh/dev/reference/cli/pixi/add/).
- Modify Dockerfile as needed. Please make sure it can still run as non-root (we use it in GitLab CI/CD and in general this
is a good practice).
- install pre-commit (if not already installed) - `pip install pre-commit`
@@ -21,20 +21,18 @@ to create an issue [in this repo](https://code.ornl.gov/ndip/project-templates/p


## Installation
Start by installing [Pixi](https://pixi.sh/latest/). Once done, run the following:

```commandline
pip install poetry
poetry install

pixi install
```

## Running
### From source
```bash
poetry run app
pixi run app
```


### Using Docker
```bash
# build from source
@@ -47,23 +45,23 @@ Your application will now be running at http://localhost:8081/app.

## Formatting
```commandline
poetry run ruff format
pixi run ruff format
```

## Linting
```commandline
poetry run ruff check
poetry run mypy .
pixi run ruff check
pixi run mypy .
```

## Testing
```commandline
poetry run pytest
pixi run pytest
```
or, with coverage
```commandline
poetry run coverage run
poetry run coverage report
pixi run coverage run
pixi run coverage report
```

## Updating project from template
@@ -72,7 +70,7 @@ This project was created from a [template](https://code.ornl.gov/ndip/project-te
can try to update the project to incorporate these changes. Just enter the project folder, make sure `git status`
shows it clean, and run:
```
poetry run copier update
copier update
```
See [here](https://copier.readthedocs.io/en/stable/updating/#updating-a-project) for more information.

+2 −2
Original line number Diff line number Diff line
SPHINX_APIDOC_OPTIONS=members,show-inheritance poetry run sphinx-apidoc -o docs/source src
poetry run sphinx-build -M html docs docs/_build
SPHINX_APIDOC_OPTIONS=members,show-inheritance sphinx-apidoc -o docs/source src
sphinx-build -M html docs docs/_build
Loading