diff --git a/.copier-answers.yml b/.copier-answers.yml deleted file mode 100644 index f0c22b7..0000000 --- a/.copier-answers.yml +++ /dev/null @@ -1,12 +0,0 @@ -# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY -_commit: 2024.01.24 -_src_path: gh:scientific-python/cookie -backend: flit -email: daniel.hollas@bristol.ac.uk -full_name: Daniel Hollas -license: MIT -org: ispg-group -project_name: harmonwig -project_short_description: Harmonic Wigner sampling from QM calculations. -url: https://github.com/ispg-group/harmonwig -vcs: false diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index ac4e488..6eb1c7b 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -3,29 +3,6 @@ description of best practices for developing scientific packages. [spc-dev-intro]: https://learn.scientific-python.org/development/ -# Quick development - -The fastest way to start with development is to use nox. If you don't have nox, -you can use `pipx run nox` to run it without installing, or `pipx install nox`. -If you don't have pipx (pip for applications), then you can install with -`pip install pipx` (the only case were installing an application with regular -pip is reasonable). If you use macOS, then pipx and nox are both in brew, use -`brew install pipx nox`. - -To use, run `nox`. This will lint and test using every installed version of -Python on your system, skipping ones that are not installed. You can also run -specific jobs: - -```console -$ nox -s lint # Lint only -$ nox -s tests # Python tests -$ nox -s docs -- --serve # Build and serve the docs -$ nox -s build # Make an SDist and wheel -``` - -Nox handles everything for you, including setting up an temporary virtual -environment for each run. - # Setting up a development environment manually You can set up a development environment by running: @@ -33,7 +10,7 @@ You can set up a development environment by running: ```bash python3 -m venv .venv source ./.venv/bin/activate -pip install -v -e .[dev] +pip install -e .[dev] ``` If you have the @@ -73,29 +50,3 @@ Use pytest-cov to generate coverage reports: ```bash pytest --cov=harmonwig ``` - -# Building docs - -You can build the docs using: - -```bash -nox -s docs -``` - -You can see a preview with: - -```bash -nox -s docs -- --serve -``` - -# Pre-commit - -This project uses pre-commit for all style checking. While you can run it with -nox, this is such an important tool that it deserves to be installed on its own. -Install pre-commit and run: - -```bash -pre-commit run -a -``` - -to check all files. diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 6c4b369..8b13673 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,7 +4,7 @@ updates: - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "weekly" + interval: "monthly" groups: actions: patterns: diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 6ea4db9..b1e995d 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -1,14 +1,12 @@ -name: CD +name: Publish on: - workflow_dispatch: pull_request: push: branches: - main - release: - types: - - published + tags: + - "v*" concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -48,5 +46,4 @@ jobs: if: github.event_name == 'release' && github.event.action == 'published' with: # Remember to tell (test-)pypi about this repo before publishing - # Remove this line to publish to PyPI repository-url: https://test.pypi.org/legacy/ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1b0252c..f43a847 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,6 @@ name: CI on: - workflow_dispatch: pull_request: push: branches: @@ -24,29 +23,21 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@v5 with: - python-version: "3.x" - - uses: pre-commit/action@v3.0.0 + python-version: "3.11" + - uses: pre-commit/action@v3.0.1 with: extra_args: --hook-stage manual --all-files - - name: Run PyLint - run: | - echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json" - pipx run nox -s pylint - checks: - name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }} + test: + name: Test Python ${{ matrix.python-version }} on ${{ matrix.runs-on }} runs-on: ${{ matrix.runs-on }} needs: [pre-commit] strategy: fail-fast: false matrix: - python-version: ["3.8", "3.12"] + python-version: ["3.7", "3.12"] runs-on: [ubuntu-latest, macos-latest, windows-latest] - include: - - python-version: pypy-3.10 - runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 with: @@ -55,15 +46,12 @@ jobs: - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - allow-prereleases: true - name: Install package - run: python -m pip install .[test] + run: pip install .[dev] - name: Test package - run: >- - python -m pytest -ra --cov --cov-report=xml --cov-report=term - --durations=20 + run: pytest -ra --cov --cov-report=xml --cov-report=term - name: Upload coverage report - uses: codecov/codecov-action@v3.1.4 + uses: codecov/codecov-action@v4 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ac556dd..a7a673e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,44 +3,21 @@ ci: autofix_commit_msg: "style: pre-commit fixes" repos: - - repo: https://github.com/adamchainz/blacken-docs - rev: "1.16.0" - hooks: - - id: blacken-docs - additional_dependencies: [black==23.*] - - repo: https://github.com/pre-commit/pre-commit-hooks rev: "v4.5.0" hooks: - id: check-added-large-files - - id: check-case-conflict - - id: check-merge-conflict - - id: check-symlinks - - id: check-yaml - - id: debug-statements - id: end-of-file-fixer - - id: mixed-line-ending - - id: name-tests-test - args: ["--pytest-test-first"] - - id: requirements-txt-fixer - - id: trailing-whitespace - - - repo: https://github.com/pre-commit/pygrep-hooks - rev: "v1.10.0" - hooks: - - id: rst-backticks - - id: rst-directive-colons - - id: rst-inline-touching-normal - repo: https://github.com/pre-commit/mirrors-prettier rev: "v3.1.0" hooks: - id: prettier - types_or: [yaml, markdown, html, css, scss, javascript, json] + types_or: [yaml, markdown] args: [--prose-wrap=always] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.1.14" + rev: "v0.2.2" hooks: - id: ruff args: ["--fix", "--show-fixes"] @@ -50,28 +27,7 @@ repos: rev: "v1.8.0" hooks: - id: mypy - files: src|tests - args: [] - additional_dependencies: - - pytest - - - repo: https://github.com/codespell-project/codespell - rev: "v2.2.6" - hooks: - - id: codespell - - - repo: https://github.com/shellcheck-py/shellcheck-py - rev: "v0.9.0.6" - hooks: - - id: shellcheck - - - repo: local - hooks: - - id: disallow-caps - name: Disallow improper capitalization - language: pygrep - entry: PyBind|Numpy|Cmake|CCache|Github|PyTest - exclude: .pre-commit-config.yaml + files: src - repo: https://github.com/abravalheri/validate-pyproject rev: "v0.16" @@ -84,4 +40,3 @@ repos: hooks: - id: check-dependabot - id: check-github-workflows - - id: check-readthedocs diff --git a/.readthedocs.yaml b/.readthedocs.yaml deleted file mode 100644 index 7e49657..0000000 --- a/.readthedocs.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# Read the Docs configuration file -# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details - -version: 2 - -build: - os: ubuntu-22.04 - tools: - python: "3.11" -sphinx: - configuration: docs/conf.py - -python: - install: - - method: pip - path: . - extra_requirements: - - docs diff --git a/README.md b/README.md index f5ec446..294b9e5 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,16 @@ # harmonwig [![Actions Status][actions-badge]][actions-link] -[![Documentation Status][rtd-badge]][rtd-link] - [![PyPI version][pypi-version]][pypi-link] [![Conda-Forge][conda-badge]][conda-link] [![PyPI platforms][pypi-platforms]][pypi-link] -[![GitHub Discussion][github-discussions-badge]][github-discussions-link] - [actions-badge]: https://github.com/ispg-group/harmonwig/workflows/CI/badge.svg [actions-link]: https://github.com/ispg-group/harmonwig/actions [conda-badge]: https://img.shields.io/conda/vn/conda-forge/harmonwig [conda-link]: https://github.com/conda-forge/harmonwig-feedstock -[github-discussions-badge]: https://img.shields.io/static/v1?label=Discussions&message=Ask&color=blue&logo=github -[github-discussions-link]: https://github.com/ispg-group/harmonwig/discussions [pypi-link]: https://pypi.org/project/harmonwig/ [pypi-platforms]: https://img.shields.io/pypi/pyversions/harmonwig [pypi-version]: https://img.shields.io/pypi/v/harmonwig -[rtd-badge]: https://readthedocs.org/projects/harmonwig/badge/?version=latest -[rtd-link]: https://harmonwig.readthedocs.io/en/latest/?badge=latest - diff --git a/pyproject.toml b/pyproject.toml index 6cb1bad..b379cb7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,6 @@ requires = ["flit_core>=3.4"] build-backend = "flit_core.buildapi" - [project] name = "harmonwig" authors = [ @@ -34,13 +33,10 @@ dynamic = ["version"] dependencies = [] [project.optional-dependencies] -test = [ - "pytest >=6", - "pytest-cov >=3", -] dev = [ - "pytest >=6", - "pytest-cov >=3", + "pytest ~= 7.0", + "pytest-cov >= 3", + "pre-commit", ] [project.urls] @@ -50,7 +46,6 @@ Changelog = "https://github.com/ispg-group/harmonwig/releases" [tool.pytest.ini_options] -minversion = "6.0" addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"] xfail_strict = true filterwarnings = [ @@ -71,7 +66,7 @@ report.exclude_also = [ [tool.mypy] files = ["src", "tests"] -python_version = "3.8" +python_version = "3.7" warn_unused_configs = true strict = true enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"] @@ -84,7 +79,6 @@ module = "harmonwig.*" disallow_untyped_defs = true disallow_incomplete_defs = true - [tool.ruff] src = ["src"] @@ -105,7 +99,6 @@ extend-select = [ "RET", # flake8-return "RUF", # Ruff-specific "SIM", # flake8-simplify - "T20", # flake8-print "UP", # pyupgrade "YTT", # flake8-2020 "EXE", # flake8-executable @@ -116,22 +109,3 @@ ignore = [ "PLR2004", # Magic value used in comparison "ISC001", # Conflicts with formatter ] -isort.required-imports = ["from __future__ import annotations"] - -[tool.ruff.lint.per-file-ignores] -"tests/**" = ["T20"] -"noxfile.py" = ["T20"] - - -[tool.pylint] -py-version = "3.8" -ignore-paths = [".*/_version.py"] -reports.output-format = "colorized" -similarities.ignore-imports = "yes" -messages_control.disable = [ - "design", - "fixme", - "line-too-long", - "missing-module-docstring", - "wrong-import-position", -] diff --git a/src/harmonwig/__init__.py b/src/harmonwig/__init__.py index cc27796..f1cef2d 100644 --- a/src/harmonwig/__init__.py +++ b/src/harmonwig/__init__.py @@ -3,8 +3,6 @@ harmonwig: Harmonic Wigner sampling from QM calculations. """ - - from __future__ import annotations __version__ = "0.1.0" diff --git a/tests/test_package.py b/tests/test_package.py index e45e6ae..834592e 100644 --- a/tests/test_package.py +++ b/tests/test_package.py @@ -2,8 +2,8 @@ import importlib.metadata -import harmonwig as m +import harmonwig def test_version(): - assert importlib.metadata.version("harmonwig") == m.__version__ + assert importlib.metadata.version("harmonwig") == harmonwig.__version__