Skip to content
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

Clean packaging and migrate to hatch #182

Merged
merged 21 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length=100
extend-ignore = E203
77 changes: 27 additions & 50 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,33 @@
name: unit test
name: Unit Tests

on: [push, pull_request]

env:
CONDA_ENV: ooi
on:
push:
pull_request:

jobs:
unit_test:
name: ${{ matrix.python-version }}-unit-test
runs-on: ubuntu-20.04
continue-on-error: ${{ matrix.experimental }}
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10']
experimental: [false]
python-version:
- "3.10"
- "3.11"
- "3.12"
name: Check Python ${{ matrix.python-version }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for all branches and tags.
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Setup micromamba
uses: mamba-org/provision-with-micromamba@v15
with:
environment-file: conda_envs/py${{ matrix.python-version }}.yml
environment-name: ${{ env.CONDA_ENV }}
cache-env: true
cache-env-key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles(format('conda_envs/py{0}.yml', matrix.python-version)) }}
- name: Print conda env
shell: bash -l {0}
run: |
conda info
conda list
- name: Install pytest
shell: bash -l {0}
run: |
python -m pip install pytest
- name: Install ooipy
shell: bash -l {0}
run: |
python -m pip install -e .
- name: Run unit tests
shell: bash -l {0}
env:
FORCE_COLOR: 3
run: pytest -vv tests |& tee unit_test_log${{ matrix.python-version }}.log
- name: Upload unit test log
if: ${{ success() || failure() }}
uses: actions/upload-artifact@v2
with:
name: unit_test_log${{ matrix.python-version }}
path: unit_test_log${{ matrix.python-version }}.log
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Only needed if using setuptools-scm

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true

- name: Install package
run: python -m pip install -e .[test]

- name: Test package
run: python -m pytest -p no:warnings
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ ooi_auth.txt
.eggs
_ooipy_version.py
*.nc
src/ooipy/version.py

# Environments
.env
Expand Down
13 changes: 13 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ repos:
rev: 24.10.0
hooks:
- id: black
args: ["--line-length", "100"]

- repo: https://github.com/PyCQA/flake8
rev: 7.1.1
Expand All @@ -37,3 +38,15 @@ repos:
- id: codespell
# Ignores `.ipynb` files, `_build` and `_static` folders
args: ["--skip=*.ipynb,docs/source/_build,docs/source/_static", "--ignore-words-list=authentification", "-w", "docs", "ooipy"]

ci:
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
autofix_prs: false
autoupdate_branch: ''
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
autoupdate_schedule: weekly
skip: []
submodules: false
22 changes: 0 additions & 22 deletions .readthedocs.yaml

This file was deleted.

22 changes: 0 additions & 22 deletions CITATION.cff

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 ooipy
Copyright (c) 202x ooipy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 0 additions & 4 deletions MANIFEST.in

This file was deleted.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<img src='imgs/OOIPY_Logo.png' align="right" width=150>

# OOIPY
![PEP8](https://github.com/ooipy/ooipy/workflows/PEP8/badge.svg?branch=master) ![unit test](https://github.com/ooipy/ooipy/workflows/unit%20test/badge.svg) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4276862.svg)](https://doi.org/10.5281/zenodo.4276862) [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/Ocean-Data-Lab/ooipy/master.svg)](https://results.pre-commit.ci/latest/github/Ocean-Data-Lab/ooipy/master) [![Documentation](https://readthedocs.org/projects/ooipy/badge/?version=latest)](https://ooipy.readthedocs.io/en/latest/?badge=latest)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) ![unit test](https://github.com/ooipy/ooipy/workflows/unit%20test/badge.svg) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4276862.svg)](https://doi.org/10.5281/zenodo.4276862) [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/Ocean-Data-Lab/ooipy/master.svg)](https://results.pre-commit.ci/latest/github/Ocean-Data-Lab/ooipy/master) [![Documentation](https://readthedocs.org/projects/ooipy/badge/?version=latest)](https://ooipy.readthedocs.io/en/latest/?badge=latest)




Expand Down
12 changes: 0 additions & 12 deletions conda_envs/py3.10.yml

This file was deleted.

12 changes: 0 additions & 12 deletions conda_envs/py3.9.yml

This file was deleted.

12 changes: 0 additions & 12 deletions dev-requirements.txt

This file was deleted.

1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import os
import sys
import datetime

sys.path.insert(0, sys.path.insert(0, os.path.dirname(os.path.abspath(".."))))

# -- Project information -----------------------------------------------------
Expand Down
101 changes: 89 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,93 @@
[build-system]
requires = [
"setuptools >= 66",
"setuptools_scm >= 7.0.0",
"wheel >= 0.38.4",
]
build-backend = 'setuptools.build_meta'

[tool.setuptools_scm]
fallback_version = "unknown"
local_scheme = "no-local-version"
write_to = "_ooipy_version.py"
write_to_template = 'version = "{version}"'
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "ooipy"
dynamic = ["version"]
description = 'toolbox for downloading and analyzing OOI hydrophone data'
readme = "README.md"
requires-python = ">=3.8"
license = "MIT"
keywords = []
maintainers = [
{ name = "John Ragland", email = "[email protected]" },
]
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
dependencies = [
"fsspec",
"xarray",
"obspy",
"pandas",
"numpy",
"tqdm",
"aiohttp",
]

[project.optional-dependencies]
test = [
"pytest >= 6.0",
]
dev = [
"pre-commit",
"black"
]

[project.urls]
Documentation = "https://ooipy.readthedocs.io"
Issues = "https://github.com/Ocean-Data-Lab/ooipy/issues"
Source = "https://github.com/Ocean-Data-Lab/ooipy"

[tool.hatch]
version.source = "vcs"
build.hooks.vcs.version-file = "src/ooipy/version.py"


[tool.hatch.envs.types]
extra-dependencies = [
"mypy>=1.0.0",
]
[tool.hatch.envs.types.scripts]
check = "mypy --install-types --non-interactive {args:src/ooipy tests}"

[tool.coverage.run]
source_pkgs = ["ooipy", "tests"]
branch = true
parallel = true
omit = [
"src/ooipy/__about__.py",
]

[tool.coverage.paths]
ooipy = ["src/ooipy", "*/ooipy/src/ooipy"]
tests = ["tests", "*/ooipy/tests"]

[tool.coverage.report]
exclude_lines = [
"no cov",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
]

[tool.pytest.ini_options]
minversion = "6.0"
addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"]
xfail_strict = true
filterwarnings = ["error"]
log_cli_level = "info"
testpaths = [
"tests",
]

[tool.black]
line-length = 100
Loading