From be17f3fd0c08eaf3c16bb243435a45983e56785e Mon Sep 17 00:00:00 2001 From: Harshil <37377066+harshil21@users.noreply.github.com> Date: Mon, 28 Jul 2025 02:13:34 -0700 Subject: [PATCH 1/7] Add copilot instructions and setup steps --- .github/copilot-instructions.md | 28 +++++++++++++++ .github/workflows/copilot-setup-steps.yml | 42 +++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 .github/copilot-instructions.md create mode 100644 .github/workflows/copilot-setup-steps.yml diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 00000000000..0f29c7e2bac --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,28 @@ +This is a python project which is a wrapper for the Telegram Bot API. Please read the contributing +guidelines mentioned in .github/CONTRIBUTING.rst to know how to contribute to this project. + +### Development Environment: + +Your development environment is set up using `uv`, a tool for managing Python environments and dependencies. +Your environment has all extra dependencies and groups installed, on Python 3.13. Please continue using `uv` for managing your development environment, +and for any scripts or tools you need to run. + +Some example commands on `uv`: +- `uv sync --all-extras --all-groups` to install all dependencies and groups required by the project. +- `uv run -p 3.14 --all-groups --all-extras tests/` to run tests on a specific Python version. Please use the `-p` flag often. +- `uv pip install ` to install a package in the current environment. + +If uv is somehow not available, you can install it using `pip install uv`. + +### Repository Structure: + +The repository follows a standard structure for Python projects. Here are some key directories and files: + +- `src/`: This directory contains the main source code for the project. +- `tests/`: This directory contains test cases for the project. +- `pyproject.toml`: This file contains the project metadata and dependencies. +- `.github/`: This directory contains GitHub-specific files, including workflows and issue templates. + +### Pull Requests: + +When you create a pull request, please also add the appropriate labels to it. diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml new file mode 100644 index 00000000000..e4522500942 --- /dev/null +++ b/.github/workflows/copilot-setup-steps.yml @@ -0,0 +1,42 @@ +name: "Copilot Setup Steps" + +# Automatically run the setup steps when they are changed to allow for easy validation, and +# allow manual testing through the repository's "Actions" tab +on: + workflow_dispatch: + pull_request: + paths: + - .github/workflows/copilot-setup-steps.yml + +jobs: + # The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot. + copilot-setup-steps: + runs-on: ubuntu-latest + + # Set the permissions to the lowest permissions possible needed for your steps. + # Copilot will be given its own token for its operations. + permissions: + # If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete. + contents: write # TEST: `uv` wasn't installed after the workflow succeded, maybe this is needed? + pull-requests: write # So copilot can add labels to the PR + + # You can define any steps you want, and they will run before the agent starts. + # If you do not check out your code, Copilot will do this for you. + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v6 + with: + # Install a specific version of uv. + version: "0.8.3" + + - name: Set up Python + run: uv python install 3.13 + + - name: Install the project + run: uv sync --all-extras --all-groups + + - name: Install linting dependencies + run: uv pip install black isort mypy flake8 ruff From 53e30820fffe005800415ed955c9e3e07e10b68b Mon Sep 17 00:00:00 2001 From: harshil21 <37377066+harshil21@users.noreply.github.com> Date: Mon, 28 Jul 2025 09:22:47 +0000 Subject: [PATCH 2/7] Add chango fragment for PR #4884 --- changes/unreleased/4884.ADcdCj6GrMaKffYSLzWdsL.toml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changes/unreleased/4884.ADcdCj6GrMaKffYSLzWdsL.toml diff --git a/changes/unreleased/4884.ADcdCj6GrMaKffYSLzWdsL.toml b/changes/unreleased/4884.ADcdCj6GrMaKffYSLzWdsL.toml new file mode 100644 index 00000000000..11023165c12 --- /dev/null +++ b/changes/unreleased/4884.ADcdCj6GrMaKffYSLzWdsL.toml @@ -0,0 +1,5 @@ +other = "Add copilot instructions and setup steps" +[[pull_requests]] +uid = "4884" +author_uid = "harshil21" +closes_threads = [] From b54a854c2defdc15ea77c0d4ce01c5406c266da4 Mon Sep 17 00:00:00 2001 From: Harshil <37377066+harshil21@users.noreply.github.com> Date: Mon, 28 Jul 2025 16:44:10 -0700 Subject: [PATCH 3/7] Review: comments, version pinning, latest sha --- .github/copilot-instructions.md | 13 ++++++++++++- .github/workflows/copilot-setup-steps.yml | 12 +++++++----- changes/unreleased/4884.ADcdCj6GrMaKffYSLzWdsL.toml | 2 +- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 0f29c7e2bac..1237d05e2b6 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -1,5 +1,6 @@ This is a python project which is a wrapper for the Telegram Bot API. Please read the contributing -guidelines mentioned in .github/CONTRIBUTING.rst to know how to contribute to this project. +guidelines mentioned in .github/CONTRIBUTING.rst to know how to contribute to this project. The +README.rst file lists the features and usage of the project. ### Development Environment: @@ -23,6 +24,16 @@ The repository follows a standard structure for Python projects. Here are some k - `pyproject.toml`: This file contains the project metadata and dependencies. - `.github/`: This directory contains GitHub-specific files, including workflows and issue templates. + +### Things to keep in mind while coding: + +- Ensure that your code is properly and fully typed. All your code should be compatible from + Python 3.9 to 3.14. Don't use the `typing_extensions` module. +- Read the stability guide mentioned at docs/source/stability_policy.rst to understand if your changes + are breaking or incompatible. +- Try to make sure your code is asyncio-friendly and thread-safe. +- Run `uv run pre-commit` to run pre-commit hooks before committing your changes. + ### Pull Requests: When you create a pull request, please also add the appropriate labels to it. diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index e4522500942..cc6bdea1a18 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -1,3 +1,5 @@ +# This file is for the copilot agent on Github. This helps to set up the development environment +# See the docs here: https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment#preinstalling-tools-or-dependencies-in-copilots-environment name: "Copilot Setup Steps" # Automatically run the setup steps when they are changed to allow for easy validation, and @@ -24,19 +26,19 @@ jobs: # If you do not check out your code, Copilot will do this for you. steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Install uv uses: astral-sh/setup-uv@v6 with: # Install a specific version of uv. version: "0.8.3" - - - name: Set up Python - run: uv python install 3.13 + # Install 3.13: + python-version: 3.13 - name: Install the project run: uv sync --all-extras --all-groups - name: Install linting dependencies - run: uv pip install black isort mypy flake8 ruff + # Make sure the pinned versions here match the ones in .pre-commit-config.yaml + run: uv pip install black==25.1.0 isort==6.0.1 mypy==1.16.1 flake8==7.3.0 ruff==0.12.2 diff --git a/changes/unreleased/4884.ADcdCj6GrMaKffYSLzWdsL.toml b/changes/unreleased/4884.ADcdCj6GrMaKffYSLzWdsL.toml index 11023165c12..fa0d9fe3ecb 100644 --- a/changes/unreleased/4884.ADcdCj6GrMaKffYSLzWdsL.toml +++ b/changes/unreleased/4884.ADcdCj6GrMaKffYSLzWdsL.toml @@ -1,4 +1,4 @@ -other = "Add copilot instructions and setup steps" +internal = "Add Copilot Instructions and Setup Steps" [[pull_requests]] uid = "4884" author_uid = "harshil21" From 60bcc77657c389c9c26017fecdc638b2ba2f6ee0 Mon Sep 17 00:00:00 2001 From: Harshil <37377066+harshil21@users.noreply.github.com> Date: Mon, 28 Jul 2025 16:49:00 -0700 Subject: [PATCH 4/7] Pin setup-uv version in workflow --- .github/workflows/copilot-setup-steps.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index cc6bdea1a18..7ce442b698b 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -29,7 +29,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Install uv - uses: astral-sh/setup-uv@v6 + uses: astral-sh/setup-uv@v6.4.3 with: # Install a specific version of uv. version: "0.8.3" From fdc7ede8873eff9db3b6771ac59e5bb6739e0836 Mon Sep 17 00:00:00 2001 From: Harshil <37377066+harshil21@users.noreply.github.com> Date: Mon, 28 Jul 2025 16:53:56 -0700 Subject: [PATCH 5/7] Pin setup-uv version as a sha --- .github/workflows/copilot-setup-steps.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 7ce442b698b..0f43c04c67c 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -29,7 +29,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Install uv - uses: astral-sh/setup-uv@v6.4.3 + uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc with: # Install a specific version of uv. version: "0.8.3" From e430ff7cd8cdd47e5cccfc5bd9f05a68d0a29b36 Mon Sep 17 00:00:00 2001 From: Harshil <37377066+harshil21@users.noreply.github.com> Date: Wed, 30 Jul 2025 16:15:25 -0700 Subject: [PATCH 6/7] Review: zizmor, update instructions --- .github/copilot-instructions.md | 3 ++- .github/workflows/copilot-setup-steps.yml | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 1237d05e2b6..c49d0fab45f 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -32,7 +32,8 @@ The repository follows a standard structure for Python projects. Here are some k - Read the stability guide mentioned at docs/source/stability_policy.rst to understand if your changes are breaking or incompatible. - Try to make sure your code is asyncio-friendly and thread-safe. -- Run `uv run pre-commit` to run pre-commit hooks before committing your changes. +- Run `uv run pre-commit` to run pre-commit hooks before committing your changes, but after `git add`ing them. +- Make sure you always test your changes. Either update or write new tests in the `tests/` directory. ### Pull Requests: diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 0f43c04c67c..43e32514f5a 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -27,6 +27,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false - name: Install uv uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc From b1d6c309cfcd3fff977332c1a7d30ef5f7e7ce33 Mon Sep 17 00:00:00 2001 From: Harshil <37377066+harshil21@users.noreply.github.com> Date: Wed, 6 Aug 2025 13:27:45 -0700 Subject: [PATCH 7/7] Review: Change back contents from write to read --- .github/workflows/copilot-setup-steps.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 43e32514f5a..bf082c40ad9 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -19,7 +19,7 @@ jobs: # Copilot will be given its own token for its operations. permissions: # If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete. - contents: write # TEST: `uv` wasn't installed after the workflow succeded, maybe this is needed? + contents: read pull-requests: write # So copilot can add labels to the PR # You can define any steps you want, and they will run before the agent starts. pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy