Skip to content

Commit 0a5d9f3

Browse files
authored
formatter: Add inline python requirements ala PEP 722 (#180)
You can now run the formatter with uv or pipx directly as: `uv run autoformat.py` Python dependencies will be installed automatically.
1 parent ced2cd4 commit 0a5d9f3

File tree

3 files changed

+17
-28
lines changed

3 files changed

+17
-28
lines changed

.github/workflows/gfortran.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@ jobs:
3434
with:
3535
python-version: '3.11'
3636

37-
- name: Install fprettify dependencies
38-
run: pip install configargparse
37+
- name: Set up uv
38+
# Install a specific uv version using the installer
39+
run: curl -LsSf https://astral.sh/uv/0.3.0/install.sh | sh
3940

40-
- name: Run fprettify
41+
- name: Run formatter (using uv)
42+
# uv ensures automatically that python dependencies are installed
4143
run: |
42-
./autoformat.py
43-
f=`git ls-files -m`; if [[ -n $f ]];then echo -e "ERROR: Detected unformatted files:\n$f";exit 1;fi
44+
uv run autoformat.py
45+
f=`git ls-files -m`; if [[ -n $f ]]; then echo -e "ERROR: Detected unformatted files:\n$f"; exit 1; fi
4446
4547
basic_build:
4648
name: Basic build

autoformat.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
#!/usr/bin/env python3
2-
# -*- coding: utf-8 -*-
3-
###############################################################################
2+
3+
4+
# /// script
5+
# requires-python = ">=3.6"
6+
# dependencies = [
7+
# "configargparse",
8+
# ]
9+
# ///
10+
#############################################################################
411
# This file is part of fprettify.
512
# Copyright (C) 2016-2019 Patrick Seewald, CP2K developers group
613
#

src/h2o_cvrqd.f

+1-21
Original file line numberDiff line numberDiff line change
@@ -1389,27 +1389,7 @@ SUBROUTINE cvps(V,rij1,rij2,rij3)
13891389
data ifirst/0/
13901390
if(ifirst.eq.0)then
13911391
ifirst=1
1392-
c write(6,1)
1393-
1 format(/1x,'pes for h2o',
1394-
$ /1x,'by Harry Partridge and David W. Schwenke',
1395-
$ /1x,'submitted to J. Chem. Phys. Nov. 8, 1996')
1396-
c write(6,56)
1397-
56 format(/1x,'parameters before adjustment')
1398-
c write(6,55)phh1,phh2,deoh,alphaoh,roh
1399-
55 format(/1x,'two body potential parameters:',
1400-
$ /1x,'hh: phh1 = ',f10.1,' phh2 = ',f5.2,
1401-
$ /1x,'oh: deoh = ',f10.1,' alpha = ',f7.4,
1402-
$ ' re = ',f7.4)
1403-
c write(6,4)reoh,thetae,b1
1404-
4 format(/1x,'three body parameters:',
1405-
$ /1x,'reoh = ',f10.4,' thetae = ',f10.4,
1406-
$ /1x,'betaoh = ',f10.4,
1407-
$ /1x,' i j k',7x,'c5z',9x,'cbasis',10x,'ccore',
1408-
$ 10x,'crest')
1409-
do 2 i=1,245
1410-
c write(6,5)(idx(i,j)-1,j=1,3),c5z(i),cbasis(i),ccore(i),crest(i)
1411-
c 5 format(1x,3i5,1p4e15.7)
1412-
2 continue
1392+
1 format(/1x,'CVRQD PES for H2O molecule')
14131393
c
14141394
c remove mass correction from vrest
14151395
c

0 commit comments

Comments
 (0)