From 6c6c1f38abe00af6a24dc00a10b41faa9590a764 Mon Sep 17 00:00:00 2001 From: Tammo Jan Dijkema Date: Fri, 26 Jan 2024 12:54:20 +0100 Subject: [PATCH] Migrate to pyproject.toml --- .travis.yml | 10 ------ docs/source/conf.py | 4 ++- lofarantpos/__init__.py | 1 - pyproject.toml | 33 +++++++++++++++++ setup.py | 35 ------------------- src/lofarantpos/__init__.py | 3 ++ {lofarantpos => src/lofarantpos}/db.py | 1 + {lofarantpos => src/lofarantpos}/geo.py | 0 {lofarantpos => src/lofarantpos}/plotutil.py | 0 .../lofarantpos/etrs-antenna-positions.csv | 0 .../share}/lofarantpos/etrs-phase-centres.csv | 0 .../share}/lofarantpos/hba-rotations.csv | 0 .../share}/lofarantpos/normal_vectors.dat | 0 .../share}/lofarantpos/rotation_matrices.dat | 0 .../share}/lofarantpos/stationinfo.csv | 0 15 files changed, 40 insertions(+), 47 deletions(-) delete mode 100644 .travis.yml delete mode 100644 lofarantpos/__init__.py create mode 100644 pyproject.toml delete mode 100644 setup.py create mode 100644 src/lofarantpos/__init__.py rename {lofarantpos => src/lofarantpos}/db.py (99%) rename {lofarantpos => src/lofarantpos}/geo.py (100%) rename {lofarantpos => src/lofarantpos}/plotutil.py (100%) rename {share => src/lofarantpos/share}/lofarantpos/etrs-antenna-positions.csv (100%) rename {share => src/lofarantpos/share}/lofarantpos/etrs-phase-centres.csv (100%) rename {share => src/lofarantpos/share}/lofarantpos/hba-rotations.csv (100%) rename {share => src/lofarantpos/share}/lofarantpos/normal_vectors.dat (100%) rename {share => src/lofarantpos/share}/lofarantpos/rotation_matrices.dat (100%) rename {share => src/lofarantpos/share}/lofarantpos/stationinfo.csv (100%) diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e9a9a4e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -language: python -python: - - "2.7" - - "3.6" - - "3.7" -install: - - pip install pathlib - - python setup.py install -script: - - pytest --doctest-modules --ignore=scripts diff --git a/docs/source/conf.py b/docs/source/conf.py index 03ef6e2..952f091 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -4,11 +4,13 @@ import sys sys.path.insert(0, os.path.abspath('../../lofarantpos/')) sys.path.insert(0, os.path.abspath('../..')) -from lofarantpos import __version__ +import importlib.metadata + project = 'lofarantpos' copyright = '2022, ASTRON' author = 'Michiel Brentens, Tammo Jan Dijkema' +__version__ = importlib.metadata.version(project) release = __version__ version = __version__ diff --git a/lofarantpos/__init__.py b/lofarantpos/__init__.py deleted file mode 100644 index ef7eb44..0000000 --- a/lofarantpos/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = '0.6.0' diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..a97256b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,33 @@ +[project] +name = "lofarantpos" +version = "0.6.0" +description = "Access, query, and manipulate LOFAR antenna positions" +authors = [ + {name = "Tammo Jan Dijkema", email = "dijkema@astron.nl"}, + {name = "M.A. Brentjens", email = "brentjens@astron.nl"}, +] +dependencies = [ +'numpy', +'matplotlib', +'pathlib', +'tilemapbase' +] +requires-python = ">=3.7" +readme = "README.md" +license = {text = "Apache-2.0"} +classifiers = [ + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 3", +] + +[build-system] +build-backend = "setuptools.build_meta" +requires=[ + "setuptools>=42", + "wheel", + "setuptools_scm"] + +[project.urls] +Homepage = "https://github.com/lofar-astron/lofar-antenna-positions" diff --git a/setup.py b/setup.py deleted file mode 100644 index 4d4b4d7..0000000 --- a/setup.py +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env python - -from setuptools import setup -from lofarantpos import __version__ - -with open("README.md", "r") as fh: - long_description = fh.read() - -if __name__ == "__main__": - setup(name='lofarantpos', - version = __version__, - description = 'Access, query, and manipulate LOFAR antenna positions', - long_description = long_description, - long_description_content_type="text/markdown", - author = 'M.A. Brentjens', - author_email = 'brentjens@astron.nl', - packages = ['lofarantpos'], - url = "https://github.com/lofar-astron/lofar-antenna-positions", - requires = ['numpy', 'pathlib'], - tests_require = ['numpy', 'pathlib', 'matplotlib', 'tilemapbase'], - scripts = [], - classifiers = [ - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 2", - "License :: OSI Approved :: Apache Software License", - "Operating System :: OS Independent", - ], - data_files = [('share/lofarantpos', - ['share/lofarantpos/etrs-antenna-positions.csv', - 'share/lofarantpos/etrs-phase-centres.csv', - 'share/lofarantpos/hba-rotations.csv', - 'share/lofarantpos/normal_vectors.dat', - 'share/lofarantpos/rotation_matrices.dat', - 'share/lofarantpos/stationinfo.csv'])] - ) diff --git a/src/lofarantpos/__init__.py b/src/lofarantpos/__init__.py new file mode 100644 index 0000000..51f01b4 --- /dev/null +++ b/src/lofarantpos/__init__.py @@ -0,0 +1,3 @@ +import importlib.metadata + +__version__ = importlib.metadata.version("lofarantpos") diff --git a/lofarantpos/db.py b/src/lofarantpos/db.py similarity index 99% rename from lofarantpos/db.py rename to src/lofarantpos/db.py index 6ca522b..b7da2a6 100644 --- a/lofarantpos/db.py +++ b/src/lofarantpos/db.py @@ -133,6 +133,7 @@ def __init__(self, path_to_files=None): # Install_prefix can end up to be some_path/lib/site_packages, # append to the search path the install_prefix minus last two directories search_path = [install_prefix(), + pathlib.PurePath(__file__).parent, os.sep.join(install_prefix().split(os.sep)[:-2]), '/usr/local', '/usr'] for attempt in search_path: diff --git a/lofarantpos/geo.py b/src/lofarantpos/geo.py similarity index 100% rename from lofarantpos/geo.py rename to src/lofarantpos/geo.py diff --git a/lofarantpos/plotutil.py b/src/lofarantpos/plotutil.py similarity index 100% rename from lofarantpos/plotutil.py rename to src/lofarantpos/plotutil.py diff --git a/share/lofarantpos/etrs-antenna-positions.csv b/src/lofarantpos/share/lofarantpos/etrs-antenna-positions.csv similarity index 100% rename from share/lofarantpos/etrs-antenna-positions.csv rename to src/lofarantpos/share/lofarantpos/etrs-antenna-positions.csv diff --git a/share/lofarantpos/etrs-phase-centres.csv b/src/lofarantpos/share/lofarantpos/etrs-phase-centres.csv similarity index 100% rename from share/lofarantpos/etrs-phase-centres.csv rename to src/lofarantpos/share/lofarantpos/etrs-phase-centres.csv diff --git a/share/lofarantpos/hba-rotations.csv b/src/lofarantpos/share/lofarantpos/hba-rotations.csv similarity index 100% rename from share/lofarantpos/hba-rotations.csv rename to src/lofarantpos/share/lofarantpos/hba-rotations.csv diff --git a/share/lofarantpos/normal_vectors.dat b/src/lofarantpos/share/lofarantpos/normal_vectors.dat similarity index 100% rename from share/lofarantpos/normal_vectors.dat rename to src/lofarantpos/share/lofarantpos/normal_vectors.dat diff --git a/share/lofarantpos/rotation_matrices.dat b/src/lofarantpos/share/lofarantpos/rotation_matrices.dat similarity index 100% rename from share/lofarantpos/rotation_matrices.dat rename to src/lofarantpos/share/lofarantpos/rotation_matrices.dat diff --git a/share/lofarantpos/stationinfo.csv b/src/lofarantpos/share/lofarantpos/stationinfo.csv similarity index 100% rename from share/lofarantpos/stationinfo.csv rename to src/lofarantpos/share/lofarantpos/stationinfo.csv