mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2026-06-19 07:35:19 +00:00
Add GitHub Copilot Instructions and Setup Steps (#4884)
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
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. The
|
||||
README.rst file lists the features and usage of the 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 <package>` 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.
|
||||
|
||||
|
||||
### 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, 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:
|
||||
|
||||
When you create a pull request, please also add the appropriate labels to it.
|
||||
@@ -0,0 +1,46 @@
|
||||
# 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
|
||||
# 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: 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.
|
||||
# If you do not check out your code, Copilot will do this for you.
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc
|
||||
with:
|
||||
# Install a specific version of uv.
|
||||
version: "0.8.3"
|
||||
# Install 3.13:
|
||||
python-version: 3.13
|
||||
|
||||
- name: Install the project
|
||||
run: uv sync --all-extras --all-groups
|
||||
|
||||
- name: Install linting dependencies
|
||||
# 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
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Add Copilot Instructions and Setup Steps"
|
||||
[[pull_requests]]
|
||||
uid = "4884"
|
||||
author_uid = "harshil21"
|
||||
closes_threads = []
|
||||
Reference in New Issue
Block a user