Skip to content

Commit 76c0f1f

Browse files
committed
Modernize package and add actions
1 parent 2087206 commit 76c0f1f

File tree

16 files changed

+147
-0
lines changed

16 files changed

+147
-0
lines changed

.github/workflows/full_tests.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Test on Ubuntu
2+
3+
on:
4+
pull_request:
5+
branches: [dev]
6+
types: [synchronize, opened, reopened]
7+
8+
9+
jobs:
10+
build-and-test:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: "3.10"
20+
- name: Install package
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install .[test]
24+
- name: Pytest
25+
run: |
26+
pytest -v
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Release to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
jobs:
8+
release:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Set up Python 3.10
14+
uses: actions/setup-python@v4
15+
with:
16+
python-version: "3.10"
17+
- name: Install Tools
18+
run: |
19+
python -m pip install --upgrade pip
20+
pip install setuptools wheel twine build
21+
- name: Package and Upload
22+
env:
23+
STACKMANAGER_VERSION: ${{ github.event.release.tag_name }}
24+
TWINE_USERNAME: __token__
25+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
26+
run: |
27+
python -m build --sdist --wheel
28+
twine upload dist/*

.pre-commit-config.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.5.0
4+
hooks:
5+
- id: fix-encoding-pragma
6+
exclude: tests/test_data
7+
- id: trailing-whitespace
8+
exclude: tests/test_data
9+
- id: end-of-file-fixer
10+
exclude: tests/test_data
11+
- id: check-docstring-first
12+
- id: debug-statements
13+
- id: check-toml
14+
- id: check-yaml
15+
exclude: tests/test_data
16+
- id: requirements-txt-fixer
17+
- id: detect-private-key
18+
- id: check-merge-conflict
19+
20+
- repo: https://github.com/psf/black
21+
rev: 24.4.2
22+
hooks:
23+
- id: black
24+
exclude: tests/test_data
25+
- id: black-jupyter
26+
27+
- repo: https://github.com/pycqa/isort
28+
rev: 5.13.2
29+
hooks:
30+
- id: isort
31+
args: ["--profile", "black"]
32+
33+
- repo: https://github.com/astral-sh/ruff-pre-commit
34+
rev: v0.4.4
35+
hooks:
36+
- id: ruff

pyproject.toml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
[project]
2+
name = "spatial_maps"
3+
version = "0.2.0"
4+
authors = [
5+
{ name = "Mikkel Lepperod", email = "[email protected]" },
6+
{ name = "Alessio Buccino", email = "[email protected]" },
7+
]
8+
9+
description = "Compute spatial maps for neural data."
10+
readme = "README.md"
11+
requires-python = ">=3.10"
12+
classifiers = [
13+
"Programming Language :: Python :: 3",
14+
"License :: OSI Approved :: MIT License",
15+
"Operating System :: OS Independent",
16+
]
17+
18+
dependencies = [
19+
"numpy"<2,
20+
"scipy",
21+
"astropy",
22+
"pandas",
23+
"elephant",
24+
"matplotlib"
25+
]
26+
27+
[project.urls]
28+
homepage = "https://github.com/CINPLA/spatial-maps"
29+
repository = "https://github.com/CINPLA/spatial-maps"
30+
31+
[build-system]
32+
requires = ["setuptools>=62.0"]
33+
build-backend = "setuptools.build_meta"
34+
35+
[tool.setuptools]
36+
include-package-data = true
37+
38+
[tool.setuptools.packages.find]
39+
where = ["src"]
40+
include = ["spatial_maps*"]
41+
namespaces = false
42+
43+
[project.optional-dependencies]
44+
dev = ["pre-commit", "black[jupyter]", "isort", "ruff"]
45+
test = ["pytest", "pytest-cov", "pytest-dependency", "mountainsort5"]
46+
docs = ["sphinx-gallery", "sphinx_rtd_theme"]
47+
full = [
48+
"spatial_maps[dev]",
49+
"spatial_maps[test]",
50+
"spatial_maps[docs]",
51+
]
52+
53+
[tool.coverage.run]
54+
omit = ["tests/*"]
55+
56+
[tool.black]
57+
line-length = 120
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)