Repository: MDAnalysis/panedr (language: python)

Issue:
LGPLv2.1 license does not work with Apache 2.0 dependency (pbr)
We'll need to change to something else


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/gh-ci.yaml b/.github/workflows/gh-ci.yaml
index 99c22ed..e39410a 100644
--- a/.github/workflows/gh-ci.yaml
+++ b/.github/workflows/gh-ci.yaml
@@ -16,7 +16,7 @@ concurrency:
 
 defaults:
   run:
-    shell: bash -l {0}
+    shell: bash
 
 jobs:
   unittests:
@@ -26,7 +26,7 @@ jobs:
       fail-fast: false
       matrix:
         os: [ubuntu-latest, ]
-        python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
+        python-version: ["3.9", "3.10", "3.11", "3.12"]
         include:
           - os: windows-latest
             python-version: "3.12"
@@ -34,34 +34,20 @@ jobs:
             python-version: "3.12"
 
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
 
-    - name: setup_miniconda
-      uses: conda-incubator/setup-miniconda@v2
+    - uses: actions/setup-python@v4
       with:
         python-version: ${{ matrix.python-version }}
-        auto-update-conda: true
-        channel-priority: flexible
-        channels: conda-forge
-        add-pip-as-python-dependency: true
-        use-mamba: true
-        miniforge-variant: Mambaforge
 
-    - name: install package deps
+    - name: install optional deps
       run: |
-        mamba install pytest pytest-xdist pytest-cov codecov pbr numpy tqdm
-
-    - name: check install
-      run: |
-        which python
-        which pip
-        conda info
-        conda list
+        pip install pytest pytest-xdist pytest-cov
 
     - name: install pyedr package
       run: |
-        # installing via pip leads to codecov not being able to report coverage
-        cd pyedr && python setup.py develop
+        cd pyedr && python -m pip install -e .
+        pip list
 
     - name: run pyedr tests
       run: |
@@ -69,8 +55,8 @@ jobs:
 
     - name: install panedr package
       run: |
-        mamba install pandas
-        cd panedr && python setup.py develop
+        pip install pandas
+        cd panedr && pip install -e .
 
     - name: run panedr tests
       run: |
diff --git a/panedr/panedr/__init__.py b/panedr/panedr/__init__.py
index 94df723..5f00bdb 100644
--- a/panedr/panedr/__init__.py
+++ b/panedr/panedr/__init__.py
@@ -1,8 +1,7 @@
 # -*- coding: utf-8 -*-
-import pbr.version
 from .panedr import ENX_VERSION, edr_to_df, get_unit_dictionary
-__version__ = pbr.version.VersionInfo('panedr').release_string()
-del pbr
+from importlib.metadata import version
+__version__ = version("panedr")
 
 # export `ENX_VERSION` for version checking in tests
 # this is not useful for normal use
diff --git a/panedr/pyproject.toml b/panedr/pyproject.toml
new file mode 100644
index 0000000..8a1b47e
--- /dev/null
+++ b/panedr/pyproject.toml
@@ -0,0 +1,61 @@
+[build-system]
+requires = [
+	"setuptools>=61.2",
+	"versioningit",
+]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "panedr"
+description = "Read Gromacs EDR files and expose them as pandas Dataframes"
+readme = {file = "README.rst", content-type = "text/x-rst"}
+authors = [{name = "Jonathan Barnoud", email = "jonathan@barnoud.net"}]
+maintainers = [{name = "The MDAnalysis developers", email = "mdanalysis@numfocus.org"}]
+license = {text = "LGPLv2+"}
+classifiers = [
+    "Development Status :: 4 - Beta",
+    "Intended Audience :: Developers",
+    "Topic :: Scientific/Engineering :: Bio-Informatics",
+    "Topic :: Scientific/Engineering :: Chemistry",
+    "Topic :: Scientific/Engineering :: Physics",
+    "License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)",
+    "Programming Language :: Python :: 3.9",
+    "Programming Language :: Python :: 3.10",
+    "Programming Language :: Python :: 3.11",
+    "Programming Language :: Python :: 3.12",
+    "Operating System :: OS Independent",
+]
+urls = {Homepage = "https://github.com/MDAnalysis/panedr"}
+requires-python = ">= 3.9"
+dependencies = [
+    "pyedr",
+    "pandas",
+]
+dynamic = ["version"]
+
+[project.optional-dependencies]
+test = [
+    "pytest",
+    "pytest-xdist",
+]
+
+
+[tool.setuptools]
+zip-safe = false
+include-package-data = true
+
+[tool.setuptools.packages]
+find = {namespaces = false}
+
+[tool.versioningit]
+default-version = "1+unknown"
+
+[tool.versioningit.format]
+distance = "{base_version}+{distance}.{vcs}{rev}"
+dirty = "{base_version}+{distance}.{vcs}{rev}.dirty"
+distance-dirty = "{base_version}+{distance}.{vcs}{rev}.dirty"
+
+[tool.versioningit.vcs]
+method = "git" 
+match = ["*"]
+default-tag = "0.0.0"
diff --git a/panedr/requirements.txt b/panedr/requirements.txt
index 098d244..ec28e6b 100644
--- a/panedr/requirements.txt
+++ b/panedr/requirements.txt
@@ -1,3 +1,2 @@
 pandas
 pyedr
