diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml new file mode 100644 index 0000000..9991fde --- /dev/null +++ b/.github/workflows/quality.yml @@ -0,0 +1,21 @@ +name: Code Quality + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + code-quality-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ vars.CI_PYTHON_VERSION }} + + - name: Run pre-commit + uses: pre-commit/action@v3.0.1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..08c2a76 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,72 @@ +name: Release Package + +on: + push: + tags: + - '[0-9]+.[0-9]+.[0-9]+*' + +jobs: + release-build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + + - name: Verify current tag is on main branch + run: | + # Exit with error if current tag is not on main + git merge-base --is-ancestor ${{ github.sha }} origin/main || exit 1 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ vars.CI_PYTHON_VERSION }} + + - name: Install Poetry + uses: abatilo/actions-poetry@v3 + with: + poetry-version: ${{ vars.CI_POETRY_VERSION }} + + - name: Install Poetry plugins + run: | + poetry self add "poetry-dynamic-versioning[plugin]" + + - name: Build package + run: | + poetry build + ls -la dist/ + + - name: Upload distributions + uses: actions/upload-artifact@v4 + with: + name: release-dists + path: dist/ + retention-days: 1 + + pypi-publish: + runs-on: ubuntu-latest + + needs: + - release-build + + permissions: + id-token: write + + environment: + name: pypi + url: https://pypi.org/project/freeact-skills + + steps: + - name: Retrieve release distributions + uses: actions/download-artifact@v4 + with: + name: release-dists + path: dist/ + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + verbose: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..2af6375 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,45 @@ +name: Tests + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Cache conda + uses: actions/cache@v4 + env: + CACHE_NUMBER: 0 + with: + path: ~/conda_pkgs_dir + key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }} + + - name: Setup Conda + uses: conda-incubator/setup-miniconda@v3 + with: + auto-update-conda: true + environment-file: environment.yml + + - name: Install Poetry + uses: abatilo/actions-poetry@v3 + with: + poetry-version: ${{ vars.CI_POETRY_VERSION }} + + - name: Install dependencies + shell: bash -l {0} + run: | + poetry env info + poetry install --all-extras + pip list + + - name: Run tests + shell: bash -l {0} + run: | + poetry run pytest -s tests diff --git a/.github/workflows/test_package.yml b/.github/workflows/test_package.yml new file mode 100644 index 0000000..69d7a63 --- /dev/null +++ b/.github/workflows/test_package.yml @@ -0,0 +1,101 @@ +name: Package Installation Tests + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + package-build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ vars.CI_PYTHON_VERSION }} + + - name: Install Poetry + uses: abatilo/actions-poetry@v3 + with: + poetry-version: ${{ vars.CI_POETRY_VERSION }} + + - name: Install Poetry plugins + run: | + poetry self add "poetry-dynamic-versioning[plugin]" + + - name: Build package + run: | + poetry build + + - name: Upload dist artifacts + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ + retention-days: 1 + + package-test: + needs: package-build + + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + python-version: ['3.11', '3.12'] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Download package + uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + + - name: Test wheel installation (Windows) + if: runner.os == 'Windows' + shell: pwsh + run: | + $wheel = Get-ChildItem dist/*.whl | Select-Object -First 1 + pip install $wheel + python -c "import freeact_skills" + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + pip uninstall -y freeact-skills + + - name: Test wheel installation (Unix) + if: runner.os != 'Windows' + run: | + pip install dist/*.whl + python -c "import freeact_skills" + pip uninstall -y freeact-skills + + - name: Test tarball installation (Windows) + if: runner.os == 'Windows' + shell: pwsh + run: | + $tarball = Get-ChildItem dist/*.tar.gz | Select-Object -First 1 + pip install $tarball + python -c "import freeact_skills" + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + pip uninstall -y freeact-skills + + - name: Test tarball installation (Unix) + if: runner.os != 'Windows' + run: | + pip install dist/*.tar.gz + python -c "import freeact_skills" + pip uninstall -y freeact-skills diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..042ee68 --- /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 at +[info@gradion.ai](mailto:info@gradion.ai). +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/CONTRIBUTING.md b/CONTRIBUTING.md index aecbf04..ff12c7e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,39 +1,115 @@ -**This guide is work in progress ...** + +# Contributing to freeact-skills -Clone the repository: +First off, thanks for taking the time to contribute! :heart: -```bash -git clone https://github.com/gradion-ai/freeact-skills.git -cd freeact-skills -``` +All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. :tada: -Create a new Conda environment and activate it: +> And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about: +> - Star the project :star: +> - Tweet about it +> - Refer this project in your project's readme +> - Mention the project at local meetups and tell your friends/colleagues -```bash -conda env create -f environment.yml -conda activate freeact-skills -``` + +## Table of Contents -Install dependencies with Poetry: +- [Code of Conduct](#book-code-of-conduct) +- [Your First Code Contribution](#rocket-your-first-code-contribution) +- [Asking Questions](#bulb-asking-questions) +- [Opening an Issue](#inbox_tray-opening-an-issue) +- [Bug Reports and Other Issues](#beetle-bug-reports-and-other-issues) +- [Feature Requests](#love_letter-feature-requests) +- [Submitting Pull Requests](#repeat-submitting-pull-requests) +- [Join The Project Team](#people_holding_hands-join-the-project-team) +- [Credits](#pray-credits) -```bash -poetry install --all-extras --with docs -``` +## :book: Code of Conduct -Install pre-commit hooks: +Please review our [Code of Conduct](CODE_OF_CONDUCT.md). It is in effect at all times. We expect it to be honored by everyone who contributes to this project. Please report unacceptable behavior to [info@gradion.ai](mailto:info@gradion.ai). -```bash -invoke precommit-install -``` +## :rocket: Your First Code Contribution -Enforce coding conventions (done automatically by pre-commit hooks): +Read the [development guide](DEVELOPMENT.md) to set up your development environment and get started with the codebase. -```bash -invoke cc -``` +## :bulb: Asking Questions -Run tests: +> If you want to ask a question, we assume that you have read the available [Documentation](https://gradion-ai.github.io/freeact-skills/). -```bash -pytest -s tests -``` +Before you ask a question, it is best to search for existing [Issues](https://github.com/gradion-ai/freeact-skills/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first. + +If you then still feel the need to ask a question and need clarification, we recommend the following: + +- Open an [Issue](https://github.com/gradion-ai/freeact-skills/issues/new). +- Provide as much context as you can about what you're running into. +- Provide project and platform versions (nodejs, npm, etc), depending on what seems relevant. + +We will then take care of the issue as soon as possible. + +## :inbox_tray: Opening an Issue + +Before [creating an issue](https://help.github.com/en/github/managing-your-work-on-github/creating-an-issue), check if you are using the latest version of the project. If you are not up-to-date, see if updating fixes your issue first. + +### :beetle: Bug Reports and Other Issues + +A great way to contribute to the project is to send a detailed issue when you encounter a problem. We always appreciate a well-written, thorough bug report. :v: + +In short, since you are most likely a developer, **provide a ticket that you would like to receive**. + +- **Review the [documentation](https://gradion-ai.github.io/freeact-skills/)** before opening a new issue. + +- **Do not open a duplicate issue!** Search through existing issues to see if your issue has previously been reported. If your issue exists, comment with any additional information you have. + +- **Prefer using [reactions](https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/)**, not comments, if you simply want to "+1" an existing issue. + +- **Provide all the information we need to quickly and efficiently address your issue.** Be clear, concise, and descriptive. Provide as much information as you can, including steps to reproduce, stack traces, compiler errors, library versions, OS versions, and screenshots (if applicable). + +- **Use [GitHub-flavored Markdown](https://help.github.com/en/github/writing-on-github/basic-writing-and-formatting-syntax).** Especially put code blocks and console outputs in backticks (```). This improves readability. + +## :love_letter: Feature Requests + +Feature requests are welcome! While we will consider all requests, we cannot guarantee your request will be accepted. Your idea may be great, but also out-of-scope for the project. If accepted, we cannot make any commitments regarding the timeline for implementation and release. However, you are welcome to submit a pull request to help! + +- **Do not open a duplicate feature request.** Search for existing feature requests first. If you find your feature (or one very similar) previously requested, comment on that issue. + +- **Fully complete the provided issue template.** The feature request template asks for all necessary information for us to begin a productive conversation. + +- Be precise about the proposed outcome of the feature and how it relates to existing features. Include implementation details if possible. + +## :repeat: Submitting Pull Requests + +We :heart: pull requests! Before [forking the repo](https://help.github.com/en/github/getting-started-with-github/fork-a-repo) and [creating a pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/proposing-changes-to-your-work-with-pull-requests) for non-trivial changes, it is usually best to first open an issue to discuss the changes, or discuss your intended approach for solving the problem in the comments for an existing issue. + +*Note: All contributions will be licensed under the project's license.* + +- **Smaller is better.** Submit **one** pull request per bug fix or feature. A pull request should contain isolated changes pertaining to a single bug fix or feature implementation. **Do not** refactor or reformat code that is unrelated to your change. It is better to **submit many small pull requests** rather than a single large one. Enormous pull requests will take enormous amounts of time to review, or may be rejected altogether. + +- **Coordinate bigger changes.** For large and non-trivial changes, open an issue to discuss a strategy with the maintainers. Otherwise, you risk doing a lot of work for nothing! + +- **Prioritize understanding over cleverness.** Write code clearly and concisely. Remember that source code usually gets written once and read often. Ensure the code is clear to the reader. The purpose and logic should be obvious to a reasonably skilled developer, otherwise you should add a comment that explains it. + +- **Follow existing coding style and conventions.** Keep your code consistent with the style, formatting, and conventions in the rest of the code base. When possible, these will be enforced with a linter. Consistency makes it easier to review and modify in the future. + +- **Include test coverage.** Add tests when possible. Follow existing patterns for implementing tests. + +- **Update the example project** if one exists to exercise any new functionality you have added. + +- **Add documentation.** Document your changes with code doc comments or in existing guides. + +- **Use the repo's default branch.** Branch from and [submit your pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork) to the repo's default branch `main`. + +- **[Resolve any merge conflicts](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/resolving-a-merge-conflict-on-github)** that occur. + +- **Promptly address any CI failures**. If your pull request fails to build or pass tests, please push another commit to fix it. + +## :people_holding_hands: Join The Project Team + +We are always looking for motivated individuals to join our team as maintainers! If you have been actively contributing to freeact-skills and would like to take on a more significant role, we'd love to have you on board. + +Please reach out to the current maintainers at [info@gradion.ai](mailto:info@gradion.ai). We look forward to collaborating with you! + +## :pray: Credits + +This guide was heavily inspired by [jessesquires contributing guide](https://github.com/jessesquires/.github/blob/main/CONTRIBUTING.md) and [contributing-gen](https://github.com/bttger/contributing-gen). + +We thank these projects for providing excellent resources. diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md new file mode 100644 index 0000000..5d326b9 --- /dev/null +++ b/DEVELOPMENT.md @@ -0,0 +1,47 @@ +# Development Guide + +This guide provides instructions for setting up a development environment for `freeact-skills`. Follow these steps to get started with development, testing, and contributing to the project. + +Clone the repository: + +```bash +git clone https://github.com/gradion-ai/freeact-skills.git +cd freeact-skills +``` + +Create a new Conda environment and activate it: + +```bash +conda env create -f environment.yml +conda activate freeact-skills +``` + +Install the poetry dynamic versioning plugin: + +```bash +poetry self add "poetry-dynamic-versioning[plugin]" +``` + +Install dependencies with Poetry: + +```bash +poetry install --all-extras --with docs +``` + +Install pre-commit hooks: + +```bash +invoke precommit-install +``` + +Enforce coding conventions (done automatically by pre-commit hooks): + +```bash +invoke cc +``` + +Run tests: + +```bash +pytest -s tests +``` diff --git a/pyproject.toml b/pyproject.toml index 48ae965..8f4834f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,10 @@ [build-system] -requires = ["poetry-core>=1.0.0"] -build-backend = "poetry.core.masonry.api" +requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"] +build-backend = "poetry_dynamic_versioning.backend" [tool.poetry] name = "freeact-skills" -version = "0.0.6" +version = "0.0.0" description = "Library of predefined freeact agent skills" homepage = "https://github.com/gradion-ai/freeact-skills" readme = "README.md" @@ -84,3 +84,9 @@ module = [ "yaml" ] ignore_missing_imports = true + +[tool.poetry-dynamic-versioning] +enable = true +vcs = "git" +pattern = "default-unprefixed" +style = "pep440"