Skip to content

Commit df2dbe0

Browse files
committed
ci: set up automatic versioning.
readme: updated.
1 parent 93320e9 commit df2dbe0

File tree

8 files changed

+46
-45
lines changed

8 files changed

+46
-45
lines changed

.github/workflows/publish-pypi.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ jobs:
2323
create-args: >-
2424
python=3.10
2525
26-
- name: Install py-build
26+
- name: Install py-build and setuptools-scm
2727
run: |
28-
python3 -m pip install --upgrade build
28+
micromamba run -n floatcsep python3 -m pip install --upgrade build setuptools-scm
2929
3030
- name: Build
3131
run: |
32-
python3 -m build --sdist --wheel --outdir dist/
32+
micromamba run -n floatcsep python3 -m build --sdist --wheel --outdir dist/
3333
3434
- name: Publish Package
35-
uses: pypa/gh-action-pypi-publish@master
35+
uses: pypa/gh-action-pypi-publish@v1.9.0
3636
with:
3737
user: __token__
38-
password: ${{ secrets.PYPI_API_TOKEN }}
38+
password: ${{ secrets.PYPI_API_TOKEN }}

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
.idea/
22
__pycache__
3-
3+
version

README.md

+9-12
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,15 @@
66

77
<p left>
88

9-
<a href='https://floatcsep.readthedocs.io/en/latest/?badge=latest'>
10-
<img src='https://readthedocs.org/projects/floatcsep/badge/?version=latest' alt='Documentation Status' />
11-
</a>
12-
<a href='https://github.com/cseptesting/floatcsep/actions/workflows/build-test.yml'>
13-
<img src='https://github.com/cseptesting/floatcsep/actions/workflows/build-test.yml/badge.svg' alt='Documentation Status' />
14-
</a>
15-
<img alt="PyPI" src="https://img.shields.io/pypi/v/floatcsep">
16-
17-
<a href="https://codecov.io/gh/cseptesting/floatcsep" >
18-
<img src="https://codecov.io/gh/cseptesting/floatcsep/branch/main/graph/badge.svg?token=LI4RSDOKA1"/>
19-
</a>
20-
<a href="https://doi.org/10.5281/zenodo.7953816"><img src="https://zenodo.org/badge/DOI/10.5281/zenodo.7953816.svg" alt="DOI"></a>
9+
[![Documentation Status](https://readthedocs.org/projects/floatcsep/badge/?version=latest)](https://floatcsep.readthedocs.io/en/latest/?badge=latest)
10+
[![Build Status](https://github.com/cseptesting/floatcsep/actions/workflows/build-test.yml/badge.svg)](https://github.com/cseptesting/floatcsep/actions/workflows/build-test.yml)
11+
[![PyPI Version](https://img.shields.io/pypi/v/floatcsep)](https://pypi.org/project/floatcsep/)
12+
[![Conda Version](https://img.shields.io/conda/vn/conda-forge/floatcsep)](https://anaconda.org/conda-forge/floatcsep)
13+
[![Python Versions](https://img.shields.io/pypi/pyversions/floatcsep)](https://pypi.org/project/floatcsep/)
14+
[![Code Coverage](https://codecov.io/gh/cseptesting/floatcsep/branch/main/graph/badge.svg?token=LI4RSDOKA1)](https://codecov.io/gh/cseptesting/floatcsep)
15+
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7953816.svg)](https://doi.org/10.5281/zenodo.7953816)
16+
17+
2118
</p>
2219

2320
* Set up a testing **experiment** for your earthquake forecasts using authoritative data sources

docs/conf.py

+16-23
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import os
66
import sys
77
from sphinx_gallery.sorting import FileNameSortKey
8+
from importlib.metadata import version as get_version
89

910
sys.path.insert(0, os.path.abspath(".."))
1011

@@ -16,7 +17,8 @@
1617
project = "floatCSEP"
1718
copyright = "2024, Pablo Iturrieta"
1819
author = "Pablo Iturrieta"
19-
release = "v0.2.0"
20+
release = get_version("floatcsep") # Automatically gets the version from setuptools_scm
21+
2022

2123
# -- General configuration ---------------------------------------------------
2224

@@ -25,8 +27,8 @@
2527
"sphinx.ext.todo",
2628
"sphinx.ext.autosummary",
2729
"sphinx.ext.coverage",
28-
'sphinx_toolbox.github',
29-
'sphinx_toolbox.sidebar_links',
30+
"sphinx_toolbox.github",
31+
"sphinx_toolbox.sidebar_links",
3032
"sphinx.ext.mathjax",
3133
"sphinx.ext.viewcode",
3234
"sphinx.ext.napoleon",
@@ -35,10 +37,10 @@
3537
"sphinx_design",
3638
]
3739

38-
github_username = 'cseptesting'
39-
github_repository = 'floatcsep'
40+
github_username = "cseptesting"
41+
github_repository = "floatcsep"
4042

41-
language = 'en'
43+
language = "en"
4244
autosummary_generate = False
4345
autoclass_content = "both"
4446
suppress_warnings = [
@@ -82,30 +84,21 @@
8284

8385
html_context = {
8486
"github_links": [
87+
("Getting help", "https://github.com/cseptesting/floatcsep/issues"),
8588
(
86-
'Getting help',
87-
"https://github.com/cseptesting/floatcsep/issues"
88-
),
89-
(
90-
'Contributing',
91-
"https://github.com/cseptesting/floatcsep/blob/master/CONTRIBUTING.md"
92-
),
93-
(
94-
'Code of Conduct',
95-
"https://github.com/cseptesting/floatcsep/blob/master/CODE_OF_CONDUCT.md"
96-
),
97-
(
98-
'License',
99-
"https://github.com/cseptesting/floatcsep/blob/master/LICENSE"
89+
"Contributing",
90+
"https://github.com/cseptesting/floatcsep/blob/master/CONTRIBUTING.md",
10091
),
10192
(
102-
'Source Code',
103-
"https://github.com/cseptesting/floatcsep"
93+
"Code of Conduct",
94+
"https://github.com/cseptesting/floatcsep/blob/master/CODE_OF_CONDUCT.md",
10495
),
96+
("License", "https://github.com/cseptesting/floatcsep/blob/master/LICENSE"),
97+
("Source Code", "https://github.com/cseptesting/floatcsep"),
10598
],
10699
}
107100
extlinks = {
108-
'github_contrib': ('https://github.com/cseptesting/floatcsep/main/blob/%s', ''),
101+
"github_contrib": ("https://github.com/cseptesting/floatcsep/main/blob/%s", ""),
109102
}
110103
rst_epilog = """
111104
.. raw:: html

pyproject.toml

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools>=52.0", "wheel"]
2+
requires = ["setuptools>=52.0", "wheel", "setuptools-scm"]
33
build-backend = "setuptools.build_meta"
44

55
[tool.pytest.ini_options]
@@ -16,4 +16,9 @@ target-version = ["py39", "py310", "py311"]
1616

1717
[tool.flake8]
1818
ignore = ["E203", "W503", "F401"]
19-
max-line-length = 96
19+
max-line-length = 96
20+
21+
[tool.setuptools_scm]
22+
version_scheme = "post-release"
23+
local_scheme = "no-local-version"
24+
fallback_version = "0.2.0"

requirements_dev.txt

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pyyaml
2121
requests
2222
scipy
2323
seaborn
24+
setuptools-scm
2425
shapely
2526
sphinx
2627
sphinx-autoapi

setup.cfg

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ long_description_content_type = text/markdown
66
author = Pablo Iturrieta
77
author_email = [email protected]
88
license = BSD 3-Clause License
9-
version = 0.1.4
9+
version = attr: setuptools_scm.get_version
1010
platforms = unix, linux, osx, win32
1111
classifiers =
1212
Programming Language :: Python :: 3
@@ -69,6 +69,7 @@ dev =
6969
requests
7070
scipy
7171
seaborn
72+
setuptools-scm
7273
shapely
7374
sphinx
7475
sphinx-autoapi

setup.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
from setuptools import setup
22

33
if __name__ == "__main__":
4-
setup()
4+
setup(
5+
name="floatcsep",
6+
use_scm_version=True,
7+
setup_requires=["setuptools-scm"],
8+
)

0 commit comments

Comments
 (0)