-pbr
diff --git a/panedr/setup.cfg b/panedr/setup.cfg
deleted file mode 100644
index 9d468e5..0000000
--- a/panedr/setup.cfg
+++ /dev/null
@@ -1,41 +0,0 @@
-[metadata]
-name = panedr
-author = Jonathan Barnoud
-author_email = jonathan@barnoud.net
-summary = Read and manipulate Gromacs energy files to pandas Dataframes
-license = LGPLv2+
-license_file = LICENSE.txt
-description_file =
-    README.rst
-long_description_content_type = text/x-rst
-url = https://github.com/MDAnalysis/panedr
-classifier =
-    Development Status :: 4 - Beta
-    Intended Audience :: Developers
-    Topic :: Scientific/Engineering :: Bio-Informatics
-    Topic :: Scientific/Engineering :: Chemistry
-    Topic :: Scientific/Engineering :: Physics
-    License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)
-    Programming Language :: Python :: 3.6
-    Programming Language :: Python :: 3.7
-    Programming Language :: Python :: 3.8
-    Programming Language :: Python :: 3.9
-    Programming Language :: Python :: 3.10
-    Programming Language :: Python :: 3.11
-    Programming Language :: Python :: 3.12
-    Operating System :: OS Independent
-
-[options]
-python_requires = >= 3.6
-install_requires =
-    pyedr
-    pandas
-    pbr
-
-[options.extras_require]
-test =
-    pytest
-
-[pbr]
-skip_authors = True
-skip_changelog = True
diff --git a/panedr/setup.py b/panedr/setup.py
deleted file mode 100755
index 19d5894..0000000
--- a/panedr/setup.py
+++ /dev/null
@@ -1,7 +0,0 @@
-from setuptools import setup
-
-setup(name="panedr",
-      setup_requires=['pbr'],
-      pbr=True,
-      include_package_data=True,
-      )
diff --git a/pyedr/pyedr/__init__.py b/pyedr/pyedr/__init__.py
index 5b7f0b4..b1f38d6 100644
--- a/pyedr/pyedr/__init__.py
+++ b/pyedr/pyedr/__init__.py
@@ -1,8 +1,7 @@
 # -*- coding: utf-8 -*-
 from .pyedr import ENX_VERSION, edr_to_dict, read_edr, get_unit_dictionary
-import pbr.version
-__version__ = pbr.version.VersionInfo('pyedr').release_string()
-del pbr
+from importlib.metadata import version
+__version__ = version("pyedr")
 
 # export `ENX_VERSION` for version checking in tests
 # this is not useful for normal use
