Skip to content

Conversation

@Dargon789
Copy link
Owner

@Dargon789 Dargon789 commented Jan 25, 2026

Set up a GitHub Actions workflow for Python package using Conda, including steps for environment setup, dependency installation, linting, and testing.

What was wrong?

Related to Issue #
Closes #

How was it fixed?

Todo:

  • Clean up commit history
  • Add or update documentation related to these changes
  • Add entry to the release notes

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

Summary by Sourcery

CI:

  • Introduce a GitHub Actions workflow that sets up a Conda environment, installs dependencies, and runs flake8 linting and pytest on push events.

@gemini-code-assist
Copy link

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@sourcery-ai
Copy link

sourcery-ai bot commented Jan 25, 2026

Reviewer's Guide

Adds a new GitHub Actions workflow that runs on push to set up a Conda-based Python 3.10 environment, install dependencies from environment.yml, then run flake8 linting and pytest tests on Ubuntu.

Flow diagram for CI steps in Conda-based Python package workflow

flowchart TD
  Start["Push to repository"] --> TriggerWorkflow["Trigger workflow python-package-conda.yml"]
  TriggerWorkflow --> StartJob["Start job build-linux on ubuntu-latest"]

  StartJob --> StepCheckout["Checkout code (actions/checkout@v4)"]
  StepCheckout --> StepSetupPython["Set up Python 3.10 (actions/setup-python@v3)"]
  StepSetupPython --> StepAddConda["Add conda to system PATH"]
  StepAddConda --> StepCondaEnvUpdate["conda env update --file environment.yml --name base"]
  StepCondaEnvUpdate --> StepLint["Install flake8 and run flake8 checks"]
  StepLint --> StepTest["Install pytest and run pytest"]
  StepTest --> End["Job completes (success or failure)"]
Loading

File-Level Changes

Change Details Files
Introduce a Conda-based GitHub Actions CI workflow for linting and testing the Python package on push.
  • Create a workflow triggered on push that runs a single linux build job on ubuntu-latest with limited parallelism.
  • Set up Python 3.10 using actions/setup-python and expose the pre-installed Conda distribution to the PATH via $GITHUB_PATH.
  • Install project dependencies into the base Conda environment using environment.yml.
  • Run flake8 with a strict pass to catch syntax/undefined-name errors and a second, non-failing pass with complexity and line-length limits.
  • Install pytest in the Conda environment and execute the test suite.
.github/workflows/python-package-conda.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • Consider using the conda-incubator/setup-miniconda (or similar) action instead of manually echoing $CONDA/bin to $GITHUB_PATH, as it provides more robust environment setup and built-in caching support.
  • Right now flake8 and pytest are installed ad hoc in individual steps; you might want to move these into environment.yml (or a dedicated dev environment) so the workflow uses a single, reproducible environment solve.
  • The workflow is triggered on all push events; if you only need CI on main branches and/or PRs, consider narrowing the triggers (e.g., on: [push, pull_request] with branch filters) to avoid unnecessary runs.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider using the `conda-incubator/setup-miniconda` (or similar) action instead of manually echoing `$CONDA/bin` to `$GITHUB_PATH`, as it provides more robust environment setup and built-in caching support.
- Right now `flake8` and `pytest` are installed ad hoc in individual steps; you might want to move these into `environment.yml` (or a dedicated dev environment) so the workflow uses a single, reproducible environment solve.
- The workflow is triggered on all `push` events; if you only need CI on main branches and/or PRs, consider narrowing the triggers (e.g., `on: [push, pull_request]` with branch filters) to avoid unnecessary runs.

## Individual Comments

### Comment 1
<location> `.github/workflows/python-package-conda.yml:3` </location>
<code_context>
+name: Python Package using Conda
+
+on: [push]
+
+jobs:
</code_context>

<issue_to_address>
**suggestion (testing):** Triggering only on `push` omits validation for external pull requests

With only `push` configured, CI won’t run for forked PRs (and may not run before merge for internal PRs). To ensure changes are validated pre-merge, add a `pull_request` trigger (optionally restricted to specific branches).

```suggestion
on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Dargon789 and others added 2 commits January 25, 2026 15:11
Set up a GitHub Actions workflow for Python package using Conda, including steps for environment setup, dependency installation, linting, and testing.

Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com>
@Dargon789 Dargon789 merged commit 665c03d into main Jan 25, 2026
4 of 8 checks passed
@Dargon789 Dargon789 deleted the Dargon789-patch-1 branch January 25, 2026 08:15
@Dargon789 Dargon789 linked an issue Jan 25, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

# Sequence diagram for PR-triggered CI pipeline

2 participants