Skip to content

Create python-package-conda.yml#14

Open
gantulu wants to merge 1 commit intosaifalisew1508:mainfrom
gantulu:main
Open

Create python-package-conda.yml#14
gantulu wants to merge 1 commit intosaifalisew1508:mainfrom
gantulu:main

Conversation

@gantulu
Copy link
Copy Markdown

@gantulu gantulu commented Aug 29, 2024

Summary by Sourcery

Introduce a GitHub Actions workflow to automate the build and test process for a Python package using Conda, including setting up Python 3.10, installing dependencies, linting with flake8, and running tests with pytest.

CI:

  • Add a new GitHub Actions workflow for building and testing a Python package using Conda on Ubuntu.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Aug 29, 2024

Reviewer's Guide by Sourcery

This pull request adds a new GitHub Actions workflow file for Python package testing using Conda. The workflow is set up to run on push events, install dependencies from an environment.yml file, perform linting with flake8, and run tests with pytest.

File-Level Changes

Change Details Files
Add a new GitHub Actions workflow for Python package testing with Conda
  • Set up the workflow to run on push events
  • Configure the job to run on ubuntu-latest with Python 3.10
  • Add Conda to the system path
  • Install dependencies from an environment.yml file
  • Perform linting with flake8
  • Run tests with pytest
.github/workflows/python-package-conda.yml

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link
Copy Markdown

@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 @gantulu - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider triggering this workflow on pull requests as well as pushes to catch issues earlier in the development process.
  • Implement dependency caching to speed up subsequent workflow runs. GitHub Actions provides built-in support for caching Conda environments.
Here's what I looked at during the review
  • 🟡 General issues: 3 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

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 to tell me if it was helpful.

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion (performance): Consider using a more recent Python version

Python 3.10 is not the latest version. Consider using a more recent version like 3.11 or 3.12 for potential performance improvements and new features, or explain the specific reason for choosing 3.10.

Suggested change
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: '3.12'

@@ -0,0 +1,34 @@
name: Python Package using Conda

on: [push]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion (performance): Consider using more specific workflow triggers

Triggering the workflow on every push might lead to unnecessary builds for larger repositories. Consider using more specific triggers, such as pushes to specific branches or pull requests, to optimize resource usage.

Suggested change
on: [push]
on:
push:
branches: [main, develop]
pull_request:
branches: [main]

run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Install dependencies
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion (performance): Implement caching for the Conda environment

Consider implementing caching for the Conda environment. This could significantly speed up the workflow, especially for larger projects with many dependencies.

Suggested change
- name: Install dependencies
- name: Cache Conda environment
uses: actions/cache@v2
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ hashFiles('environment.yml') }}
restore-keys: |
${{ runner.os }}-conda-
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'

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.

1 participant