Skip to content

Commit

Permalink
Maintenance (#7)
Browse files Browse the repository at this point in the history
* switch to pyproject.toml

* update CI github actions

* lint and format
  • Loading branch information
benbovy authored Sep 26, 2023
1 parent 77dc1af commit d09f3be
Show file tree
Hide file tree
Showing 21 changed files with 331 additions and 398 deletions.
31 changes: 0 additions & 31 deletions .github/workflows/lint.yml

This file was deleted.

37 changes: 20 additions & 17 deletions .github/workflows/pypipublish.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
name: Upload Python Package
name: Upload Python Package on PyPI

on:
release:
types: [created]
types: [published]

jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/ipyfastscape
permissions:
id-token: write
steps:
- uses: actions/[email protected]
- name: Set up Python
uses: actions/[email protected]
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install setuptools setuptools-scm wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
python-version: "3.9"
- name: Install publish dependencies
run: python -m pip install build
- name: Build package
run: python -m build . -o py_dist
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: py_dist/
43 changes: 0 additions & 43 deletions .github/workflows/test.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
on:
push:
branches: [main]
pull_request:
branches: [main]

name: Tests

jobs:
tests:
name: Test Python (${{ matrix.os }} / ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -el {0}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest"] #, "windows-latest"]
python-version: ["3.9", "3.10", "3.11"]
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
cache-environment: true
cache-downloads: false
create-args: >-
python=${{ matrix.python-version }}
- name: Install fastscape
run: |
python -m pip install . -v
- name: Run tests
run: |
pytest . -vv --color=yes
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ __pycache__/
build/
develop-eggs/
dist/
py_dist/
downloads/
eggs/
.eggs/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/fastscape-lem/fastscape-demo/master?urlpath=lab/tree/ipyfastscape)
[![Tests](https://github.com/fastscape-lem/ipyfastscape/workflows/test/badge.svg)](https://github.com/fastscape-lem/ipyfastscape/actions)
[![Tests](https://github.com/fastscape-lem/ipyfastscape/workflows/tests/badge.svg)](https://github.com/fastscape-lem/ipyfastscape/actions)

# Ipyfastscape

Expand Down
3 changes: 0 additions & 3 deletions dev-requirements.txt

This file was deleted.

10 changes: 10 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: ipyfastscape-dev
channels:
- conda-forge
dependencies:
- python>=3.9
- xarray
- ipygany>=0.5.0
- ipywidgets
- pytest
- pip
73 changes: 73 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools>=42",
"setuptools-scm>=7",
]

[tool.setuptools.packages.find]
where = ["src"]
include = [
"ipyfastscape",
"ipyfastscape.*",
]

[tool.setuptools_scm]
fallback_version = "9999"

[project]
name = "ipyfastscape"
dynamic = ["version"]
authors = [
{name = "Benoît Bovy", email = "[email protected]"},
]
maintainers = [
{name = "IpyFastscape contributors"},
]
license = {text = "BSD-3-Clause"}
description = "Interactive widgets for topographic data analysis and modelling in Jupyter notebooks"
keywords = ["fastscape", "xarray", "jupyter", "landscape", "topography"]
readme = "README.md"
classifiers = [
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
]
requires-python = ">=3.9"
dependencies = [
"xarray",
"ipywidgets",
"ipygany >=0.5.0"
]

[project.optional-dependencies]
dev = ["pytest"]

[project.urls]
Repository = "https://github.com/fastscape-lem/ipyfastscape"

[tool.black]
line-length = 100

[tool.ruff]
# E402: module level import not at top of file
# E501: line too long - let black worry about that
# E731: do not assign a lambda expression, use a def
ignore = [
"E402",
"E501",
"E731",
]
select = [
"F", # Pyflakes
"E", # Pycodestyle
"W",
"I", # isort
"UP", # Pyupgrade
]
exclude = [".eggs", "doc"]
target-version = "py39"

[tool.ruff.isort]
known-first-party = ["ipyfastscape"]
5 changes: 0 additions & 5 deletions requirements.txt

This file was deleted.

24 changes: 0 additions & 24 deletions setup.cfg

This file was deleted.

49 changes: 0 additions & 49 deletions setup.py

This file was deleted.

13 changes: 8 additions & 5 deletions src/ipyfastscape/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from pkg_resources import DistributionNotFound, get_distribution
from importlib.metadata import PackageNotFoundError, version

from .common import AppLinker # noqa: F401
from .topoviz3d import TopoViz3d # noqa: F401
from .common import AppLinker
from .topoviz3d import TopoViz3d

try:
__version__ = get_distribution(__name__).version
except DistributionNotFound: # noqa: F401; pragma: no cover
__version__ = version("ipyfastscape")
except PackageNotFoundError: # noqa
# package is not installed
pass


__all__ = ("AppLinker", "TopoViz3d", "__version__")
Loading

0 comments on commit d09f3be

Please sign in to comment.