diff --git a/.JuliaFormatter.toml b/.JuliaFormatter.toml new file mode 100644 index 0000000..b31d4a0 --- /dev/null +++ b/.JuliaFormatter.toml @@ -0,0 +1,3 @@ +indent = 4 +margin = 92 +normalize_line_endings = "unix" diff --git a/.copier-answers.yml b/.copier-answers.yml new file mode 100644 index 0000000..18ae745 --- /dev/null +++ b/.copier-answers.yml @@ -0,0 +1,25 @@ +# Changes here will be overwritten by Copier +AddAllcontributors: false +AddCodeOfConduct: true +AddContributionDocs: false +AddCopierCI: false +AddGitHubTemplates: true +AddMacToCI: true +AddPrecommit: true +AddWinToCI: true +AnswerStrategy: ask +Authors: Tilman Hinnerichs +AutoIncludeTests: true +CodeOfConductContact: t.r.hinnerichs@tudelft.nl +Indentation: 4 +JuliaMinCIVersion: '1.8' +JuliaMinVersion: '1.8' +License: MIT +LicenseCopyrightHolders: Herb-AI +PackageName: HerbSpecification +PackageOwner: Herb-AI +PackageUUID: 6d54aada-062f-46d8-85cf-a1ceaf058a06 +RunJuliaNightlyOnCI: true +UseCirrusCI: false +_commit: v0.10.1 +_src_path: https://github.com/abelsiqueira/BestieTemplate.jl diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..d014236 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,10 @@ +# https://editorconfig.org +root = true + +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +indent_size = 4 +indent_style = space +trim_trailing_whitespace = true diff --git a/.github/ISSUE_TEMPLATE/10-bug-report.yml b/.github/ISSUE_TEMPLATE/10-bug-report.yml new file mode 100644 index 0000000..82139a2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/10-bug-report.yml @@ -0,0 +1,63 @@ +name: Bug Report +description: File a bug report related to running the package +title: "[Bug] " +labels: ["bug"] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! + + Please, before submitting, make sure that: + + - There is not an [existing issue](https://github.com/Herb-AI/HerbSpecification.jl/issues) with the same question + + + - You are following the [code of conduct](https://github.com/Herb-AI/HerbSpecification.jl/blob/main/CODE_OF_CONDUCT.md) + + + The form below should help you in filling out this issue. + - type: textarea + id: description + attributes: + label: Description + description: Describe the bug + validations: + required: true + - type: input + id: pkg-version + attributes: + label: Package Version + description: What version of the package are you running? + validations: + required: true + - type: input + id: version + attributes: + label: Julia Version + description: What version of Julia are you running? + validations: + required: true + - type: textarea + id: reproduction + attributes: + label: Reproduction steps + description: What steps led to the bug happening? Please provide a minimal reproducible example. + validations: + required: true + - type: textarea + id: logs + attributes: + label: Relevant log output + description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. + render: shell + - type: dropdown + id: os + attributes: + label: "Operating System" + description: What is the impacted environment? + multiple: true + options: + - Windows + - Linux + - Mac diff --git a/.github/ISSUE_TEMPLATE/20-feature-request.yml b/.github/ISSUE_TEMPLATE/20-feature-request.yml new file mode 100644 index 0000000..47f6f81 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/20-feature-request.yml @@ -0,0 +1,44 @@ +name: "Feature Request" +description: Suggest a new feature for the package +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this feature request! + + Please, before submitting, make sure that: + + - There is not an [existing issue](https://github.com/Herb-AI/HerbSpecification.jl/issues) with the same question + + + - You are following the [code of conduct](https://github.com/Herb-AI/HerbSpecification.jl/blob/main/CODE_OF_CONDUCT.md) + + + The form below should help you in filling out this issue. + - type: textarea + id: description + attributes: + label: Description + description: Describe the requested feature + validations: + required: true + - type: textarea + id: validation + attributes: + label: Validation and testing + description: How could we verify that the new feature works? What kind of tests can be done? + - type: textarea + id: motivation + attributes: + label: Motivation + description: Explain why this feature is relevant + - type: textarea + id: target + attributes: + label: Target audience + description: Tell more about the users of this feature, or where it could be useful + - type: textarea + id: can-help + attributes: + label: Can you help? + description: Can you help developing this feature? diff --git a/.github/ISSUE_TEMPLATE/30-usage.yml b/.github/ISSUE_TEMPLATE/30-usage.yml new file mode 100644 index 0000000..bdfbaa5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/30-usage.yml @@ -0,0 +1,26 @@ +name: "Usage question" +description: Questions related to the usage +labels: ["documentation"] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this question! + + Please, before submitting, make sure that: + + - You have checked the [documentation](https://Herb-AI.github.io/HerbSpecification.jl) and haven't found enough information + - There is not an [existing issue](https://github.com/Herb-AI/HerbSpecification.jl/issues) with the same question + + + - You are following the [code of conduct](https://github.com/Herb-AI/HerbSpecification.jl/blob/main/CODE_OF_CONDUCT.md) + + + The form below should help you in filling out this issue. + - type: textarea + id: description + attributes: + label: Description + description: Write your question + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/99-general.yml b/.github/ISSUE_TEMPLATE/99-general.yml new file mode 100644 index 0000000..5c25334 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/99-general.yml @@ -0,0 +1,24 @@ +name: "General issue" +description: In case none of the others templates apply +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this issue! + + Please, before submitting, make sure that: + + - There is not an [existing issue](https://github.com/Herb-AI/HerbSpecification.jl/issues) with the same question + + + - You are following the [code of conduct](https://github.com/Herb-AI/HerbSpecification.jl/blob/main/CODE_OF_CONDUCT.md) + + + The form below should help you in filling out this issue. + - type: textarea + id: description + attributes: + label: Description + description: Describe the issue + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..1d5a70b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: Discussions + url: https://github.com/Herb-AI/HerbSpecification.jl/discussions + about: Create and follow discussions here diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..ac5138a --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,29 @@ + + +## Related issues + + + + +Closes # + + + + +## Checklist + + + + +- [ ] Tests are passing +- [ ] Lint workflow is passing +- [ ] Docs were updated and workflow is passing diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..6191d27 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" # Location of package manifests + schedule: + interval: "weekly" diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 04d73b9..e124f53 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,43 +1,42 @@ name: CI on: - push: - branches: - - master - tags: ['*'] - pull_request: + push: + branches: + - master + tags: ["*"] + pull_request: concurrency: - # Skip intermediate builds: always. - # Cancel intermediate builds: only if it is a pull request build. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} jobs: - test: - name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - version: - - '1.8' - - '1' - - 'nightly' - os: - - ubuntu-latest - arch: - - x64 - steps: - - uses: actions/checkout@v3 - - uses: julia-actions/setup-julia@v1 - with: - version: ${{ matrix.version }} - arch: ${{ matrix.arch }} - - uses: julia-actions/cache@v1 - - uses: julia-actions/julia-buildpkg@v1 - - uses: julia-actions/julia-runtest@v1 - - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: lcov.info - fail_ci_if_error: false - + test: + name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + version: + - "1.8" + - "1" + - "nightly" + os: + - ubuntu-latest + arch: + - x64 + steps: + - uses: actions/checkout@v3 + - uses: julia-actions/setup-julia@v1 + with: + version: ${{ matrix.version }} + arch: ${{ matrix.arch }} + - uses: julia-actions/cache@v1 + - uses: julia-actions/julia-buildpkg@v1 + - uses: julia-actions/julia-runtest@v1 + - uses: julia-actions/julia-processcoverage@v1 + - uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: lcov.info + fail_ci_if_error: false diff --git a/.github/workflows/CompatHelper.yml b/.github/workflows/CompatHelper.yml index cba9134..9681eb6 100644 --- a/.github/workflows/CompatHelper.yml +++ b/.github/workflows/CompatHelper.yml @@ -1,16 +1,51 @@ +# CompatHelper v3.5.0 name: CompatHelper + on: - schedule: - - cron: 0 0 * * * - workflow_dispatch: + schedule: + - cron: 0 0 * * * # Every day at 00:00 UTC + workflow_dispatch: + +permissions: + contents: write + pull-requests: write + jobs: - CompatHelper: - runs-on: ubuntu-latest - steps: - - name: Pkg.add("CompatHelper") - run: julia -e 'using Pkg; Pkg.add("CompatHelper")' - - name: CompatHelper.main() - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }} - run: julia -e 'using CompatHelper; CompatHelper.main()' + CompatHelper: + runs-on: ubuntu-latest + steps: + - name: Check if Julia is already available in the PATH + id: julia_in_path + run: which julia + continue-on-error: true + - name: Install Julia, but only if it is not already available in the PATH + uses: julia-actions/setup-julia@v2 + with: + version: "1" + arch: ${{ runner.arch }} + if: steps.julia_in_path.outcome != 'success' + - name: Use Julia cache + uses: julia-actions/cache@v2 + - name: "Add the General registry via Git" + run: | + import Pkg + ENV["JULIA_PKG_SERVER"] = "" + Pkg.Registry.add("General") + shell: julia --color=yes {0} + - name: "Install CompatHelper" + run: | + import Pkg + name = "CompatHelper" + uuid = "aa819f21-2bde-4658-8897-bab36330d9b7" + version = "3" + Pkg.add(; name, uuid, version) + shell: julia --color=yes {0} + - name: "Run CompatHelper" + run: | + import CompatHelper + CompatHelper.main() + shell: julia --color=yes {0} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }} + # COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_PRIV }} diff --git a/.github/workflows/Lint.yml b/.github/workflows/Lint.yml new file mode 100644 index 0000000..366b9d4 --- /dev/null +++ b/.github/workflows/Lint.yml @@ -0,0 +1,56 @@ +name: Lint + +on: + push: + branches: + - main + tags: ["*"] + pull_request: + +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + +jobs: + lint: + name: Linting + runs-on: ubuntu-latest + steps: + - name: Clone + uses: actions/checkout@v4 + - name: Setup Julia + uses: julia-actions/setup-julia@v2 + with: + version: "1" + - name: Use Julia cache + uses: julia-actions/cache@v2 + - name: Install JuliaFormatter.jl + run: julia -e 'using Pkg; pkg"add JuliaFormatter"' + - name: Setup Python + uses: actions/setup-python@v5 + with: + cache: "pip" + - name: Cache pre-commit + uses: actions/cache@v4 + with: + path: ~/.cache/pre-commit + key: ${{ runner.os }}-pre-commit-${{ hashFiles('**/.pre-commit-config.yaml') }} + - name: Install pre-commit + run: pip install pre-commit + - name: Run pre-commit + run: SKIP=no-commit-to-branch pre-commit run -a + + link-checker: + name: Link checker + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Link Checker + id: lychee + uses: lycheeverse/lychee-action@v1 + with: + fail: true + args: --config '.lychee.toml' . diff --git a/.github/workflows/PreCommitUpdate.yml b/.github/workflows/PreCommitUpdate.yml new file mode 100644 index 0000000..eab08c2 --- /dev/null +++ b/.github/workflows/PreCommitUpdate.yml @@ -0,0 +1,35 @@ +name: pre-commit Update + +on: + schedule: + - cron: "0 7 1/7 * *" # At 7:00 every 7 days + workflow_dispatch: + +jobs: + pre-commit-update: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + cache: pip + - name: Install pre-commit + run: pip install pre-commit + - name: Run pre-commit's autoupdate + run: | + # ignore exit code + pre-commit autoupdate || true + - name: Create Pull Request + id: cpr + uses: peter-evans/create-pull-request@v7 + with: + commit-message: "chore: :robot: pre-commit update" + title: "[AUTO] pre-commit update" + branch: auto-pre-commit-update + delete-branch: true + labels: chore + - name: Check outputs + run: | + echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" + echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" diff --git a/.github/workflows/ReusableTest.yml b/.github/workflows/ReusableTest.yml new file mode 100644 index 0000000..800fec3 --- /dev/null +++ b/.github/workflows/ReusableTest.yml @@ -0,0 +1,52 @@ +name: Reusable test + +on: + workflow_call: + inputs: + version: + required: false + type: string + default: "1" + os: + required: false + type: string + default: ubuntu-latest + arch: + required: false + type: string + default: x64 + allow_failure: + required: false + type: boolean + default: false + run_codecov: + required: false + type: boolean + default: false + secrets: + codecov_token: + required: true + +jobs: + test: + name: Julia ${{ inputs.version }} - ${{ inputs.os }} - ${{ inputs.arch }} - ${{ github.event_name }} + runs-on: ${{ inputs.os }} + continue-on-error: ${{ inputs.allow_failure }} + + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: ${{ inputs.version }} + arch: ${{ inputs.arch }} + - name: Use Julia cache + uses: julia-actions/cache@v2 + - uses: julia-actions/julia-buildpkg@v1 + - uses: julia-actions/julia-runtest@v1 + - uses: julia-actions/julia-processcoverage@v1 + if: ${{ inputs.run_codecov }} + - uses: codecov/codecov-action@v4 + if: ${{ inputs.run_codecov }} + with: + file: lcov.info + token: ${{ secrets.codecov_token }} diff --git a/.github/workflows/TagBot.yml b/.github/workflows/TagBot.yml index 2bacdb8..08fc8b8 100644 --- a/.github/workflows/TagBot.yml +++ b/.github/workflows/TagBot.yml @@ -1,31 +1,37 @@ name: TagBot + on: - issue_comment: - types: - - created - workflow_dispatch: - inputs: - lookback: - default: 3 + issue_comment: + types: + - created + workflow_dispatch: + inputs: + lookback: + type: number + default: 3 + permissions: - actions: read - checks: read - contents: write - deployments: read - issues: read - discussions: read - packages: read - pages: read - pull-requests: read - repository-projects: read - security-events: read - statuses: read + actions: read + checks: read + contents: write + deployments: read + issues: read + discussions: read + packages: read + pages: read + pull-requests: read + repository-projects: read + security-events: read + statuses: read + jobs: - TagBot: - if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' - runs-on: ubuntu-latest - steps: - - uses: JuliaRegistries/TagBot@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - ssh: ${{ secrets.DOCUMENTER_KEY }} + TagBot: + if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' + runs-on: ubuntu-latest + steps: + - uses: JuliaRegistries/TagBot@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + # Edit the following line to reflect the actual name of the GitHub Secret containing your private key + ssh: ${{ secrets.DOCUMENTER_KEY }} + # ssh: ${{ secrets.NAME_OF_MY_SSH_PRIVATE_KEY_SECRET }} diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml new file mode 100644 index 0000000..1e3bb04 --- /dev/null +++ b/.github/workflows/Test.yml @@ -0,0 +1,47 @@ +name: Test + +on: + push: + branches: + - main + tags: ["*"] + workflow_dispatch: + +jobs: + test: + uses: ./.github/workflows/ReusableTest.yml + with: + os: ${{ matrix.os }} + version: ${{ matrix.version }} + arch: ${{ matrix.arch }} + allow_failure: ${{ matrix.allow_failure }} + run_codecov: ${{ matrix.version == '1' && matrix.os == 'ubuntu-latest' }} + secrets: + codecov_token: ${{ secrets.CODECOV_TOKEN }} + strategy: + fail-fast: false + matrix: + version: + - "1.8" + - "1" + os: + - ubuntu-latest + - macOS-latest + - windows-latest + arch: + - x64 + allow_failure: [false] + + include: + - version: "nightly" + os: ubuntu-latest + arch: x64 + allow_failure: true + - version: "nightly" + os: macOS-latest + arch: x64 + allow_failure: true + - version: "nightly" + os: windows-latest + arch: x64 + allow_failure: true diff --git a/.github/workflows/TestOnPRs.yml b/.github/workflows/TestOnPRs.yml new file mode 100644 index 0000000..db46eef --- /dev/null +++ b/.github/workflows/TestOnPRs.yml @@ -0,0 +1,29 @@ +name: Test on PRs + +on: + pull_request: + branches: + - main + paths: + - "src/**" + - "test/**" + - "*.toml" + types: [opened, synchronize, reopened] + +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + +jobs: + test: + uses: ./.github/workflows/ReusableTest.yml + with: + os: ubuntu-latest + version: "1" + arch: x64 + allow_failure: false + run_codecov: true + secrets: + codecov_token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.gitignore b/.gitignore index 29126e4..4d3d00e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,24 +1,12 @@ -# Files generated by invoking Julia with --code-coverage -*.jl.cov *.jl.*.cov - -# Files generated by invoking Julia with --track-allocation +*.jl.cov *.jl.mem - -# System-specific files and directories generated by the BinaryProvider and BinDeps packages -# They contain absolute paths specific to the host computer, and so should not be committed -deps/deps.jl -deps/build.log -deps/downloads/ -deps/usr/ -deps/src/ - -# Build artifacts for creating documentation generated by the Documenter package -docs/build/ -docs/site/ - -# File generated by Pkg, the package manager, based on a corresponding Project.toml -# It records a fixed state of all packages used by the project. As such, it should not be -# committed for packages, but should be committed for applications that require a static -# environment. +*.rej +.DS_Store +.benchmarkci Manifest.toml +benchmark/*.json +coverage +docs/build/ +env +node_modules diff --git a/.lychee.toml b/.lychee.toml new file mode 100644 index 0000000..1ed71e9 --- /dev/null +++ b/.lychee.toml @@ -0,0 +1,11 @@ +exclude = [ + "@ref", + "^https://github.com/.*/releases/tag/v.*$", + "^https://doi.org/FIXME$", + "^https://Herb-AI.github.io/HerbSpecification.jl/stable$", + "zenodo.org/badge/DOI/FIXME$" +] + +exclude_path = [ + "docs/build" +] diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 0000000..a2c3868 --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,13 @@ +{ + "MD007": { + "indent": 4, + "start_indented": false + }, + "MD013": { + "line_length": 1000, + "tables": false + }, + "MD033": false, + "MD041": false, + "default": true +} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..8210811 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,49 @@ +repos: + - repo: local + hooks: + # Prevent committing .rej files + - id: forbidden-files + name: forbidden files + entry: found Copier update rejection files; review them and remove them + language: fail + files: "\\.rej$" + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: check-json + - id: check-toml + - id: check-yaml + - id: end-of-file-fixer + - id: file-contents-sorter + files: .JuliaFormatter.toml + args: [--unique] + - id: mixed-line-ending + args: [--fix=lf] + - id: no-commit-to-branch + - id: pretty-format-json + args: [--autofix, --indent=4] + - id: trailing-whitespace + - id: check-merge-conflict + args: [--assume-in-merge] + - repo: https://github.com/igorshubovych/markdownlint-cli + rev: v0.41.0 + hooks: + - id: markdownlint-fix + - repo: https://github.com/citation-file-format/cffconvert + rev: 054bda51dbe278b3e86f27c890e3f3ac877d616c + hooks: + - id: validate-cff + - repo: https://github.com/pre-commit/mirrors-prettier + rev: "v4.0.0-alpha.8" # Use the sha or tag you want to point at + hooks: + - id: prettier + types_or: [yaml, json] + exclude: ".copier-answers.yml" + - repo: https://github.com/adrienverge/yamllint + rev: v1.35.1 + hooks: + - id: yamllint + - repo: https://github.com/domluna/JuliaFormatter.jl + rev: v1.0.60 + hooks: + - id: julia-formatter diff --git a/.yamllint.yml b/.yamllint.yml new file mode 100644 index 0000000..ffeab4b --- /dev/null +++ b/.yamllint.yml @@ -0,0 +1,2 @@ +rules: + indentation: { spaces: 4 } diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..2131fee --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,133 @@ + +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or advances of + any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email address, + without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official email address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement: +`t.r.hinnerichs@tudelft.nl`. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.1, available at +[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at +[https://www.contributor-covenant.org/translations][translations]. + +[homepage]: https://www.contributor-covenant.org +[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html +[Mozilla CoC]: https://github.com/mozilla/diversity +[FAQ]: https://www.contributor-covenant.org/faq +[translations]: https://www.contributor-covenant.org/translations diff --git a/LICENCE.md b/LICENSE similarity index 97% rename from LICENCE.md rename to LICENSE index 07267c1..d498d46 100644 --- a/LICENCE.md +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 Herb-AI +Copyright (c) 2024 Herb-AI 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/README.md b/README.md index 330cc80..33629b5 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,16 @@ -# HerbSpecification.jl +# HerbSpecification -[![codecov](https://codecov.io/github/Herb-AI/HerbConstraints.jl/graph/badge.svg?token=IJXWCVZ3XZ)](https://codecov.io/github/Herb-AI/HerbConstraints.jl) -[![Build Status](https://github.com/Herb-AI/HerbSpecification.jl/actions/workflows/CI.yml/badge.svg?branch=master)](https://github.com/Herb-AI/HerbSpecification.jl/actions/workflows/CI.yml?query=branch%3Amaster) +[![Stable Documentation](https://img.shields.io/badge/docs-stable-blue.svg)](https://Herb-AI.github.io/HerbSpecification.jl/stable) +[![In development documentation](https://img.shields.io/badge/docs-dev-blue.svg)](https://Herb-AI.github.io/HerbSpecification.jl/dev) +[![Build Status](https://github.com/Herb-AI/HerbSpecification.jl/workflows/Test/badge.svg)](https://github.com/Herb-AI/HerbSpecification.jl/actions) +[![Test workflow status](https://github.com/Herb-AI/HerbSpecification.jl/actions/workflows/Test.yml/badge.svg?branch=main)](https://github.com/Herb-AI/HerbSpecification.jl/actions/workflows/Test.yml?query=branch%3Amain) +[![Lint workflow Status](https://github.com/Herb-AI/HerbSpecification.jl/actions/workflows/Lint.yml/badge.svg?branch=main)](https://github.com/Herb-AI/HerbSpecification.jl/actions/workflows/Lint.yml?query=branch%3Amain) +[![Docs workflow Status](https://github.com/Herb-AI/HerbSpecification.jl/actions/workflows/Docs.yml/badge.svg?branch=main)](https://github.com/Herb-AI/HerbSpecification.jl/actions/workflows/Docs.yml?query=branch%3Amain) -This package describes the types of specification to define program synthesis problems within the `Herb.jl` Program Synthesis framework. +[![Coverage](https://codecov.io/gh/Herb-AI/HerbSpecification.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/Herb-AI/HerbSpecification.jl) +[![DOI](https://zenodo.org/badge/DOI/FIXME)](https://doi.org/FIXME) +[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md) -For full documentation please see the `Herb.jl` documentation. +## How to Cite +If you use HerbSpecification.jl in your work, please cite using the reference given in [CITATION.cff](https://github.com/Herb-AI/HerbSpecification.jl/blob/main/CITATION.cff). diff --git a/src/HerbSpecification.jl b/src/HerbSpecification.jl index b44ea7b..9813202 100644 --- a/src/HerbSpecification.jl +++ b/src/HerbSpecification.jl @@ -2,18 +2,13 @@ module HerbSpecification include("problem.jl") -export - Problem, +export Problem, MetricProblem, AbstractSpecification, - IOExample, - AbstractFormalSpecification, SMTSpecification, - Trace, - AbstractTypeSpecification, DependentTypeSpecification, AgdaSpecification diff --git a/src/problem.jl b/src/problem.jl index f95f3f9..567f5fd 100644 --- a/src/problem.jl +++ b/src/problem.jl @@ -6,14 +6,14 @@ An input-output example. `out` can be anything. """ struct IOExample - in::Dict{Symbol, Any} + in::Dict{Symbol,Any} out::Any end """ struct Trace -A trace defining a wanted program execution for program synthesis. +A trace defining a wanted program execution for program synthesis. @TODO combine with Gen.jl """ struct Trace @@ -44,13 +44,18 @@ abstract type AbstractDependentTypeSpecification <: AbstractTypeSpecification en """ struct AgdaSpecification <: AbstractDependentTypeSpecification -Defines a specification +Defines a specification """ struct AgdaSpecification <: AbstractDependentTypeSpecification formula::Function end -const AbstractSpecification = Union{Vector{IOExample}, AbstractFormalSpecification, Vector{Trace}, AbstractTypeSpecification} +const AbstractSpecification = Union{ + Vector{IOExample}, + AbstractFormalSpecification, + Vector{Trace}, + AbstractTypeSpecification, +} """ struct Problem @@ -58,16 +63,16 @@ const AbstractSpecification = Union{Vector{IOExample}, AbstractFormalSpecificati Program synthesis problem defined by an [`AbstractSpecification`](@ref)s. Has a name and a specification of type `T`. !!! warning - Please care that concrete `Problem` types with different values of `T` are never subtypes of each other. + Please care that concrete `Problem` types with different values of `T` are never subtypes of each other. """ -struct Problem{T <: AbstractSpecification} +struct Problem{T<:AbstractSpecification} name::AbstractString spec::T - function Problem(spec::T) where T <: AbstractSpecification + function Problem(spec::T) where {T<:AbstractSpecification} new{T}("", spec) end - function Problem(name::AbstractString, spec::T) where T <: AbstractSpecification + function Problem(name::AbstractString, spec::T) where {T<:AbstractSpecification} new{T}(name, spec) end end @@ -77,16 +82,20 @@ end Program synthesis problem defined by an specification and a metric. The specification has to be based on input/output examples, while the function needs to return a numerical value. """ -struct MetricProblem{T <: Vector{IOExample}} +struct MetricProblem{T<:Vector{IOExample}} name::AbstractString cost_function::Function spec::T - function MetricProblem(cost_function::Function, spec::T) where T<:Vector{IOExample} + function MetricProblem(cost_function::Function, spec::T) where {T<:Vector{IOExample}} new{T}("", cost_function, spec) end - function MetricProblem(name::AbstractString, cost_function::Function, spec::T) where T<:Vector{IOExample} + function MetricProblem( + name::AbstractString, + cost_function::Function, + spec::T, + ) where {T<:Vector{IOExample}} new{T}(name, cost_function, spec) end @@ -100,5 +109,3 @@ Overwrite `Base.getindex` to allow for slicing of input/output-based problems. """ Base.getindex(p::Problem{Vector{IOExample}}, indices) = Problem(p.spec[indices]) Base.getindex(p::MetricProblem{Vector{IOExample}}, indices) = Problem(p.spec[indices]) - - diff --git a/test/Project.toml b/test/Project.toml new file mode 100644 index 0000000..0c36332 --- /dev/null +++ b/test/Project.toml @@ -0,0 +1,2 @@ +[deps] +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/test/runtests.jl b/test/runtests.jl index 45608d0..ac4c444 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,6 +1,22 @@ using HerbSpecification using Test -@testset "HerbSpecification.jl" verbose=true begin - include("test_ioproblem.jl") + +#= +Don't add your tests to runtests.jl. Instead, create files named + + test-title-for-my-test.jl + +The file will be automatically included inside a `@testset` with title "Title For My Test". +=# +for (root, dirs, files) in walkdir(@__DIR__) + for file in files + if isnothing(match(r"^test-.*\.jl$", file)) + continue + end + title = titlecase(replace(splitext(file[6:end])[1], "-" => " ")) + @testset "$title" begin + include(file) + end + end end diff --git a/test/test-basic-test.jl b/test/test-basic-test.jl new file mode 100644 index 0000000..96dff59 --- /dev/null +++ b/test/test-basic-test.jl @@ -0,0 +1,3 @@ +@testset "HerbSpecification.jl" begin + @test HerbSpecification.hello_world() == "Hello, World!" +end diff --git a/test/test_ioproblem.jl b/test/test_ioproblem.jl index d1befb5..17b8ed7 100644 --- a/test/test_ioproblem.jl +++ b/test/test_ioproblem.jl @@ -11,7 +11,10 @@ end # Tests for Problem @testset "Problem Tests" begin # Create a vector of IOExample instances as specification - spec = [IOExample(Dict(:var1 => 1, :var2 => 2), 3), IOExample(Dict(:var1 => 4, :var2 => 5), 6)] + spec = [ + IOExample(Dict(:var1 => 1, :var2 => 2), 3), + IOExample(Dict(:var1 => 4, :var2 => 5), 6), + ] # Test constructor without a name problem1 = Problem(spec)