diff --git a/pyedr/pyproject.toml b/pyedr/pyproject.toml
new file mode 100644
index 0000000..893c68e
--- /dev/null
+++ b/pyedr/pyproject.toml
@@ -0,0 +1,62 @@
+[build-system]
+requires = [
+	"setuptools>=61.2",
+	"versioningit",
+]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "pyedr"
+description = "Read Gromacs EDR files."
+readme = {file = "README.rst", content-type = "text/x-rst"}
+authors = [{name = "Jonathan Barnoud", email = "jonathan@barnoud.net"}]
+maintainers = [{name = "The MDAnalysis developers", email = "mdanalysis@numfocus.org"}]
+license = {text = "LGPLv2+"}
+classifiers = [
+    "Development Status :: 4 - Beta",
+    "Intended Audience :: Developers",
+    "Topic :: Scientific/Engineering :: Bio-Informatics",
+    "Topic :: Scientific/Engineering :: Chemistry",
+    "Topic :: Scientific/Engineering :: Physics",
+    "License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)",
+    "Programming Language :: Python :: 3.9",
+    "Programming Language :: Python :: 3.10",
+    "Programming Language :: Python :: 3.11",
+    "Programming Language :: Python :: 3.12",
+    "Operating System :: OS Independent",
+]
+urls = {Homepage = "https://github.com/MDAnalysis/panedr"}
+requires-python = ">= 3.9"
+dependencies = [
+    "numpy",
+    "tqdm",
+    "mda-xdrlib",
+]
+dynamic = ["version"]
+
+[project.optional-dependencies]
+test = [
+    "pytest",
+    "pytest-xdist",
+]
+
+
+[tool.setuptools]
+zip-safe = false
+include-package-data = true
+
+[tool.setuptools.packages]
+find = {namespaces = false}
+
+[tool.versioningit]
+default-version = "1+unknown"
+
+[tool.versioningit.format]
+distance = "{base_version}+{distance}.{vcs}{rev}"
+dirty = "{base_version}+{distance}.{vcs}{rev}.dirty"
+distance-dirty = "{base_version}+{distance}.{vcs}{rev}.dirty"
+
+[tool.versioningit.vcs]
+method = "git" 
+match = ["*"]
+default-tag = "0.0.0"
diff --git a/pyedr/requirements.txt b/pyedr/requirements.txt
index 54c997e..f8b9410 100644
--- a/pyedr/requirements.txt
+++ b/pyedr/requirements.txt
@@ -1,4 +1,3 @@
 numpy>=1.19.0
-pbr
 tqdm
 mda-xdrlib
diff --git a/pyedr/setup.cfg b/pyedr/setup.cfg
deleted file mode 100644
index f0a6bfc..0000000
--- a/pyedr/setup.cfg
+++ /dev/null
@@ -1,42 +0,0 @@
-[metadata]
-name = pyedr
-author = Jonathan Barnoud
-author_email = jonathan@barnoud.net
-summary = Read and manipulate Gromacs energy files
-license = LGPLv2+
-license_file = LICENSE.txt
-description_file =
-    README.rst
-long_description_content_type = text/x-rst
-url = https://github.com/MDAnalysis/panedr
-classifier =
-    Development Status :: 4 - Beta
-    Intended Audience :: Developers
-    Topic :: Scientific/Engineering :: Bio-Informatics
-    Topic :: Scientific/Engineering :: Chemistry
-    Topic :: Scientific/Engineering :: Physics
-    License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)
-    Programming Language :: Python :: 3.6
-    Programming Language :: Python :: 3.7
-    Programming Language :: Python :: 3.8
-    Programming Language :: Python :: 3.9
-    Programming Language :: Python :: 3.10
-    Programming Language :: Python :: 3.11
-    Programming Language :: Python :: 3.12
-    Operating System :: OS Independent
-
-[options]
-python_requires = >= 3.6
-install_requires =
-    numpy
-    pbr
-    tqdm
-    mda-xdrlib
-
-[options.extras_require]
-test =
-    pytest
-
-[pbr]
-skip_authors = True
-skip_changelog = True
diff --git a/pyedr/setup.py b/pyedr/setup.py
deleted file mode 100755
index 5c4f28d..0000000
--- a/pyedr/setup.py
+++ /dev/null
@@ -1,6 +0,0 @@
-from setuptools import setup
-
-setup(name="pyedr",
-      setup_requires=['pbr'],
-      pbr=True,
-      include_package_data=True,)


