Skip to content

Commit

Permalink
Merge pull request #6 from Snowflake-Labs/conda-env-and-instructions
Browse files Browse the repository at this point in the history
Add Anaconda Support
  • Loading branch information
sfc-gh-jfreeberg authored Apr 11, 2023
2 parents 7079cda + 236f806 commit 8639aa6
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 35 deletions.
19 changes: 8 additions & 11 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,23 @@ env:
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
- name: Setup Conda
uses: conda-incubator/setup-[email protected]
with:
python-version: '3.8'
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-test.txt
activate-environment: snowpark
environment-file: environment.yml

- name: Run tests
run: python -m pytest

- name: Create deployment artifact
run: zip -r ${{ env.ARTIFACT_NAME }} . -x .git/\*
run: zip -r ${{ env.ARTIFACT_NAME }} . -x .git/\*

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v2
Expand Down
34 changes: 14 additions & 20 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,21 @@ env:
SNOWSQL_SCHEMA: ${{ secrets.SNOWSQL_SCHEMA }}
SNOWSQL_WAREHOUSE: ${{ secrets.SNOWSQL_WAREHOUSE }}

defaults:
run:
shell: bash -el {0}

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
- name: Setup Conda
uses: conda-incubator/setup-[email protected]
with:
python-version: '3.8'
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-test.txt
activate-environment: snowpark
environment-file: environment.yml

- name: Run tests
run: python -m pytest
Expand All @@ -42,18 +40,14 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
- name: Setup Conda
uses: conda-incubator/setup-[email protected]
with:
python-version: '3.8'
cache: 'pip'
activate-environment: snowpark
environment-file: environment.yml

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pylint
run: pip install pylint

- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py')
run: pylint $(git ls-files '*.py')
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,20 @@ using the System Properties menu (on Windows).

### Install dependencies

Set up a virtual environment using [Anaconda](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands) or [virtualenv](https://docs.python.org/3/library/venv.html). For example, the following command will create and activate a virtual environment named `venv`:
Set up a virtual environment using [Anaconda](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands) or [virtualenv](https://docs.python.org/3/library/venv.html).

#### Anaconda

```bash
python3 -m venv venv
source venv/bin/activate
conda env create -f environment.yml
conda activate snowpark
```

Next, import the packages in [requirements.txt](requirements.txt):
#### Virtualenv

```bash
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
```

Expand Down
14 changes: 14 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Snowpark environment file
# https://docs.snowflake.com/en/developer-guide/snowpark/python/setup.html

name: snowpark
channels:
- snowflake
dependencies:
- python=3.8
- pip
- snowflake-snowpark-python
- toml
- tomli
- pip:
- "-r requirements-test.txt"

0 comments on commit 8639aa6

Please sign in to comment.