From a7fa05ebd2c588faa1cca0d455d490c80d4e67d2 Mon Sep 17 00:00:00 2001 From: Marc Pound <22331890+mpound@users.noreply.github.com> Date: Fri, 28 Jul 2023 15:45:33 -0400 Subject: [PATCH 01/12] Update release.yml --- .github/workflows/release.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 79225957..f4643ab5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,10 +1,9 @@ +name: Publish Release to PyPi + on: release: - types: - - published - -name: release - + types: [ published ] + workflow_dispatch: jobs: build: runs-on: ${{ matrix.os }} From 3dc8df205c569b8e4194d7fb2f75f6ae7633e26a Mon Sep 17 00:00:00 2001 From: Marc Pound <22331890+mpound@users.noreply.github.com> Date: Fri, 28 Jul 2023 15:48:02 -0400 Subject: [PATCH 02/12] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1d33e17c..6e6ecc1a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: hatch build +name: Build with hatch on: release: From d64fda57c1452f8a178af15ebb70c82ee6260506 Mon Sep 17 00:00:00 2001 From: Thomas Chamberlin Date: Wed, 23 Aug 2023 16:23:38 -0400 Subject: [PATCH 03/12] Fix syntax error in release.yaml --- .github/workflows/release.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f4643ab5..1eb44e84 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,11 +4,12 @@ on: release: types: [ published ] workflow_dispatch: + jobs: build: runs-on: ${{ matrix.os }} environment: release - + strategy: fail-fast: false matrix: @@ -26,7 +27,8 @@ jobs: pip install -r requirements-dev.txt pip install -e . - name: Build with hatch - hatch build -c + run: | + hatch build -c pypi-publish: name: upload release to PyPI From 993ee64a04887bb02e051488a3eecfbe5aeab467 Mon Sep 17 00:00:00 2001 From: Thomas Chamberlin Date: Fri, 25 Aug 2023 14:20:15 -0400 Subject: [PATCH 04/12] Updates to pre-commit hooks and pyproject config Hatch: - Add test envs - Add [dev] and [docs] optional-dependencies "features" - Add new scripts for easy linting/testing/doc-building Linting/tooling: - Expand ruff linting rule selections - Replace isort config; replace with ruff - Remove pyright config pre-commit: - No longer using isort; replaced with ruff - Tweaks to black args - Update pip-compile step so it works with pyproject.toml (installs all optional dependencies and dumps them to requirements.txt) - Run $ pre-commit auto-update --- .github/workflows/build.yml | 4 +- .github/workflows/python-package.yml | 6 +- .pre-commit-config.yaml | 30 ++++--- pyproject.toml | 115 ++++++++++++++++----------- 4 files changed, 96 insertions(+), 59 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6e6ecc1a..44c02b78 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,7 @@ jobs: build: runs-on: ${{ matrix.os }} environment: hatch build - + strategy: fail-fast: false matrix: @@ -28,4 +28,4 @@ jobs: pip install -e . - name: Build with hatch run: | - hatch build -c + hatch build -c diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 81559e3f..92cec89c 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -11,12 +11,12 @@ on: jobs: build: runs-on: ${{ matrix.os }} - + strategy: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v3 @@ -32,4 +32,4 @@ jobs: pip install -e . - name: Test with pytest run: | - pytest \ No newline at end of file + pytest diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6f0a6dba..c4ff46f2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ --- # See https://pre-commit.com for more information default_language_version: - python: python3.8 + python: python3.9 # See https://pre-commit.com/hooks.html for more hooks repos: @@ -12,8 +12,6 @@ repos: - id: end-of-file-fixer exclude: LICENSE - id: check-yaml - # Might make sense once everything is at Python 3 - # - id: check-ast - id: check-added-large-files args: - '--maxkb=1024' @@ -21,18 +19,32 @@ repos: - id: mixed-line-ending args: - '--fix=lf' - - id: check-docstring-first - - repo: https://github.com/pycqa/isort - rev: 5.12.0 + + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.0.285 hooks: - - id: isort + - id: ruff + alias: autoformat + args: + - '--fix' + - '--exit-non-zero-on-fix' + - '--select=F,E,B,I' + - '--ignore=E501' + - repo: 'https://github.com/psf/black' - rev: 23.1.0 + rev: 23.7.0 hooks: - id: black + + - repo: https://github.com/jazzband/pip-tools - rev: 6.12.3 + rev: 7.3.0 hooks: - id: pip-compile args: + - 'pyproject.toml' + - '--all-extras' - '--resolver=backtracking' + - '--output-file=requirements.txt' + - '--no-strip-extras' + - '--quiet' diff --git a/pyproject.toml b/pyproject.toml index 86e03555..eb0ebbb8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,14 +1,11 @@ -[build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" - [project] name = "dysh" description = '' readme = "README.md" -requires-python = ">=3.8" +requires-python = ">=3.9" license = {file = "LICENSE"} keywords = [] +dynamic = ["version"] authors = [ { name = "Marc Pound", email = "mpound@umd.edu" }, { name = "Victoria Catlett", email = "vcatlett@nrao.edu" }, @@ -17,33 +14,46 @@ authors = [ { name = "Pedro Salas", email = "psalas@nrao.edu" }, ] classifiers = [ - "Development Status :: 1 - Planning", + "Development Status :: 3 - Alpha", "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 :: Implementation :: CPython", ] -dependencies = ["astropy", - "matplotlib", - "numpy", - "pandas", - "scipy", - "specutils", - "sphinx", - "myst-parser" - ] +dependencies = [ + "astropy", + "matplotlib", + "numpy", + "pandas", + "scipy", + "specutils", + "sphinx", + "myst-parser" + ] -dynamic = ["version"] +[project.optional-dependencies] +dev = [ + "ipdb", + "ipython", + "pytest", + "pytest-cov", + "wget", +] +docs = [ + "myst-parser", + "sphinx", + "sphinx-autobuild", + "sphinx-rtd-theme", + "sphinxcontrib-mermaid", + "numpydoc" +] [project.urls] Documentation = "https://github.com/GreenBankObservatory/dysh#readme" Issues = "https://github.com/GreenBankObservatory/dysh/issues" Source = "https://github.com/GreenBankObservatory/dysh" -#[project.scripts] -#dysh = "dysh.dysh:main" [project.scripts] fdr = "dysh.util.files:main_cli" @@ -51,23 +61,28 @@ fdr = "dysh.util.files:main_cli" path = "src/dysh/__init__.py" [tool.hatch.envs.default] -dependencies = [ - "pytest", - "pytest-cov", -] +# By default hatch will effectively do $ pip install dysh[dev] +features = ["dev"] +# run via: $ hatch run