Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ src/fparser/_version.py
doc/build
doc/source/autogenerated
doc/source/doxygen
doc/source/autoapi
build
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ Modifications by (in alphabetical order):
* P. Vitt, University of Siegen, Germany
* A. Voysey, UK Met Office

04/06/2026 PR #507 for #506. Remove setuptools_scm_git dependency. Version
information is now always obtained using importlib.metadata.version.

04/06/2026 PR #509 for #505. Fix truncated syntax error reporting when files
have line breaks before the module or program.

Expand Down
2 changes: 1 addition & 1 deletion doc/doxygen.config
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "fparser"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 0.0.16
PROJECT_NUMBER = 0.2.3

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
11 changes: 5 additions & 6 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
import subprocess
import fparser

project = 'fparser'
copyright = '2017-2024, Science and Technology Facilities Council'
author = 'Andrew Porter, Rupert Ford, Balthasar Reuter, Joerg Henrichs and Pearu Peterson'

version = fparser._get_version()
release = fparser._get_version()
copyright = '2017-2026, Science and Technology Facilities Council'
author = (
'Andrew Porter, Rupert Ford, Balthasar Reuter, Joerg Henrichs, '
'Sergi Siso and Pearu Peterson'
)

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
2 changes: 1 addition & 1 deletion doc/source/developers_guide.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. Copyright (c) 2017-2023 Science and Technology Facilities Council.
.. Copyright (c) 2017-2026 Science and Technology Facilities Council.

All rights reserved.

Expand Down
2 changes: 1 addition & 1 deletion doc/source/fparser.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. -*- rest -*-

..
Copyright (c) 2017-2023 Science and Technology Facilities Council.
Copyright (c) 2017-2026 Science and Technology Facilities Council.

All rights reserved.

Expand Down
2 changes: 1 addition & 1 deletion doc/source/fparser2.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. Copyright (c) 2017-2024 Science and Technology Facilities Council.
.. Copyright (c) 2017-2026 Science and Technology Facilities Council.

All rights reserved.

Expand Down
2 changes: 1 addition & 1 deletion doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

Modified work Copyright (c) 2017-2022 Science and Technology Facilities
Modified work Copyright (c) 2017-2026 Science and Technology Facilities
Council.
Original work Copyright (c) 1999-2008 Pearu Peterson

Expand Down
2 changes: 1 addition & 1 deletion doc/source/introduction.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. Copyright (c) 2017-2019 Science and Technology Facilities Council.
.. Copyright (c) 2017-2026 Science and Technology Facilities Council.

All rights reserved.

Expand Down
2 changes: 1 addition & 1 deletion doc/source/license.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
License
=======

| Modified work Copyright (c) 2017-2021 Science and Technology Facilities Council
| Modified work Copyright (c) 2017-2026 Science and Technology Facilities Council
| Authors: **Andrew Porter** and **Rupert Ford**, STFC Daresbury Laboratory,
| **Balthasar Reuter**, ECMWF, and
| **Joerg Henrichs**, Bureau of Meteorology
Expand Down
9 changes: 4 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[build-system]
requires = [
"setuptools >= 61",
"setuptools_scm[toml] >= 6.2",
"setuptools_scm_git_archive",
Comment thread
arporter marked this conversation as resolved.
"setuptools >= 80",
"setuptools_scm[toml] >= 8",
"wheel >= 0.29.0",
]
build-backend = "setuptools.build_meta"
Expand All @@ -11,7 +10,8 @@ build-backend = "setuptools.build_meta"
name = "fparser"
authors = [{name = "Pearu Peterson"},
{name = "Rupert Ford"},
{name = "Andrew Porter", email = "andrew.porter@stfc.ac.uk"}]
{name = "Andrew Porter", email = "andrew.porter@stfc.ac.uk"},
{name = "Sergi Siso", email = "sergi.siso@stfc.ac.uk"}]
license = {text = "BSD-3-Clause"}
description = "Python implementation of a Fortran parser"
readme = "README.md"
Expand All @@ -33,7 +33,6 @@ classifiers = [
keywords = ["fortran", "parser"]
dynamic = ["version"]
requires-python = ">=3.6"
dependencies = ["setuptools_scm"]

[project.optional-dependencies]
doc = ["sphinx", "sphinxcontrib.bibtex", "autoapi", "sphinx-autoapi", "sphinx_rtd_theme"]
Expand Down
74 changes: 0 additions & 74 deletions setup.py

This file was deleted.

21 changes: 2 additions & 19 deletions src/fparser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,28 +65,11 @@
# First version by: Pearu Peterson <pearu@cens.ioc.ee>
# First created: Oct 2006

from importlib.metadata import PackageNotFoundError
from importlib import metadata

import logging
import codecs
from importlib.metadata import version


def _get_version():
"""
:returns: the version of this package.
:rtype: str
"""
try:
return metadata.version(__name__)
except PackageNotFoundError:
# Package is not installed.
from setuptools_scm import get_version
Comment thread
arporter marked this conversation as resolved.

return get_version(root="../..", relative_to=__file__)


__version__ = _get_version()
__version__ = version("fparser")

logging.getLogger(__name__).addHandler(logging.NullHandler())

Expand Down
9 changes: 3 additions & 6 deletions src/fparser/scripts/fparser2.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,12 @@

import logging
import sys
from optparse import OptionParser
import fparser
from fparser.scripts.script_options import set_fparser_options

logging.basicConfig()

try:
from iocbio.optparse_gui import OptionParser
except ImportError:
from optparse import OptionParser


def runner(_, options, args):
"""
Expand Down Expand Up @@ -116,7 +113,7 @@ def runner(_, options, args):

def main():
"""Check arguments before parsing code"""
parser = OptionParser()
parser = OptionParser(version=fparser.__version__)
set_fparser_options(parser)
options, args = parser.parse_args()
runner(parser, options, args)
Expand Down
21 changes: 0 additions & 21 deletions src/fparser/tests/test_fparser_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,6 @@
"""

import os
import fparser


def test_fparser_get_version(monkeypatch):
"""Test the _get_version() utility routine. It doesn't make sense to
actually check precisely which version it reports - just that it returns a
suitable string."""
ver1 = fparser._get_version()
assert isinstance(ver1, str)
assert "." in ver1

def _broken_version(_name):
"""Broken routine with which to patch the `version` method."""
raise fparser.PackageNotFoundError()

from importlib import metadata

monkeypatch.setattr(metadata, "version", _broken_version)
ver2 = fparser._get_version()
assert isinstance(ver2, str)
assert "." in ver2


def test_fparser_logging_handler(tmpdir, caplog):
Expand Down
4 changes: 2 additions & 2 deletions src/fparser/tests/test_issue8.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_reproduce_issue():
! 2, 3,..
! 3, 4,..
!
& ncore(nclass) ! ncore = \sum_l
& ncore(nclass) ! ncore = \\sum_l
Comment thread
arporter marked this conversation as resolved.
! Number of diffe
end
"""
Expand All @@ -93,7 +93,7 @@ def test_reproduce_issue():
! 2, 3,..
! 3, 4,..
!
! ncore = \sum_l
! ncore = \\sum_l
! Number of diffe
END SUBROUTINE gwinput_v2x
"""
Expand Down
Loading