Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-sphinx-no-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: mamba-org/setup-micromamba@v1
with:
generate-run-shell: true
environment-file: requirements.yml
environment-file: environment.yml
create-args: >-
python=3.10
pillow
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-sphinx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: mamba-org/setup-micromamba@v1
with:
generate-run-shell: true
environment-file: requirements.yml
environment-file: environment.yml
create-args: >-
python=3.9
pillow
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- uses: mamba-org/setup-micromamba@v1
with:
generate-run-shell: true
environment-file: requirements.yml
environment-file: environment.yml
create-args: >-
python=${{ matrix.python-version }}

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: mamba-org/setup-micromamba@v1
with:
generate-run-shell: true
environment-file: requirements.yml
environment-file: environment.yml
create-args: >-
python=3.10

Expand All @@ -28,13 +28,13 @@ jobs:
conda info -a
conda list

- name: Create sdist
- name: Create sdist and wheel
run: |
python setup.py check
python setup.py sdist
python -m pip install --upgrade pip build
python -m build

- name: Publish Package
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_upload_token }}
File renamed without changes.
5 changes: 1 addition & 4 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include README.md
include CONTRIBUTING.md
include CODE_OF_CONDUCT.md
include Dockerfile
include LICENSE.txt
include LICENSE
include CHANGELOG.md
include CREDITS.md
include codemeta.json
Expand All @@ -23,8 +23,5 @@ global-exclude .git*
global-exclude *.pyc
global-exclude *.html
global-exclude *.so
global-exclude *.xls
global-exclude *.xlsm
global-exclude *.xlsx
global-exclude *~
global-exclude .DS_Store
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ Development of pyCSEP is a group effort. A list of developers that have contribu
are listed in the [credits](CREDITS.md) file in this repository.

# License:
The pyCSEP software is distributed under the BSD 3-Clause open-source license. Please see the [license](LICENSE.txt) file for more information.
The pyCSEP software is distributed under the BSD 3-Clause open-source license. Please see the [license](LICENSE) file for more information.
30 changes: 20 additions & 10 deletions csep/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,22 @@
import os
import time

from csep._version import __version__
from csep.core import catalog_evaluations
from csep.core import catalogs
from csep.core import forecasts
from csep.core import catalogs
from csep.core import poisson_evaluations
from csep.core import catalog_evaluations
from csep.core import regions
from csep.core.exceptions import CSEPCatalogException
from csep.core.forecasts import GriddedForecast, CatalogForecast
from csep.core.repositories import (
load_json,
write_json
)

from csep.core.exceptions import CSEPCatalogException

from csep.utils import datasets
from csep.utils import readers

from csep.core.forecasts import GriddedForecast, CatalogForecast
from csep.models import (
EvaluationResult,
CatalogNumberTestResult,
Expand All @@ -22,8 +26,7 @@
CatalogPseudolikelihoodTestResult,
CalibrationTestResult
)
from csep.utils import datasets
from csep.utils import readers

from csep.utils.time_utils import (
utc_now_datetime,
strptime_to_utc_datetime,
Expand All @@ -32,6 +35,13 @@
utc_now_epoch
)

from importlib.metadata import version as _pkg_version, PackageNotFoundError

try:
__version__ = _pkg_version("pycsep")
except PackageNotFoundError:
__version__ = "0+unknown"

# this defines what is imported on a `from csep import *`
__all__ = [
'load_json',
Expand Down Expand Up @@ -75,8 +85,8 @@ def load_stochastic_event_sets(filename, type='csv', format='native',
(generator): :class:`~csep.core.catalogs.AbstractBaseCatalog`

"""
if type not in ('ucerf3', 'csv'):
raise ValueError("type must be one of the following: (ucerf3)")
if type not in ('ucerf3', 'csv', 'csep'):
raise ValueError("type must be one of the following: (ucerf3, csv, csep)")

# use mapping to dispatch to correct function
# in general, stochastic event sets are loaded with classmethods and single catalogs use the
Expand All @@ -100,7 +110,7 @@ def load_stochastic_event_sets(filename, type='csv', format='native',
elif format == 'csep':
yield catalog.get_csep_format()
else:
raise ValueError('format must be either "native" or "csep!')
raise ValueError('format must be either "native" or "csep!"')


def load_catalog(filename, type='csep-csv', format='native', loader=None,
Expand Down
2 changes: 0 additions & 2 deletions csep/_version.py

This file was deleted.

8 changes: 4 additions & 4 deletions docs/getting_started/installing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ If you don't have ``conda`` on your machine, download and install `Miniconda <ht

git clone https://github.com/SCECcode/pycsep
cd pycsep
conda env create -f requirements.yml
conda env create -f environment.yml
conda activate csep-dev
# Installs in editor mode with all dependencies
pip install -e .
Expand All @@ -79,7 +79,7 @@ follow these instructions: ::
python -m virtualenv venv
source venv/bin/activate
# Installs in editor mode dependencies are installed by conda
pip install -e .[all]
pip install -e .

Note: If you want to go back to your default environment use the command ``deactivate``.

Expand All @@ -92,9 +92,9 @@ We recommend using ``conda`` to install the development environment. ::

git clone https://github.com/<YOUR_GITHUB_USERNAME>/pycsep.git
cd pycsep
conda env create -f requirements.yml
conda env create -f environment.yml
conda activate csep-dev
pip install -e .[all]
pip install -e .[dev]
# Allow sync with default repository
git remote add upstream https://github.com/SCECCode/pycsep.git

Expand Down
2 changes: 1 addition & 1 deletion requirements.yml → environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
- defaults
dependencies:
- python>=3.7
- pip
- numpy
- pandas
- scipy
Expand Down
71 changes: 71 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
[build-system]
requires = ["setuptools>=69", "wheel", "build", "setuptools-scm>=8"]
build-backend = "setuptools.build_meta"

[project]
name = "pycsep"
dynamic = ["version"] # <— version comes from SCM
description = "Python tools from the Collaboratory for the Study of Earthquake Predictability"
readme = "README.md"
requires-python = ">=3.9"
license = { file = "LICENSE" }
authors = [{ name = "William Savran", email = "[email protected]" }]
urls = { "Homepage" = "https://github.com/SCECCode/pycsep" }

dependencies = [
"numpy",
"scipy",
"pandas",
"matplotlib",
"cartopy",
"obspy",
"pyproj",
"python-dateutil",
"rasterio",
"mercantile",
"shapely",
]

[project.optional-dependencies]
dev = ["pytest", "vcrpy", "pytest-cov", "sphinx", "sphinx-gallery", "sphinx-rtd-theme", "pillow", "tox"]

[tool.setuptools]
include-package-data = true

[tool.setuptools.packages.find]
where = ["."]
include = ["csep*"]

[tool.setuptools_scm]
version_scheme = "post-release"

[tool.tox]
min_version = "4.0"
env_list = ["py39", "py310", "py311", "py312"]
skip_missing_interpreters = true

[tool.tox.requires]
requires = ["tox-conda>=0.10"]

[tool.tox.env.py]
package = "wheel"
wheel_build_env = ".pkg"
extras = ["dev"]
conda_channels = ["conda-forge"]
conda_deps = [
"python",
"numpy",
"pandas",
"scipy",
"matplotlib",
"pyproj",
"obspy",
"python-dateutil",
"cartopy",
"shapely",
"rasterio",
"mercantile"
]
set_env = { MPLBACKEND = "Agg" }
pass_env = ["PYTEST_ADDOPTS"]
commands = ["pytest --basetemp={envtmpdir}"]
68 changes: 0 additions & 68 deletions setup.py

This file was deleted.