Skip to content

Commit 505c5c8

Browse files
authored
Merge pull request #280 from pabloitu/274-migrate-from-setuppy
Upgrade to PEP660
2 parents f386d32 + feecd5f commit 505c5c8

File tree

13 files changed

+106
-98
lines changed

13 files changed

+106
-98
lines changed

.github/workflows/build-sphinx-no-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- uses: mamba-org/setup-micromamba@v1
1717
with:
1818
generate-run-shell: true
19-
environment-file: requirements.yml
19+
environment-file: environment.yml
2020
create-args: >-
2121
python=3.10
2222
pillow

.github/workflows/build-sphinx.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- uses: mamba-org/setup-micromamba@v1
1717
with:
1818
generate-run-shell: true
19-
environment-file: requirements.yml
19+
environment-file: environment.yml
2020
create-args: >-
2121
python=3.9
2222
pillow

.github/workflows/build-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- uses: mamba-org/setup-micromamba@v1
2828
with:
2929
generate-run-shell: true
30-
environment-file: requirements.yml
30+
environment-file: environment.yml
3131
create-args: >-
3232
python=${{ matrix.python-version }}
3333

.github/workflows/publish-pypi.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- uses: mamba-org/setup-micromamba@v1
2020
with:
2121
generate-run-shell: true
22-
environment-file: requirements.yml
22+
environment-file: environment.yml
2323
create-args: >-
2424
python=3.10
2525
@@ -28,13 +28,13 @@ jobs:
2828
conda info -a
2929
conda list
3030
31-
- name: Create sdist
31+
- name: Create sdist and wheel
3232
run: |
33-
python setup.py check
34-
python setup.py sdist
33+
python -m pip install --upgrade pip build
34+
python -m build
3535
3636
- name: Publish Package
37-
uses: pypa/gh-action-pypi-publish@master
37+
uses: pypa/gh-action-pypi-publish@release/v1
3838
with:
3939
user: __token__
4040
password: ${{ secrets.pypi_upload_token }}
File renamed without changes.

MANIFEST.in

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ include README.md
22
include CONTRIBUTING.md
33
include CODE_OF_CONDUCT.md
44
include Dockerfile
5-
include LICENSE.txt
5+
include LICENSE
66
include CHANGELOG.md
77
include CREDITS.md
88
include codemeta.json
@@ -23,8 +23,5 @@ global-exclude .git*
2323
global-exclude *.pyc
2424
global-exclude *.html
2525
global-exclude *.so
26-
global-exclude *.xls
27-
global-exclude *.xlsm
28-
global-exclude *.xlsx
2926
global-exclude *~
3027
global-exclude .DS_Store

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,4 @@ Development of pyCSEP is a group effort. A list of developers that have contribu
8989
are listed in the [credits](CREDITS.md) file in this repository.
9090

9191
# License:
92-
The pyCSEP software is distributed under the BSD 3-Clause open-source license. Please see the [license](LICENSE.txt) file for more information.
92+
The pyCSEP software is distributed under the BSD 3-Clause open-source license. Please see the [license](LICENSE) file for more information.

csep/__init__.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,22 @@
22
import os
33
import time
44

5-
from csep._version import __version__
6-
from csep.core import catalog_evaluations
7-
from csep.core import catalogs
85
from csep.core import forecasts
6+
from csep.core import catalogs
97
from csep.core import poisson_evaluations
8+
from csep.core import catalog_evaluations
109
from csep.core import regions
11-
from csep.core.exceptions import CSEPCatalogException
12-
from csep.core.forecasts import GriddedForecast, CatalogForecast
1310
from csep.core.repositories import (
1411
load_json,
1512
write_json
1613
)
14+
15+
from csep.core.exceptions import CSEPCatalogException
16+
17+
from csep.utils import datasets
18+
from csep.utils import readers
19+
20+
from csep.core.forecasts import GriddedForecast, CatalogForecast
1721
from csep.models import (
1822
EvaluationResult,
1923
CatalogNumberTestResult,
@@ -22,8 +26,7 @@
2226
CatalogPseudolikelihoodTestResult,
2327
CalibrationTestResult
2428
)
25-
from csep.utils import datasets
26-
from csep.utils import readers
29+
2730
from csep.utils.time_utils import (
2831
utc_now_datetime,
2932
strptime_to_utc_datetime,
@@ -32,6 +35,13 @@
3235
utc_now_epoch
3336
)
3437

38+
from importlib.metadata import version as _pkg_version, PackageNotFoundError
39+
40+
try:
41+
__version__ = _pkg_version("pycsep")
42+
except PackageNotFoundError:
43+
__version__ = "0+unknown"
44+
3545
# this defines what is imported on a `from csep import *`
3646
__all__ = [
3747
'load_json',
@@ -75,8 +85,8 @@ def load_stochastic_event_sets(filename, type='csv', format='native',
7585
(generator): :class:`~csep.core.catalogs.AbstractBaseCatalog`
7686
7787
"""
78-
if type not in ('ucerf3', 'csv'):
79-
raise ValueError("type must be one of the following: (ucerf3)")
88+
if type not in ('ucerf3', 'csv', 'csep'):
89+
raise ValueError("type must be one of the following: (ucerf3, csv, csep)")
8090

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

105115

106116
def load_catalog(filename, type='csep-csv', format='native', loader=None,

csep/_version.py

Lines changed: 0 additions & 2 deletions
This file was deleted.

docs/getting_started/installing.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ If you don't have ``conda`` on your machine, download and install `Miniconda <ht
6060

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

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

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

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

0 commit comments

Comments
 (0)