Test patch:
diff --git a/pyedr/pyedr/tests/data/__init__.py b/pyedr/pyedr/tests/data/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/pyedr/pyedr/tests/data/__init__.py
@@ -0,0 +1,1 @@
+
diff --git a/pyedr/pyedr/tests/data/mocks/__init__.py b/pyedr/pyedr/tests/data/mocks/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/pyedr/pyedr/tests/data/mocks/__init__.py
@@ -0,0 +1,1 @@
+
diff --git a/pyedr/pyedr/tests/datafiles.py b/pyedr/pyedr/tests/datafiles.py
index 439009c..51adce8 100644
--- a/pyedr/pyedr/tests/datafiles.py
+++ b/pyedr/pyedr/tests/datafiles.py
@@ -17,77 +17,78 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor,
 # Boston, MA  02110-1301  USA
 
-# Move to impportlib.resources when py>=3.7
-from pkg_resources import resource_filename
+from importlib import resources
 
 from pathlib import Path
 
 
-EDR = resource_filename(__name__, 'data/cat_small.edr')
-EDR_XVG = resource_filename(__name__, 'data/cat_small.xvg')
-EDR_UNITS = resource_filename(__name__, 'data/cat_small_units.p')
+_data_ref = resources.files('pyedr.tests.data')
 
-EDR_IRREG = resource_filename(__name__, 'data/irregular.edr')
-EDR_IRREG_XVG = resource_filename(__name__, 'data/irregular.xvg')
-EDR_IRREG_UNITS = resource_filename(__name__, 'data/irregular_units.p')
+EDR = (_data_ref / 'cat_small.edr').as_posix()
+EDR_XVG = (_data_ref /  'cat_small.xvg').as_posix()
+EDR_UNITS = (_data_ref /  'cat_small_units.p').as_posix()
 
-EDR_DOUBLE = resource_filename(__name__, 'data/double.edr')
-EDR_DOUBLE_XVG = resource_filename(__name__, 'data/double.xvg')
-EDR_DOUBLE_UNITS = resource_filename(__name__, 'data/double_units.p')
+EDR_IRREG = (_data_ref /  'irregular.edr').as_posix()
+EDR_IRREG_XVG = (_data_ref /  'irregular.xvg').as_posix()
+EDR_IRREG_UNITS = (_data_ref /  'irregular_units.p').as_posix()
 
-EDR_BLOCKS = resource_filename(__name__, 'data/blocks.edr')
-EDR_BLOCKS_XVG = resource_filename(__name__, 'data/blocks.xvg')
-EDR_BLOCKS_UNITS = resource_filename(__name__, 'data/blocks_units.p')
+EDR_DOUBLE = (_data_ref /  'double.edr').as_posix()
+EDR_DOUBLE_XVG = (_data_ref /  'double.xvg').as_posix()
+EDR_DOUBLE_UNITS = (_data_ref /  'double_units.p').as_posix()
+
+EDR_BLOCKS = (_data_ref /  'blocks.edr').as_posix()
+EDR_BLOCKS_XVG = (_data_ref /  'blocks.xvg').as_posix()
+EDR_BLOCKS_UNITS = (_data_ref /  'blocks_units.p').as_posix()
 
 # Testfiles for file version 1 with single precision
 # See GROMACS regressiontests `Initial revision` (96c57f0d)
 # http://redmine.gromacs.org/projects/regressiontests
-EDR_V1 = resource_filename(__name__, 'data/1.edr')
-EDR_V1_XVG = resource_filename(__name__, 'data/1.xvg')
-EDR_V1_UNITS = resource_filename(__name__, 'data/1_units.p')
+EDR_V1 = (_data_ref /  '1.edr').as_posix()
+EDR_V1_XVG = (_data_ref /  '1.xvg').as_posix()
+EDR_V1_UNITS = (_data_ref /  '1_units.p').as_posix()
 
 # Testfiles for file version 1 with double precision
 # See GROMACS regressiontests `Initial revision` (96c57f0d)
 # http://redmine.gromacs.org/projects/regressiontests
