Skip to content

Commit

Permalink
Transition from setup.py to pyproject.toml
Browse files Browse the repository at this point in the history
* Migrate packaging to pyproject.toml, python>=3.10

* Set gh action for pypi publication with setuptools-scm

* Update MANIFEST.in

* Update MANIFEST.in

* Add trollsift dependence

* Update pyproject.toml

* Update pyproject.toml

* Update pyproject.toml

* Update pyproject.toml

* Update pyproject.toml

* Update pyproject.toml

* Update pyproject.toml

* Update pyproject.toml

* Add __version__ retrieval

* Set python>=3.8 in pyproject.toml

---------

Co-authored-by: Gionata Ghiggi <[email protected]>
  • Loading branch information
sphamba and ghiggi authored Feb 27, 2023
1 parent 145ca1f commit 1633d2f
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 84 deletions.
14 changes: 3 additions & 11 deletions .github/workflows/release_to_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,14 @@ jobs:
with:
python-version: "3.x"

- name: Install pypa/setuptools
- name: Install pypa/build
run: >-
python -m
pip install wheel
- name: Extract tag name
id: tag
run: echo ::set-output name=TAG_NAME::$(echo $GITHUB_REF | cut -d / -f 3)

- name: Update version in setup.py
run: >-
sed -i "s/{{VERSION_PLACEHOLDER}}/${{ steps.tag.outputs.TAG_NAME }}/g" setup.py
pip install build
- name: Build a binary wheel
run: >-
python setup.py sdist bdist_wheel
python -m build
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST
_version.py

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down
6 changes: 6 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
prune .github
prune data
prune docs
prune disdrodb/l0/manuals
prune disdrodb/l0/scripts
prune disdrodb/tests
10 changes: 8 additions & 2 deletions disdrodb/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from importlib.metadata import version, PackageNotFoundError

from disdrodb.api.io import (
available_stations,
available_campaigns,
Expand All @@ -14,5 +16,9 @@
"read_station_metadata",
]

# TODO: GET VERSION
# __version__ = ...
# Get version
try:
__version__ = version("disdrodb")
except PackageNotFoundError:
# package is not installed
pass
53 changes: 53 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"

[project]
name = "disdrodb"
authors = [
{name = "Gionata Ghiggi"},
]
description = "This package provides tools to homogenize, process, and analyze global disdrometer data."
readme = "README.md"
keywords = ["python", "disdrometer"]
classifiers = [
"Development Status :: 1 - Planning",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3",
"Operating System :: Unix",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
]
requires-python = ">=3.8"
dependencies = [
"click",
"h5py",
"netCDF4",
"trollsift",
"pyarrow",
"PyYAML",
"setuptools",
"xarray",
"dask",
]
dynamic = ["version"]

[tool.setuptools_scm]
write_to = "disdrodb/_version.py"

[tool.setuptools.packages.find]
where = ["disdrodb"]

[project.scripts]
# L0A
run_disdrodb_l0a_station="disdrodb.l0.scripts.run_disdrodb_l0a_station:run_disdrodb_l0a_station"
run_disdrodb_l0a="disdrodb.l0.scripts.run_disdrodb_l0a:run_disdrodb_l0a"
# L0B
run_disdrodb_l0b_station="disdrodb.l0.scripts.run_disdrodb_l0b_station:run_disdrodb_l0b_station"
run_disdrodb_l0_station="disdrodb.l0.scripts.run_disdrodb_l0_station:run_disdrodb_l0_station"
# L0B concatenation
run_disdrodb_l0b_concat_station="disdrodb.l0.scripts.run_disdrodb_l0b_concat_station:run_disdrodb_l0b_concat_station"
run_disdrodb_l0b_concat="disdrodb.l0.scripts.run_disdrodb_l0b_concat:run_disdrodb_l0b_concat"
# L0
run_disdrodb_l0b="disdrodb.l0.scripts.run_disdrodb_l0b:run_disdrodb_l0b"
run_disdrodb_l0="disdrodb.l0.scripts.run_disdrodb_l0:run_disdrodb_l0"
3 changes: 0 additions & 3 deletions setup.cfg

This file was deleted.

68 changes: 0 additions & 68 deletions setup.py

This file was deleted.

0 comments on commit 1633d2f

Please sign in to comment.