Skip to content

Commit

Permalink
Adapting new entry points structure (#88)
Browse files Browse the repository at this point in the history
* New src/nomad_simulations/schema_packages structure

* Fix imports in src and tests modules

* Fixed pyproject toml

* Fixed pipeline

* Deleted nomad.yaml

* Fix and improve README

* Deleted unused files

* Added config parameters into the pydantic entry point model

* Added python action for publishing in pypi on release
  • Loading branch information
JosePizarro3 authored Jun 25, 2024
1 parent 00483ec commit dbdca1f
Show file tree
Hide file tree
Showing 48 changed files with 758 additions and 647 deletions.
73 changes: 0 additions & 73 deletions .github/workflows/actions.yaml

This file was deleted.

74 changes: 74 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: install-and-test
on: [push]

# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
# `contents` is for permission to the contents of the repository.
# `pull-requests` is for permission to pull request
permissions:
contents: write
checks: write
pull-requests: write

jobs:
install-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: |
pip install --upgrade pip
pip install uv
uv pip install -e '.[dev]' --index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple --system
uv pip install coveralls --system
- name: mypy
run: |
python -m mypy --ignore-missing-imports --follow-imports=silent --no-strict-optional src/nomad_simulations/schema_packages tests
- name: Build coverage file
run: |
pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=src tests | tee pytest-coverage.txt
- name: Pytest coverage comment
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: pytest-coverage.txt
junitxml-path: pytest.xml
- name: Submit to coveralls
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
coveralls --service=github
build-and-install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Build the package
run: |
pip install uv
uv pip install --upgrade pip --system
uv pip install build --system
python -m build --sdist
- name: Install the package
run: |
uv pip install dist/*.tar.gz --index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple --system
ruff-linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
with:
args: "check ."
ruff-formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
with:
args: "format . --check --verbose"
26 changes: 11 additions & 15 deletions .github/workflows/mkdocs-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: deploy-mkdocs
name: Deploy MkDocs Site

on:
push:
branches:
- develop # Triggers deployment on push to the main branch
- main # Triggers deployment on push to the main branch

permissions:
contents: write

jobs:
deploy:
Expand All @@ -13,16 +16,9 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install mkdocs mkdocs-material==8.1.1 pymdown-extensions mkdocs-click
- name: Build and Deploy
run: |
mkdocs gh-deploy --config-file ../nomad-simulations/mkdocs.yml --force --remote-branch gh-pages
- name: Deploy docs
uses: mhausenblas/mkdocs-deploy-gh-pages@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CONFIG_FILE: mkdocs.yml
REQUIREMENTS: requirements_docs.txt
105 changes: 32 additions & 73 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,84 +1,43 @@
# Upload python package to pypi server and github release.
# Reference: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

name: Upload Python Package
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Build and Publish Python Package

on:
release:
types: [published]

permissions:
contents: read

jobs:
# publish-to-pypi:
# name: >-
# Publish distribution to PyPI
# runs-on: ubuntu-latest
# environment:
# name: pypi
# url: https://pypi.org/p/nomad-simulations
# permissions:
# id-token: write # IMPORTANT: mandatory for trusted publishing
#
# steps:
# - uses: actions/checkout@v4
# - name: Set up Python
# uses: actions/setup-python@v4
# with:
# python-version: "3.9"
# - name: Install pypa/build
# run: >-
# python3 -m
# pip install
# build
# --user
# - name: Build a binary wheel and a source tarball
# run: python3 -m build
# - name: Publish distribution to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
deploy:

github-release:
name: >-
Sign the Python distribution with Sigstore
and upload them to GitHub Release
runs-on: ubuntu-latest
permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'
- uses: actions/checkout@v3

- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: '3.9'

- name: Install dependencies
run: |
pip install --upgrade pip
pip install build
- name: Build package
run: python -m build

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
15 changes: 0 additions & 15 deletions Dockerfile

This file was deleted.

1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

Loading

3 comments on commit dbdca1f

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/nomad_simulations/schema_packages
   __init__.py14286%53–55
   atoms_state.py1902189%32–34, 220–223, 247, 302–303, 371–372, 374, 556, 568–569, 630–634, 649–653, 660
   general.py75791%30–31, 99, 163, 273–274, 284
   model_method.py2607770%29–31, 158–161, 164–171, 262–263, 283, 304–323, 339–365, 368–385, 737, 748, 790–797, 843, 862, 942, 1001, 1074, 1186
   model_system.py2612292%45–47, 514–517, 565–572, 746–747, 969–973, 979–980, 988–989, 994, 1017
   numerical_settings.py2636575%32–34, 166, 236, 238–239, 242–245, 249–250, 257–260, 269–272, 276–279, 281–284, 289–292, 298–301, 472–499, 574, 609–612, 636, 639, 684, 686–689, 693, 697, 744, 748–769, 824–825, 892, 901–903, 906
   outputs.py91891%26–27, 204–207, 247–250, 275, 277
   physical_property.py94496%38–40, 219
   variables.py641183%27–29, 115, 138, 158–159, 162, 184, 207, 227
src/nomad_simulations/schema_packages/properties
   band_gap.py51590%27–29, 154–155
   band_structure.py1112280%28–30, 250–283, 296, 303, 339–340, 343
   energies.py26581%26–28, 58, 86
   fermi_surface.py17476%26–28, 59
   hopping_matrix.py29583%26–28, 76, 111
   permittivity.py48883%26–28, 116–124
   spectral_profile.py25612452%28–30, 76–79, 114–117, 218–319, 375–387, 412–415, 435, 440–443, 485–521, 545, 592–595, 611–612, 617–623
src/nomad_simulations/schema_packages/utils
   utils.py661183%75–84, 93–94, 99, 102
TOTAL192440179% 

Tests Skipped Failures Errors Time
299 0 💤 0 ❌ 0 🔥 2.278s ⏱️

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/nomad_simulations/schema_packages
   __init__.py14286%53–55
   atoms_state.py1902189%32–34, 220–223, 247, 302–303, 371–372, 374, 556, 568–569, 630–634, 649–653, 660
   general.py75791%30–31, 99, 163, 273–274, 284
   model_method.py2607770%29–31, 158–161, 164–171, 262–263, 283, 304–323, 339–365, 368–385, 737, 748, 790–797, 843, 862, 942, 1001, 1074, 1186
   model_system.py2612292%45–47, 514–517, 565–572, 746–747, 969–973, 979–980, 988–989, 994, 1017
   numerical_settings.py2636575%32–34, 166, 236, 238–239, 242–245, 249–250, 257–260, 269–272, 276–279, 281–284, 289–292, 298–301, 472–499, 574, 609–612, 636, 639, 684, 686–689, 693, 697, 744, 748–769, 824–825, 892, 901–903, 906
   outputs.py91891%26–27, 204–207, 247–250, 275, 277
   physical_property.py94496%38–40, 219
   variables.py641183%27–29, 115, 138, 158–159, 162, 184, 207, 227
src/nomad_simulations/schema_packages/properties
   band_gap.py51590%27–29, 154–155
   band_structure.py1112280%28–30, 250–283, 296, 303, 339–340, 343
   energies.py26581%26–28, 58, 86
   fermi_surface.py17476%26–28, 59
   hopping_matrix.py29583%26–28, 76, 111
   permittivity.py48883%26–28, 116–124
   spectral_profile.py25612452%28–30, 76–79, 114–117, 218–319, 375–387, 412–415, 435, 440–443, 485–521, 545, 592–595, 611–612, 617–623
src/nomad_simulations/schema_packages/utils
   utils.py661183%75–84, 93–94, 99, 102
TOTAL192440179% 

Tests Skipped Failures Errors Time
299 0 💤 0 ❌ 0 🔥 2.367s ⏱️

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/nomad_simulations/schema_packages
   __init__.py14286%53–55
   atoms_state.py1902189%32–34, 220–223, 247, 302–303, 371–372, 374, 556, 568–569, 630–634, 649–653, 660
   general.py75791%30–31, 99, 163, 273–274, 284
   model_method.py2607770%29–31, 158–161, 164–171, 262–263, 283, 304–323, 339–365, 368–385, 737, 748, 790–797, 843, 862, 942, 1001, 1074, 1186
   model_system.py2612292%45–47, 514–517, 565–572, 746–747, 969–973, 979–980, 988–989, 994, 1017
   numerical_settings.py2636575%32–34, 166, 236, 238–239, 242–245, 249–250, 257–260, 269–272, 276–279, 281–284, 289–292, 298–301, 472–499, 574, 609–612, 636, 639, 684, 686–689, 693, 697, 744, 748–769, 824–825, 892, 901–903, 906
   outputs.py91891%26–27, 204–207, 247–250, 275, 277
   physical_property.py94496%38–40, 219
   variables.py641183%27–29, 115, 138, 158–159, 162, 184, 207, 227
src/nomad_simulations/schema_packages/properties
   band_gap.py51590%27–29, 154–155
   band_structure.py1112280%28–30, 250–283, 296, 303, 339–340, 343
   energies.py26581%26–28, 58, 86
   fermi_surface.py17476%26–28, 59
   hopping_matrix.py29583%26–28, 76, 111
   permittivity.py48883%26–28, 116–124
   spectral_profile.py25612452%28–30, 76–79, 114–117, 218–319, 375–387, 412–415, 435, 440–443, 485–521, 545, 592–595, 611–612, 617–623
src/nomad_simulations/schema_packages/utils
   utils.py661183%75–84, 93–94, 99, 102
TOTAL192440179% 

Tests Skipped Failures Errors Time
299 0 💤 0 ❌ 0 🔥 2.376s ⏱️

Please sign in to comment.