Skip to content

WIP: Pyproject #269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
26 changes: 11 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,25 @@ jobs:
python-version: ["3.10", "3.11"]
steps:
- uses: actions/checkout@master
- uses: actions/setup-python@v5
name: Setup Python ${{ matrix.python-version }}
- name: Install uv and set the python version ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies 📦
run: sudo apt-get update && sudo apt-get install -y dh-python devscripts fakeroot debhelper python3-all python3-setuptools build-essential
- name: Install requirements 📦
run: |
python3 -m pip install --upgrade pip
pip3 install -r requirements-dev.txt
- name: Install package 📦
run: python3 setup.py install
run: sudo apt-get update && sudo apt-get install -y dh-python devscripts fakeroot debhelper python3-all python3-setuptools build-essential pybuild-plugin-pyproject
- name: Install dependencies and package 📦
run: uv sync --extra dev
- name: run tests ⚙️
run: python3 setup.py test
run: uv run tests/run_tests.py
- name: run test coverage ⚙️
run: |
coverage run --source pygeometa setup.py test
coverage report -m
uv run coverage run --source pygeometa tests/run_tests.py
uv run coverage report -m
- name: build docs 🏗️
run: mkdocs build -f docs/mkdocs.yml
run: uv run mkdocs build -f docs/mkdocs.yml
- name: run flake8 ⚙️
run: flake8
run: uv run flake8 tests pygeometa
- name: build Python package 🏗️
run: python3 setup.py sdist bdist_wheel --universal
run: uv build
- name: build Debian package 🏗️
run: sudo debuild -b -uc -us
4 changes: 0 additions & 4 deletions MANIFEST.in

This file was deleted.

26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,13 @@ cd my-env
. bin/activate
git clone https://github.com/geopython/pygeometa.git
cd pygeometa
python3 setup.py build
python3 setup.py install
pip install .
```
**Alternative**: using `uv`
```bash
git clone https://github.com/geopython/pygeometa.git
cd pygeometa
uv sync
```

## Running
Expand Down Expand Up @@ -120,7 +125,13 @@ Same as installing a package. Use a virtualenv. Also install developer
requirements:

```bash
pip3 install -r requirements-dev.txt
pip3 install .[dev]
```

**Alternative**: using `uv`

```bash
uv sync --extra dev
```

### Adding a Metadata Schema to the Core
Expand Down Expand Up @@ -163,11 +174,10 @@ vi pygeometa/schemas/foo/__init__.py
### Running Tests

```bash
# via setuptools
python3 setup.py test
# manually
cd tests
python3 run_tests.py
python3 tests/run_tests.py
# using uv
uv run tests/run_tests.py
```

## Releasing
Expand All @@ -183,7 +193,7 @@ git tag -a x.y.z -m 'tagging release x.y.z'
# push tag
git push --tags
rm -fr build dist *.egg-info
python3 setup.py sdist bdist_wheel --universal
python3 -m build
twine upload dist/*
```

Expand Down
3 changes: 2 additions & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Uploaders: Angelos Tzotsos <[email protected]>
Build-Depends: debhelper (>= 9),
dh-python,
python3-all,
python3-setuptools
python3-setuptools,
pybuild-plugin-pyproject
Standards-Version: 4.3.0
Vcs-Git: https://github.com/geopython/pygeometa.git
Homepage: https://geopython.github.io/pygeometa
Expand Down
1 change: 1 addition & 0 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#export DH_VERBOSE=1

export PYBUILD_NAME=pygeometa
export PYBUILD_SYSTEM=pyproject

%:
dh $@ --with python3 --buildsystem pybuild
Expand Down
4 changes: 2 additions & 2 deletions pygeometa/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
import logging
import os
import pathlib
import pkg_resources
from importlib.metadata import version
import re
from typing import IO, Union
from xml.dom import minidom
Expand All @@ -70,7 +70,7 @@

SCHEMAS = pathlib.Path(__file__).resolve().parent / 'schemas'

VERSION = pkg_resources.require('pygeometa')[0].version
VERSION = version('pygeometa')


def get_charstring(option: Union[str, dict], language: str,
Expand Down
54 changes: 54 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
[project]
name = "pygeometa"
description = "pygeometa is a Python package to generate metadata for geospatial datasets"
readme = "README.md"
authors = [{ name = "Tom Kralidis", email = "[email protected]" }]
maintainers = [{ name = "Tom Kralidis", email = "[email protected]" }]
dependencies = ["Click", "Jinja2", "jsonschema", "lxml", "OWSLib", "pyyaml"]
license = "MIT"
license-files = [
"LICENSE.md"
]
dynamic = ['version']
classifiers = [
'Development Status :: 4 - Beta',
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Scientific/Engineering :: GIS',
]
keywords = ["geospatial", "metadata", "catalogue", "discovery"]
requires-python = ">=3.10"

[project.optional-dependencies]
dev = ["coverage", "setuptools>=77.0.3", "flake8", "mkdocs", "mkdocs-bootswatch", "twine", "wheel", "build"]

[project.urls]
"Home page" = "https://geopython.github.io/pygeometa"

[project.scripts]
pygeometa = "pygeometa:cli"

[build-system]
requires = ["setuptools>=77.0.3", "wheel"]
build-backend = "setuptools.build_meta"


[tool.setuptools]
platforms = ["all"]

[tool.setuptools.packages.find]
where = ["."]
include = [
"pygeometa*"
]


[tool.setuptools.package-data]
pygeometa = ["*.j2", "*.yaml",]


[tool.setuptools.dynamic]
version = {attr = "pygeometa.__version__"}
6 changes: 0 additions & 6 deletions requirements-dev.txt

This file was deleted.

6 changes: 0 additions & 6 deletions requirements.txt

This file was deleted.

139 changes: 0 additions & 139 deletions setup.py

This file was deleted.