Skip to content

Commit 39cd740

Browse files
authored
use only pyproject configuration (#327)
* use only pyproject configuration * Fix formatting of license entry in pyproject.toml
1 parent 2419d15 commit 39cd740

14 files changed

Lines changed: 136 additions & 172 deletions

File tree

.github/workflows/docs.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@ on:
1010
jobs:
1111
build:
1212
name: Build and Deploy Documentation
13-
runs-on: ubuntu-latest
13+
runs-on: ubuntu-24.04
1414
steps:
1515
- uses: actions/checkout@master
16-
- uses: actions/setup-python@v5
16+
- uses: actions/setup-python@v6
1717
with:
1818
python-version: '3.12'
1919
- name: Install requirements 📦
2020
run: |
21-
python3 -m pip install --upgrade pip
2221
pip3 install mkdocs
2322
- name: Deploy 📦
2423
run: cd docs && mkdocs gh-deploy --force -m 'update website'

.github/workflows/main.yml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,23 @@ jobs:
1010
python-version: ["3.12"]
1111
steps:
1212
- uses: actions/checkout@master
13-
- uses: actions/setup-python@v5
13+
- uses: actions/setup-python@v6
1414
name: Setup Python ${{ matrix.python-version }}
1515
with:
1616
python-version: ${{ matrix.python-version }}
1717
- name: Install system dependencies 📦
18-
run: sudo apt-get update && sudo apt-get install -y dh-python devscripts fakeroot debhelper python3-all build-essential
19-
- name: Install requirements 📦
18+
run: sudo apt-get update && sudo apt-get install -y dh-python devscripts debhelper pybuild-plugin-pyproject build-essential python3-all
19+
- name: Install package and doc requirements 📦
2020
run: |
21-
python3 -m pip install --upgrade pip
22-
pip3 install setuptools
23-
pip3 install -r requirements-dev.txt
24-
- name: Install package 📦
25-
run: pip3 install .
26-
- name: run tests with coverage ⚙️
27-
run: |
28-
coverage run --source pygeometa tests/run_tests.py
29-
coverage report -m
21+
pip3 install .
22+
pip3 install ".[dev]"
23+
pip3 install ".[docs]"
24+
pip3 install ".[release]"
3025
- name: build docs 🏗️
3126
run: mkdocs build -f docs/mkdocs.yml
3227
- name: run flake8 ⚙️
3328
run: flake8
3429
- name: build Python package 🏗️
35-
run: python3 setup.py sdist bdist_wheel --universal
30+
run: python3 -m build
3631
- name: build Debian package 🏗️
3732
run: sudo debuild -b -uc -us

MANIFEST.in

Lines changed: 0 additions & 4 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Same as installing a package. Use a virtualenv. Also install developer
122122
requirements:
123123

124124
```bash
125-
pip3 install -r requirements-dev.txt
125+
pip3 install ".[dev]"
126126
```
127127

128128
### Adding a Metadata Schema to the Core
@@ -173,16 +173,16 @@ python3 run_tests.py
173173

174174
```bash
175175
# update version
176-
vi pygeometa/__init__.py
176+
vi pyproject.toml # update [project]/version
177177
vi debian/changelog # add changelog entry and summary of updates
178-
git commit -m 'update release version' pygeometa/__init__.py debian/changelog
178+
git commit -m 'update release version' pyproject.toml debian/changelog
179179
# push changes
180180
git push origin master
181181
git tag -a x.y.z -m 'tagging release x.y.z'
182182
# push tag
183183
git push --tags
184184
rm -fr build dist *.egg-info
185-
python3 setup.py sdist bdist_wheel --universal
185+
python3 -m build
186186
twine upload dist/*
187187
```
188188

debian/compat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9
1+
10

debian/control

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ Section: python
33
Priority: optional
44
Maintainer: Tom Kralidis <tomkralidis@gmail.com>
55
Uploaders: Angelos Tzotsos <gcpp.kalxas@gmail.com>
6-
Build-Depends: debhelper (>= 9),
6+
Build-Depends: debhelper (>= 13),
77
dh-python,
88
python3-all,
9-
python3-setuptools
10-
Standards-Version: 4.3.0
9+
python3-setuptools,
10+
pybuild-plugin-pyproject
11+
Standards-Version: 4.6.0
1112
Vcs-Git: https://github.com/geopython/pygeometa.git
1213
Homepage: https://geopython.github.io/pygeometa
1314

debian/rules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
export PYBUILD_NAME=pygeometa
88

99
%:
10-
dh $@ --with python3 --buildsystem pybuild
10+
dh $@ --buildsystem pybuild
1111

1212
override_dh_auto_test:
1313
@echo "nocheck set, not running tests"

pygeometa/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# referenced with those assets.
2020
#
2121
# Copyright (c) 2016 Government of Canada
22-
# Copyright (c) 2025 Tom Kralidis
22+
# Copyright (c) 2026 Tom Kralidis
2323
#
2424
# Permission is hereby granted, free of charge, to any person
2525
# obtaining a copy of this software and associated documentation
@@ -48,8 +48,9 @@
4848

4949
from pygeometa.core import (generate, import_, info, schemas,
5050
transform, validate)
51+
from pygeometa.util import get_package_version
5152

52-
__version__ = '0.20.dev0'
53+
__version__ = get_package_version()
5354

5455

5556
@click.group()

pygeometa/pygeoapi_plugin.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# those files. Users are asked to read the 3rd Party Licenses
1919
# referenced with those assets.
2020
#
21-
# Copyright (c) 2022 Tom Kralidis
21+
# Copyright (c) 2026 Tom Kralidis
2222
#
2323
# Permission is hereby granted, free of charge, to any person
2424
# obtaining a copy of this software and associated documentation
@@ -102,9 +102,9 @@
102102

103103
import logging
104104

105-
from pygeometa import __version__
106105
from pygeometa.core import read_mcf, validate_mcf
107106
from pygeometa.schemas import get_supported_schemas, load_schema
107+
from pygeometa.util import get_package_version
108108

109109
from pygeoapi.process.base import BaseProcessor, ProcessorExecuteError
110110

@@ -151,7 +151,7 @@
151151

152152

153153
PROCESS_METADATA_SCHEMAS = {
154-
'version': __version__,
154+
'version': get_package_version(),
155155
'id': 'pygeometa-metadata-schemas',
156156
'title': {
157157
'en': 'pygeometa metadata schemas',
@@ -183,7 +183,7 @@
183183
}
184184
}
185185
PROCESS_METADATA_IMPORT = {
186-
'version': __version__,
186+
'version': get_package_version(),
187187
'id': 'pygeometa-metadata-import',
188188
'title': {
189189
'en': 'pygeometa metadata import',
@@ -222,7 +222,7 @@
222222
}
223223

224224
PROCESS_METADATA_VALIDATE = {
225-
'version': __version__,
225+
'version': get_package_version(),
226226
'id': 'pygeometa-metadata-validate',
227227
'title': {
228228
'en': 'pygeometa metadata control file (MCF) validation',
@@ -260,7 +260,7 @@
260260

261261

262262
PROCESS_METADATA_GENERATE = {
263-
'version': __version__,
263+
'version': get_package_version(),
264264
'id': 'pygeometa-metadata-generate',
265265
'title': {
266266
'en': 'pygeometa metadata generation',
@@ -300,7 +300,7 @@
300300

301301

302302
PROCESS_METADATA_TRANSFORM = {
303-
'version': __version__,
303+
'version': get_package_version(),
304304
'id': 'pygeometa-metadata-transform',
305305
'title': {
306306
'en': 'pygeometa metadata transformation',

pygeometa/util.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# =================================================================
2+
#
3+
# Terms and Conditions of Use
4+
#
5+
# Unless otherwise noted, computer program source code of this
6+
# distribution # is covered under Crown Copyright, Government of
7+
# Canada, and is distributed under the MIT License.
8+
#
9+
# The Canada wordmark and related graphics associated with this
10+
# distribution are protected under trademark law and copyright law.
11+
# No permission is granted to use them outside the parameters of
12+
# the Government of Canada's corporate identity program. For
13+
# more information, see
14+
# http://www.tbs-sct.gc.ca/fip-pcim/index-eng.asp
15+
#
16+
# Copyright title to all 3rd party software distributed with this
17+
# software is held by the respective copyright holders as noted in
18+
# those files. Users are asked to read the 3rd Party Licenses
19+
# referenced with those assets.
20+
#
21+
# Copyright (c) 2026 Tom Kralidis
22+
#
23+
# Permission is hereby granted, free of charge, to any person
24+
# obtaining a copy of this software and associated documentation
25+
# files (the "Software"), to deal in the Software without
26+
# restriction, including without limitation the rights to use,
27+
# copy, modify, merge, publish, distribute, sublicense, and/or sell
28+
# copies of the Software, and to permit persons to whom the
29+
# Software is furnished to do so, subject to the following
30+
# conditions:
31+
#
32+
# The above copyright notice and this permission notice shall be
33+
# included in all copies or substantial portions of the Software.
34+
#
35+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
36+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
37+
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
38+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
39+
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
40+
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
41+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
42+
# OTHER DEALINGS IN THE SOFTWARE.
43+
#
44+
# =================================================================
45+
46+
import importlib.metadata
47+
48+
49+
def get_package_version() -> str:
50+
"""
51+
Helper function to get package version
52+
53+
:returns: `str` of version of package
54+
"""
55+
56+
return importlib.metadata.version('pygeometa')

0 commit comments

Comments
 (0)