-EDR_V1_DOUBLE = resource_filename(__name__, 'data/1_d.edr')
-EDR_V1_DOUBLE_XVG = resource_filename(__name__, 'data/1_d.xvg')
-EDR_V1_DOUBLE_UNITS = resource_filename(__name__, 'data/1_d_units.p')
+EDR_V1_DOUBLE = (_data_ref /  '1_d.edr').as_posix()
+EDR_V1_DOUBLE_XVG = (_data_ref /  '1_d.xvg').as_posix()
+EDR_V1_DOUBLE_UNITS = (_data_ref /  '1_d_units.p').as_posix()
 
 # Testfiles for file version 2
 # Generated from GROMACS regression test 'simple/imp1'
 # at branch 'release-4-5'
 # See https://gitlab.com/gromacs/gromacs-regressiontests
 # GROMACS version commit bcbfcdee8e449344605552fa90c18eeab2b1fc53
-EDR_V2 = resource_filename(__name__, 'data/2.edr')
-EDR_V2_XVG = resource_filename(__name__, 'data/2.xvg')
-EDR_V2_UNITS = resource_filename(__name__, 'data/234_units.p')
-EDR_V2_DOUBLE = resource_filename(__name__, 'data/2_d.edr')
-EDR_V2_DOUBLE_XVG = resource_filename(__name__, 'data/2_d.xvg')
-EDR_V2_DOUBLE_UNITS = resource_filename(__name__, 'data/234_units.p')
+EDR_V2 = (_data_ref /  '2.edr').as_posix()
+EDR_V2_XVG = (_data_ref /  '2.xvg').as_posix()
+EDR_V2_UNITS = (_data_ref /  '234_units.p').as_posix()
+EDR_V2_DOUBLE = (_data_ref /  '2_d.edr').as_posix()
+EDR_V2_DOUBLE_XVG = (_data_ref /  '2_d.xvg').as_posix()
+EDR_V2_DOUBLE_UNITS = (_data_ref /  '234_units.p').as_posix()
 
 # Testfiles for file version 3
 # Generated from GROMACS regression test 'simple/imp1'
 # at branch 'release-4-5'
 # See https://gitlab.com/gromacs/gromacs-regressiontests
 # GROMACS version commit d9c1da8c98ef7a99db5de71c57f683cf19435ef5
-EDR_V3 = resource_filename(__name__, 'data/3.edr')
-EDR_V3_XVG = resource_filename(__name__, 'data/3.xvg')
-EDR_V3_UNITS = resource_filename(__name__, 'data/234_units.p')
-EDR_V3_DOUBLE = resource_filename(__name__, 'data/3_d.edr')
-EDR_V3_DOUBLE_XVG = resource_filename(__name__, 'data/3_d.xvg')
-EDR_V3_DOUBLE_UNITS = resource_filename(__name__, 'data/234_units.p')
+EDR_V3 = (_data_ref /  '3.edr').as_posix()
+EDR_V3_XVG = (_data_ref /  '3.xvg').as_posix()
+EDR_V3_UNITS = (_data_ref /  '234_units.p').as_posix()
+EDR_V3_DOUBLE = (_data_ref /  '3_d.edr').as_posix()
+EDR_V3_DOUBLE_XVG = (_data_ref /  '3_d.xvg').as_posix()
+EDR_V3_DOUBLE_UNITS = (_data_ref /  '234_units.p').as_posix()
 
 # Testfiles for file version 4
 # Generated from GROMACS regression test 'simple/imp1'
 # at branch 'release-4-5'
 # See https://gitlab.com/gromacs/gromacs-regressiontests
 # GROMACS version commit 5d24334a33745dbf26f2904badcb3c4989e087d3
