diff --git a/.copier-answers.yml b/.copier-answers.yml index 79cefd63..46199b64 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: v2.0.1 +_commit: v2.0.3 _src_path: gh:lincc-frameworks/python-project-template author_email: brantd@uw.edu author_name: LINCC Frameworks diff --git a/.github/ISSUE_TEMPLATE/1-bug_report.md b/.github/ISSUE_TEMPLATE/1-bug_report.md index 220a63d6..16b6b711 100644 --- a/.github/ISSUE_TEMPLATE/1-bug_report.md +++ b/.github/ISSUE_TEMPLATE/1-bug_report.md @@ -13,5 +13,5 @@ assignees: '' Please check the following: - [ ] I have described the situation in which the bug arose, including what code was executed, information about my environment, and any applicable data others will need to reproduce the problem. -- [ ] I have included available evidence of the unexpected behavior (including error messages, screenshots, and/or plots) as well as a descriprion of what I expected instead. -- [ ] If I have a solution in mind, I have provided an explanation and/or pseudocode and/or task list. \ No newline at end of file +- [ ] I have included available evidence of the unexpected behavior (including error messages, screenshots, and/or plots) as well as a description of what I expected instead. +- [ ] If I have a solution in mind, I have provided an explanation and/or pseudocode and/or task list. diff --git a/.github/README.md b/.github/README.md new file mode 100644 index 00000000..5fe2a015 --- /dev/null +++ b/.github/README.md @@ -0,0 +1,23 @@ +# The .github directory + +This directory contains various configurations and .yml files that are used to +define GitHub actions and behaviors. + +## Workflows + +The .yml files in ``./workflows`` are used to define the various continuous +integration scripts that will be run on your behalf e.g. nightly as a smoke check, +or when you create a new PR. + +For more information about CI and workflows, look here: https://lincc-ppt.readthedocs.io/en/latest/practices/ci.html + +## Configurations + +Templates for various different issue types are defined in ``./ISSUE_TEMPLATE`` +and a pull request template is defined as ``pull_request_template.md``. Adding, +removing, and modifying these templates to suit the needs of your project is encouraged. + +For more information about these templates, look here: https://lincc-ppt.readthedocs.io/en/latest/practices/issue_pr_templating.html + + +Or if you still have questions contact us: https://lincc-ppt.readthedocs.io/en/latest/source/contact.html \ No newline at end of file diff --git a/.github/workflows/asv-main.yml b/.github/workflows/asv-main.yml index f6a6f297..32c25cf5 100644 --- a/.github/workflows/asv-main.yml +++ b/.github/workflows/asv-main.yml @@ -1,7 +1,6 @@ # This workflow will run benchmarks with airspeed velocity (asv), # store the new results in the "benchmarks" branch and publish them # to a dashboard on GH Pages. - name: Run ASV benchmarks for main on: @@ -10,92 +9,60 @@ on: env: PYTHON_VERSION: "3.10" - WORKING_DIR: ${{ github.workspace }}/benchmarks + ASV_VERSION: "0.6.4" + WORKING_DIR: ${{github.workspace}}/benchmarks concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{github.workflow}}-${{github.ref}} cancel-in-progress: true jobs: - - setup-python: - runs-on: ubuntu-latest - - steps: - - name: Cache Python ${{ env.PYTHON_VERSION }} - uses: actions/cache@v4 - with: - path: ~/.cache/pip - key: python-${{ env.PYTHON_VERSION }} - - - name: Set up Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@v5 - with: - python-version: "${{ env.PYTHON_VERSION }}" - asv-main: runs-on: ubuntu-latest - needs: setup-python - permissions: contents: write - defaults: run: - working-directory: ${{ env.WORKING_DIR }} - + working-directory: ${{env.WORKING_DIR}} steps: - - name: Checkout main branch of the repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Cache Python ${{ env.PYTHON_VERSION }} - uses: actions/cache@v4 - with: - path: ~/.cache/pip - key: python-${{ env.PYTHON_VERSION }} - - - name: Install dependencies - run: | - sudo apt-get update - python -m pip install --upgrade pip - pip install asv==0.6.1 virtualenv tabulate - - - name: Configure git - run: | - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - - - name: Create ASV machine config file - run: asv machine --machine gh-runner --yes - - - name: Fetch previous results from the "benchmarks" branch - run: | - if git ls-remote --exit-code origin benchmarks > /dev/null 2>&1; then - git merge origin/benchmarks \ - --allow-unrelated-histories \ - --no-commit - mv ../_results . - fi - - - name: Run ASV for the main branch - run: asv run ALL --skip-existing --verbose || true - - - name: Submit new results to the "benchmarks" branch - uses: JamesIves/github-pages-deploy-action@v4 - with: - branch: benchmarks - folder: ${{ env.WORKING_DIR }}/_results - target-folder: _results - - - name: Generate dashboard HTML - run: | - asv show - asv publish - - - name: Deploy to Github pages - uses: JamesIves/github-pages-deploy-action@v4 - with: - branch: gh-pages - folder: ${{ env.WORKING_DIR }}/_html \ No newline at end of file + - name: Set up Python ${{env.PYTHON_VERSION}} + uses: actions/setup-python@v5 + with: + python-version: ${{env.PYTHON_VERSION}} + - name: Checkout main branch of the repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install dependencies + run: pip install "asv[virtualenv]==${{env.ASV_VERSION}}" + - name: Configure git + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + - name: Create ASV machine config file + run: asv machine --machine gh-runner --yes + - name: Fetch previous results from the "benchmarks" branch + run: | + if git ls-remote --exit-code origin benchmarks > /dev/null 2>&1; then + git merge origin/benchmarks \ + --allow-unrelated-histories \ + --no-commit + mv ../_results . + fi + - name: Run ASV for the main branch + run: asv run ALL --skip-existing --verbose || true + - name: Submit new results to the "benchmarks" branch + uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: benchmarks + folder: ${{env.WORKING_DIR}}/_results + target-folder: _results + - name: Generate dashboard HTML + run: | + asv show + asv publish + - name: Deploy to Github pages + uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: gh-pages + folder: ${{env.WORKING_DIR}}/_html \ No newline at end of file diff --git a/.github/workflows/asv-nightly.yml b/.github/workflows/asv-nightly.yml index 80a2d785..28b270ae 100644 --- a/.github/workflows/asv-nightly.yml +++ b/.github/workflows/asv-nightly.yml @@ -1,7 +1,6 @@ # This workflow will run daily at 06:45. # It will run benchmarks with airspeed velocity (asv) # and compare performance with the previous nightly build. - name: Run benchmarks nightly job on: @@ -11,83 +10,63 @@ on: env: PYTHON_VERSION: "3.10" - WORKING_DIR: ${{ github.workspace }}/benchmarks + ASV_VERSION: "0.6.4" + WORKING_DIR: ${{github.workspace}}/benchmarks NIGHTLY_HASH_FILE: nightly-hash jobs: - asv-nightly: runs-on: ubuntu-latest - defaults: run: - working-directory: ${{ env.WORKING_DIR }} - + working-directory: ${{env.WORKING_DIR}} steps: - - name: Checkout main branch of the repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Cache Python ${{ env.PYTHON_VERSION }} - uses: actions/cache@v4 - with: - path: ~/.cache/pip - key: python-${{ env.PYTHON_VERSION }} - - - name: Set up Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@v5 - with: - python-version: "${{ env.PYTHON_VERSION }}" - - - name: Install dependencies - run: | - sudo apt-get update - python -m pip install --upgrade pip - pip install asv==0.6.1 virtualenv - - - name: Configure git - run: | - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - - - name: Create ASV machine config file - run: asv machine --machine gh-runner --yes - - - name: Fetch previous results from the "benchmarks" branch - run: | - if git ls-remote --exit-code origin benchmarks > /dev/null 2>&1; then - git merge origin/benchmarks \ - --allow-unrelated-histories \ - --no-commit - mv ../_results . - fi - - - name: Get nightly dates under comparison - id: nightly-dates - run: | - echo "yesterday=$(date -d yesterday +'%Y-%m-%d')" >> $GITHUB_OUTPUT - echo "today=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT - - - name: Use last nightly commit hash from cache - uses: actions/cache@v4 - with: - path: ${{ env.WORKING_DIR }} - key: nightly-results-${{ steps.nightly-dates.outputs.yesterday }} - - - name: Run comparison of main against last nightly build - run: | - HASH_FILE=${{ env.NIGHTLY_HASH_FILE }} - CURRENT_HASH=${{ github.sha }} - if [ -f $HASH_FILE ]; then - PREV_HASH=$(cat $HASH_FILE) - asv continuous $PREV_HASH $CURRENT_HASH --verbose || true - asv compare $PREV_HASH $CURRENT_HASH --sort ratio --verbose - fi - echo $CURRENT_HASH > $HASH_FILE - - - name: Update last nightly hash in cache - uses: actions/cache@v4 - with: - path: ${{ env.WORKING_DIR }} - key: nightly-results-${{ steps.nightly-dates.outputs.today }} \ No newline at end of file + - name: Set up Python ${{env.PYTHON_VERSION}} + uses: actions/setup-python@v5 + with: + python-version: ${{env.PYTHON_VERSION}} + - name: Checkout main branch of the repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install dependencies + run: pip install "asv[virtualenv]==${{env.ASV_VERSION}}" + - name: Configure git + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + - name: Create ASV machine config file + run: asv machine --machine gh-runner --yes + - name: Fetch previous results from the "benchmarks" branch + run: | + if git ls-remote --exit-code origin benchmarks > /dev/null 2>&1; then + git merge origin/benchmarks \ + --allow-unrelated-histories \ + --no-commit + mv ../_results . + fi + - name: Get nightly dates under comparison + id: nightly-dates + run: | + echo "yesterday=$(date -d yesterday +'%Y-%m-%d')" >> $GITHUB_OUTPUT + echo "today=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT + - name: Use last nightly commit hash from cache + uses: actions/cache@v4 + with: + path: ${{env.WORKING_DIR}} + key: nightly-results-${{steps.nightly-dates.outputs.yesterday}} + - name: Run comparison of main against last nightly build + run: | + HASH_FILE=${{env.NIGHTLY_HASH_FILE}} + CURRENT_HASH=${{github.sha}} + if [ -f $HASH_FILE ]; then + PREV_HASH=$(cat $HASH_FILE) + asv continuous $PREV_HASH $CURRENT_HASH --verbose || true + asv compare $PREV_HASH $CURRENT_HASH --sort ratio --verbose + fi + echo $CURRENT_HASH > $HASH_FILE + - name: Update last nightly hash in cache + uses: actions/cache@v4 + with: + path: ${{env.WORKING_DIR}} + key: nightly-results-${{steps.nightly-dates.outputs.today}} \ No newline at end of file diff --git a/.github/workflows/asv-pr.yml b/.github/workflows/asv-pr.yml index bf5aed6d..4499eb9f 100644 --- a/.github/workflows/asv-pr.yml +++ b/.github/workflows/asv-pr.yml @@ -11,76 +11,60 @@ on: workflow_dispatch: concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{github.workflow}}-${{github.ref}} cancel-in-progress: true env: PYTHON_VERSION: "3.10" - WORKING_DIR: ${{ github.workspace }}/benchmarks - ARTIFACTS_DIR: ${{ github.workspace }}/artifacts + ASV_VERSION: "0.6.4" + WORKING_DIR: ${{github.workspace}}/benchmarks + ARTIFACTS_DIR: ${{github.workspace}}/artifacts jobs: - setup-python: - runs-on: ubuntu-latest - steps: - - name: Cache Python ${{ env.PYTHON_VERSION }} - uses: actions/cache@v4 - with: - path: ~/.cache/pip - key: python-${{ env.PYTHON_VERSION }} - - name: Set up Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@v5 - with: - python-version: ${{ env.PYTHON_VERSION }} asv-pr: runs-on: ubuntu-latest - needs: setup-python defaults: run: - working-directory: ${{ env.WORKING_DIR }} + working-directory: ${{env.WORKING_DIR}} steps: + - name: Set up Python ${{env.PYTHON_VERSION}} + uses: actions/setup-python@v5 + with: + python-version: ${{env.PYTHON_VERSION}} - name: Checkout PR branch of the repository uses: actions/checkout@v4 with: fetch-depth: 0 - name: Display Workflow Run Information run: | - echo "Workflow Run ID: ${{ github.run_id }}" - - name: Cache Python ${{ env.PYTHON_VERSION }} - uses: actions/cache@v4 - with: - path: ~/.cache/pip - key: python-${{ env.PYTHON_VERSION }} + echo "Workflow Run ID: ${{github.run_id}}" - name: Install dependencies - run: | - sudo apt-get update - python -m pip install --upgrade pip - pip install asv==0.6.1 virtualenv tabulate lf-asv-formatter + run: pip install "asv[virtualenv]==${{env.ASV_VERSION}}" lf-asv-formatter - name: Make artifacts directory - run: mkdir -p ${{ env.ARTIFACTS_DIR }} + run: mkdir -p ${{env.ARTIFACTS_DIR}} - name: Save pull request number - run: echo ${{ github.event.pull_request.number }} > ${{ env.ARTIFACTS_DIR }}/pr + run: echo ${{github.event.pull_request.number}} > ${{env.ARTIFACTS_DIR}}/pr - name: Get current job logs URL uses: Tiryoh/gha-jobid-action@v1 id: jobs with: - github_token: ${{ secrets.GITHUB_TOKEN }} - job_name: ${{ github.job }} + github_token: ${{secrets.GITHUB_TOKEN}} + job_name: ${{github.job}} - name: Create ASV machine config file run: asv machine --machine gh-runner --yes - name: Save comparison of PR against main branch run: | - git remote add upstream https://github.com/${{ github.repository }}.git + git remote add upstream https://github.com/${{github.repository}}.git git fetch upstream asv continuous upstream/main HEAD --verbose || true asv compare upstream/main HEAD --sort ratio --verbose | tee output - python -m lf_asv_formatter --asv_version "$(echo asv --version)" + python -m lf_asv_formatter --asv_version "$(asv --version | awk '{print $2}')" printf "\n\nClick [here]($STEP_URL) to view all benchmarks." >> output - mv output ${{ env.ARTIFACTS_DIR }} + mv output ${{env.ARTIFACTS_DIR}} env: - STEP_URL: "${{ steps.jobs.outputs.html_url }}#step:11:1" + STEP_URL: ${{steps.jobs.outputs.html_url}}#step:10:1 - name: Upload artifacts (PR number and benchmarks output) uses: actions/upload-artifact@v4 with: name: benchmark-artifacts - path: ${{ env.ARTIFACTS_DIR }} \ No newline at end of file + path: ${{env.ARTIFACTS_DIR}} \ No newline at end of file diff --git a/.github/workflows/build-documentation.yml b/.github/workflows/build-documentation.yml index 638e7b6e..f19c5ef6 100644 --- a/.github/workflows/build-documentation.yml +++ b/.github/workflows/build-documentation.yml @@ -1,3 +1,4 @@ + # This workflow will install Python dependencies, build the package and then build the documentation. name: Build documentation diff --git a/.github/workflows/pre-commit-ci.yml b/.github/workflows/pre-commit-ci.yml index 86560a8f..533fca3a 100644 --- a/.github/workflows/pre-commit-ci.yml +++ b/.github/workflows/pre-commit-ci.yml @@ -1,3 +1,4 @@ + # This workflow runs pre-commit hooks on pushes and pull requests to main # to enforce coding style. To ensure correct configuration, please refer to: # https://lincc-ppt.readthedocs.io/en/latest/practices/ci_precommit.html diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index f7cecc2e..2cbf586a 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -1,3 +1,4 @@ + # This workflow will upload a Python Package using Twine when a release is created # For more information see: https://github.com/pypa/gh-action-pypi-publish#trusted-publishing diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0d038012..98297ab1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,9 +1,10 @@ + repos: # Compare the local template version to the latest remote template version # This hook should always pass. It will print a message if the local version # is out of date. - repo: https://github.com/lincc-frameworks/pre-commit-hooks - rev: v0.1.1 + rev: v0.1.2 hooks: - id: check-lincc-frameworks-template-version name: Check template version @@ -16,6 +17,7 @@ repos: name: Clear output from Jupyter notebooks description: Clear output from Jupyter notebooks. files: \.ipynb$ + exclude: ^docs/pre_executed stages: [commit] language: system entry: jupyter nbconvert --clear-output diff --git a/.readthedocs.yml b/.readthedocs.yml index 79bfc272..b58534b2 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,3 +1,4 @@ + # .readthedocs.yml # Read the Docs configuration file # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details diff --git a/LICENSE b/LICENSE index 7ac99174..1f4f3328 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 LINCC Frameworks +Copyright (c) 2024 LINCC Frameworks Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/benchmarks/README.md b/benchmarks/README.md new file mode 100644 index 00000000..5259778b --- /dev/null +++ b/benchmarks/README.md @@ -0,0 +1,12 @@ +# Benchmarks + +This directory contains files that will be run via continuous testing either +nightly or after committing code to a pull request. + +The runtime and/or memory usage of the functions defined in these files will be +tracked and reported to give you a sense of the overall performance of your code. + +You are encouraged to add, update, or remove benchmark functions to suit the needs +of your project. + +For more information, see the documentation here: https://lincc-ppt.readthedocs.io/en/latest/practices/ci_benchmarking.html \ No newline at end of file diff --git a/benchmarks/asv.conf.json b/benchmarks/asv.conf.json index ae5caba8..6d9df1b5 100644 --- a/benchmarks/asv.conf.json +++ b/benchmarks/asv.conf.json @@ -1,3 +1,4 @@ + { // The version of the config file format. Do not change, unless // you know what you are doing. diff --git a/docs/conf.py b/docs/conf.py index 422bd671..b5252eaa 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -15,7 +15,7 @@ # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information project = "nested-pandas" -copyright = "2023, LINCC Frameworks" +copyright = "2024, LINCC Frameworks" author = "LINCC Frameworks" release = version("nested-pandas") # for example take major/minor diff --git a/docs/index.rst b/docs/index.rst index 0bc5cd9e..b46bfe2c 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,3 +1,4 @@ + .. nested_pandas documentation main file. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. diff --git a/pyproject.toml b/pyproject.toml index 49c273df..1760a582 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,4 @@ + [project] name = "nested-pandas" license = {file = "LICENSE"} @@ -28,7 +29,7 @@ dependencies = [ # On a mac, install optional dependencies with `pip install '.[dev]'` (include the single quotes) [project.optional-dependencies] dev = [ - "asv==0.6.3", # Used to compute performance benchmarks + "asv==0.6.4", # Used to compute performance benchmarks "jupyter", # Clears output from Jupyter notebooks "mypy", # Used for static type checking of files "pre-commit", # Used to run checks before finalizing a git commit @@ -92,6 +93,7 @@ select = [ "D300", "D417", "D419", + # Numpy v2.0 compatibility "NPY201", ]