Skip to content

Commit c887782

Browse files
authored
Updated pycsep requirements for pip installation & ga using pip (#250)
* ga: added build test from pypi * build: Added Dockerfile for a container installation * ga: reverted branch ga test to upstream ga only * docs: updated and sync'd readme and docs with the installation guide using correct dependencies * updated manifest
1 parent b3895d1 commit c887782

File tree

5 files changed

+85
-23
lines changed

5 files changed

+85
-23
lines changed

Diff for: .github/workflows/build-test.yml

+29
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,32 @@ jobs:
4545
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10'
4646
run: |
4747
bash <(curl -s https://codecov.io/bash) || echo 'Codecov failed to upload'
48+
49+
50+
build_pip:
51+
if: github.repository == 'SCECcode/pycsep'
52+
runs-on: ${{ matrix.os }}
53+
strategy:
54+
fail-fast: false
55+
matrix:
56+
os: [ubuntu-latest]
57+
python-version: ['3.9']
58+
defaults:
59+
run:
60+
shell: bash -l {0}
61+
62+
steps:
63+
- uses: actions/checkout@v4
64+
- uses: actions/setup-python@v5
65+
with:
66+
python-version: '3.9'
67+
68+
- name: Install pyCSEP
69+
run: |
70+
pip install -e .
71+
python -c "import csep; print('Version: ', csep.__version__)"
72+
73+
- name: Test with pytest
74+
run: |
75+
pip install vcrpy==4.3.1 pytest pytest-cov
76+
pytest --cov=./ --cov-config=.coveragerc

Diff for: Dockerfile

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
## Build the docker image using:
2+
# docker build --build-arg USERNAME=$USER --build-arg USER_UID --no-cache -t pycsep .
3+
4+
## Docker instructions
5+
6+
# Install Docker image from trusted source
7+
FROM python:3.9.18-slim-bullseye
8+
9+
# Setup user id and permissions.
10+
ARG USERNAME=modeler
11+
ARG USER_UID=1100
12+
ARG USER_GID=$USER_UID
13+
RUN groupadd --non-unique -g $USER_GID $USERNAME \
14+
&& useradd -u $USER_UID -g $USER_GID -s /bin/sh -m $USERNAME
15+
16+
# Install git
17+
RUN apt update
18+
RUN apt install -y git
19+
20+
# Set up work directory in the Docker container.
21+
WORKDIR /usr/src/
22+
23+
# Set up and create python virtual environment
24+
ENV VIRTUAL_ENV=/opt/venv
25+
RUN python3 -m venv $VIRTUAL_ENV
26+
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
27+
28+
# Install pycsep.
29+
RUN git clone https://github.com/SCECcode/pycsep.git
30+
RUN pip install --no-cache-dir --upgrade pip
31+
RUN cd pycsep && pip install .
32+
33+
# Docker can now be initialized as user
34+
USER $USERNAME
35+
36+
## Run the docker image in interactive mode from the command line
37+
# docker run -it --rm --name pycsep pycsep:latest
38+

Diff for: MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
include README.md
22
include CONTRIBUTING.md
33
include CODE_OF_CONDUCT.md
4+
include Dockerfile
45
include LICENSE.txt
56
include CHANGELOG.md
67
include CREDITS.md

Diff for: README.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,11 @@ pyCSEP can be installed in several ways. It can be installed using conda or pip
3636
source code found in the pyCSEP github repo. Researchers interested in contributing to pyCSEP development should
3737
install pyCSEP from source code. pyCSEP depends on the following software packages.
3838
These which may be installed automatically, or manually, depending on the installation method used.
39-
* Python 3.7 or later (https://python.org)
39+
* Python 3.9 or later (https://python.org)
4040
* NumPy 1.21.3 or later (https://numpy.org)
4141
* SciPy 1.7.1 or later (https://scipy.org)
4242
* pandas 1.3.4 or later (https://pandas.pydata.org)
43-
* cartopy 0.20.0 or later (https://scitools.org.uk/cartopy/docs/latest)
44-
* GEOS 3.7.2 or later (https://trac.osgeo.org/geos/)
45-
* PROJ 8.0.0 or later (https://proj.org/)
43+
* cartopy 0.22.0 or later (https://scitools.org.uk/cartopy/docs/latest)
4644

4745
Please see the [requirements file](https://github.com/SCECcode/pycsep/blob/master/requirements.yml) for a complete list
4846
of requirements. These are installed automatically when using the `conda` distribution.

Diff for: docs/getting_started/installing.rst

+15-19
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ We are working on a ``conda-forge`` recipe and PyPI distribution.
55
If you plan on contributing to this package, visit the
66
`contribution guidelines <https://github.com/SCECcode/pycsep/blob/master/CONTRIBUTING.md>`_ for installation instructions.
77

8-
.. note:: This package requires >=Python 3.7.
8+
.. note:: This package requires >=Python 3.9.
99

1010
The easiest way to install PyCSEP is using ``conda``. It can also be installed using ``pip`` or built from source.
1111

@@ -22,29 +22,25 @@ Before this installation will work, you must **first** install the following sys
2222
should be installed by the installation script. To help manage dependency issues, we recommend using virtual environments
2323
like `virtualenv`.
2424

25-
| Python 3.7 or later (https://python.org)
25+
| Python 3.9 or later (https://python.org)
2626
|
27-
| NumPy 1.10 or later (https://numpy.org)
27+
| NumPy 1.21.3 or later (https://numpy.org)
2828
| Python package for scientific computing and numerical calculations.
2929
|
30-
| GEOS 3.3.3 or later (https://trac.osgeo.org/geos/)
31-
| C++ library for processing geometry.
30+
| SciPy 1.7.1 or later (https://scipy.org)
31+
| Python package that extends NumPy tools.
3232
|
33-
| PROJ 4.9.0 or later (https://proj4.org/)
34-
| Library for cartographic projections.
35-
36-
Example for Ubuntu: ::
37-
38-
sudo apt-get install libproj-dev proj-data proj-bin
39-
sudo apt-get install libgeos-dev
40-
pip install --upgrade pip
41-
pip install numpy
33+
| Pandas 1.3.4 or later (https://pandas.pydata.org)
34+
| Python package for data analysis and manipulation.
35+
|
36+
| Cartopy 0.22.0 or later (https://scitools.org.uk/cartopy/)
37+
| Python package for geospatial data processing.
4238
43-
Example for MacOS: ::
39+
Example for Ubuntu and MacOS: ::
4440

45-
brew install proj geos
41+
git clone https://github.com/sceccode/pycsep
4642
pip install --upgrade pip
47-
pip install numpy
43+
pip install -e .
4844

4945
Installing from Source
5046
----------------------
@@ -54,13 +50,13 @@ the latest GitHub commit.
5450

5551
We recommend using virtual environments when installing python packages from source to avoid any dependency conflicts. We prefer
5652
``conda`` as the package manager over ``pip``, because ``conda`` does a good job of handling binary distributions of packages
57-
across multiple platforms. Also, we recommend using the ``miniconda`` installer, because it is lightweight and only includes
53+
across multiple platforms. Also, we recommend using the ``miniconda`` or the ``miniforge`` (which uses mamba for a faster dependency handling) installers, because it is lightweight and only includes
5854
necessary pacakages like ``pip`` and ``zlib``.
5955

6056
Using Conda
6157
***********
6258

63-
If you don't have ``conda`` on your machine, download and install `Miniconda <https://docs.conda.io/en/latest/miniconda.html>`_. ::
59+
If you don't have ``conda`` on your machine, download and install `Miniconda <https://docs.conda.io/en/latest/miniconda.html>`_ or `Miniforge <https://github.com/conda-forge/miniforge>`_ ::
6460

6561
git clone https://github.com/SCECcode/pycsep
6662
cd pycsep

0 commit comments

Comments
 (0)