-EDR_V4 = resource_filename(__name__, 'data/4.edr')
-EDR_V4_XVG = resource_filename(__name__, 'data/4.xvg')
-EDR_V4_UNITS = resource_filename(__name__, 'data/234_units.p')
-EDR_V4_DOUBLE = resource_filename(__name__, 'data/4_d.edr')
-EDR_V4_DOUBLE_XVG = resource_filename(__name__, 'data/4_d.xvg')
-EDR_V4_DOUBLE_UNITS = resource_filename(__name__, 'data/234_units.p')
+EDR_V4 = (_data_ref /  '4.edr').as_posix()
+EDR_V4_XVG = (_data_ref /  '4.xvg').as_posix()
+EDR_V4_UNITS = (_data_ref /  '234_units.p').as_posix()
+EDR_V4_DOUBLE = (_data_ref /  '4_d.edr').as_posix()
+EDR_V4_DOUBLE_XVG = (_data_ref /  '4_d.xvg').as_posix()
+EDR_V4_DOUBLE_UNITS = (_data_ref /  '234_units.p').as_posix()
 
 # Collection of testfiles and corresponding reference data as a tuple.
 # A tuple contains paths for the testfile, expected values in a XVG file,
@@ -108,32 +109,14 @@
     (Path(EDR), EDR_XVG, EDR_UNITS, 5),
     ]
 
-EDR_MOCK_V1_ESUM0 = resource_filename(__name__, 'data/mocks/v1_nre2_esum0.edr')
-EDR_MOCK_V5_STEP_NEGATIVE = resource_filename(
-    __name__, 'data/mocks/v5_step_negative.edr'
-)
-EDR_MOCK_V1_STEP_NEGATIVE = resource_filename(
-    __name__, 'data/mocks/v1_step_negative.edr'
-)
-EDR_MOCK_V_LARGE = resource_filename(__name__, 'data/mocks/v_large.edr')
-EDR_MOCK_V4_LARGE_VERSION_FRAME = resource_filename(
-    __name__, 'data/mocks/v4_large_version_frame.edr'
-)
-EDR_MOCK_V4_FIRST_REAL_V1 = resource_filename(
-    __name__, 'data/mocks/v4_first_real_v1.edr'
-)
-EDR_MOCK_V4_INVALID_FILE_MAGIC = resource_filename(
-    __name__, 'data/mocks/v4_invalid_file_magic.edr'
-)
-EDR_MOCK_V4_INVALID_FRAME_MAGIC = resource_filename(
-    __name__, 'data/mocks/v4_invalid_frame_magic.edr'
-)
-EDR_MOCK_V4_INVALID_BLOCK_TYPE = resource_filename(
-    __name__, 'data/mocks/v4_invalid_block_type.edr'
-)
-EDR_MOCK_V4_ALL_BLOCK_TYPES = resource_filename(
-    __name__, 'data/mocks/v4_all_block_types.edr'
-)
-EDR_MOCK_V3_NDISRE2_BLOCKS = resource_filename(
-    __name__, 'data/mocks/v3_ndisre2_blocks.edr'
-)
+EDR_MOCK_V1_ESUM0 = (_data_ref /  'mocks/v1_nre2_esum0.edr').as_posix()
+EDR_MOCK_V5_STEP_NEGATIVE = (_data_ref / 'mocks/v5_step_negative.edr').as_posix()
+EDR_MOCK_V1_STEP_NEGATIVE = (_data_ref / 'mocks/v1_step_negative.edr').as_posix()
+EDR_MOCK_V_LARGE = (_data_ref /  'mocks/v_large.edr').as_posix()
+EDR_MOCK_V4_LARGE_VERSION_FRAME = (_data_ref /  'mocks/v4_large_version_frame.edr').as_posix()
+EDR_MOCK_V4_FIRST_REAL_V1 = (_data_ref /  'mocks/v4_first_real_v1.edr').as_posix()
+EDR_MOCK_V4_INVALID_FILE_MAGIC = (_data_ref /  'mocks/v4_invalid_file_magic.edr').as_posix()
+EDR_MOCK_V4_INVALID_FRAME_MAGIC = (_data_ref /  'mocks/v4_invalid_frame_magic.edr').as_posix()
+EDR_MOCK_V4_INVALID_BLOCK_TYPE = (_data_ref /  'mocks/v4_invalid_block_type.edr').as_posix()
+EDR_MOCK_V4_ALL_BLOCK_TYPES = (_data_ref /  'mocks/v4_all_block_types.edr').as_posix()
+EDR_MOCK_V3_NDISRE2_BLOCKS = (_data_ref /  'mocks/v3_ndisre2_blocks.edr').as_posix()