Skip to content

Commit

Permalink
Add aiida-core==2.X and Python 3.8-3.11 support
Browse files Browse the repository at this point in the history
Some small changes here and there to fully switch to `aiida-core==2.X`:

1. Added `core.` prefix where needed.
2. Removal of superfluous `dict` keyword argument.

The package metadata is now also all moved to `pyproject.toml`, and support is
extended to Python v3.8-3.11.

Other changes mainly involve switching to `black`, using `isort` and updating
`pylint` to a more recent version.
  • Loading branch information
mpougin authored Aug 26, 2023
1 parent c58290a commit f2f2253
Show file tree
Hide file tree
Showing 22 changed files with 552 additions and 685 deletions.
34 changes: 0 additions & 34 deletions .github/check_version.py

This file was deleted.

72 changes: 12 additions & 60 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,14 @@ on: [push, pull_request]

jobs:

#compile:
# runs-on: ubuntu-latest
# timeout-minutes: 30
# steps:
# - uses: actions/checkout@v1
# - name: Get network binary from cache (or start caching)
# id: zeopp-cache
# uses: actions/cache@v1
# with:
# path: ./zeoplusplus/bin
# key: zeopp
# - name: Install Zeo++
# if: steps.zeopp-cache.outputs.cache-hit != 'true'
# run: |
# git clone https://github.com/lsmo-epfl/zeopp-lsmo -b master zeoplusplus
# cd zeoplusplus
# wget https://gitlab.com/libeigen/eigen/-/archive/3.2.7/eigen-3.2.7.tar.bz2
# tar xf eigen-3.2.7.tar.bz2
# cd voro++/src
# make
# cd ../..
# make
# mkdir bin
# cp network bin

tests:
strategy:
matrix:
python: ['3.8', '3.9', '3.10', '3.11']
runs-on: ubuntu-latest
timeout-minutes: 15
continue-on-error: true

strategy:
matrix:
python-version: [3.8]
aiida-version: ['stable', 'develop']

services:
postgres:
image: postgres:12
Expand Down Expand Up @@ -68,53 +41,32 @@ jobs:
ls /usr/share/miniconda/bin
echo /usr/share/miniconda/bin >> $GITHUB_PATH
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Install aiida develop version
run: |
pip install git+git://github.com/aiidateam/aiida-core
if: ${{ matrix.aiida-version == 'develop' }}
python-version: ${{ matrix.python }}

- name: Install python dependencies
run: |
pip install -e .[testing]
- name: Populate reentry cache
run: |
reentry scan -r aiida
if: ${{ matrix.aiida-version == 'stable' }}
pip install -e .[tests]
- name: Run pytest
run: |
pytest --cov-report=xml --cov=./aiida_zeopp
- name: Upload coverage to codecov
uses: codecov/codecov-action@v1
with:
token: ${{secrets.CODECOV_TOKEN}}
file: ./coverage.xml
continue-on-error: ${{ matrix.aiida-version == 'develop' }} # allow failures against develop

pytest
pre-commit:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
python-version: '3.10'
- name: Install python dependencies
run: |
pip install --upgrade pip
pip install -e .[pre-commit,testing]
reentry scan -r aiida
pip install -e .[pre-commit,tests]
- name: Run pre-commit
run: |
pre-commit install
Expand Down
30 changes: 10 additions & 20 deletions .github/workflows/publish-on-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,22 @@ on:
jobs:
publish:
runs-on: ubuntu-latest
if: github.repository == 'ltalirz/aiida-zeopp' && startsWith(github.ref, 'refs/tags/v')
if: github.repository == 'lsmo-epfl/aiida-zeopp' && startsWith(github.ref, 'refs/tags/v')

steps:
- name: Checkout repository
uses: actions/checkout@v2

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

- name: Upgrade setuptools and install package
run: |
python -m pip install --upgrade pip setuptools
python -m pip install -e .
- name: Install flit
run: pip install flit~=3.4

- name: Assert package version
- name: Build and publish
run: flit publish
env:
TAG_VERSION: ${{ github.ref }}
run: python ./.github/check_version.py

- name: Build source distribution
run: python ./setup.py sdist

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_token }}
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.pypi_token }}
64 changes: 27 additions & 37 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,44 +1,34 @@
# # Install pre-commit hooks via
# pre-commit install

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
hooks:
- id: trailing-whitespace
types: [python]
- id: double-quote-string-fixer
types: [python]
repos:

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)

- repo: https://github.com/pre-commit/mirrors-yapf
rev: v0.30.0
hooks:
# yapf = yet another python formatter
- id: yapf
name: yapf
types: [python]
exclude: >
(?x)^(
docs/.*|
)$
args: ['-i']
- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
# It is recommended to specify the latest version of Python
# supported by your project here, or alternatively use
# pre-commit's default_language_version, see
# https://pre-commit.com/#top_level-default_language_version
language_version: python3.10

- repo: local
hooks:
- repo: local
hooks:

# prospector: collection of linters
- id: pylint
name: pylint
entry: pylint
types: [python]
language: system
exclude: &exclude_files >
(?x)^(
.*/test_.*.py
)$

- id: version-number
name: Check version numbers
entry: python ./.github/check_version.py
language: system
files: '^(setup.json)|(aiida_zeopp/__init__.py)'
# prospector: collection of linters
- id: pylint
name: pylint
entry: pylint
types: [python]
language: system
exclude: &exclude_files >
(?x)^(
.*/test_.*.py
)$
7 changes: 4 additions & 3 deletions aiida_zeopp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
"""

__version__ = '1.1.2'
__version__ = "1.1.2"

# disable psycopg2 warning
import warnings
warnings.filterwarnings('ignore', category=UserWarning, module='psycopg2')
warnings.filterwarnings('ignore', category=UserWarning, module='pymatgen')

warnings.filterwarnings("ignore", category=UserWarning, module="psycopg2")
warnings.filterwarnings("ignore", category=UserWarning, module="pymatgen")
Loading

0 comments on commit f2f2253

Please sign in to comment.