Skip to content

Commit 734e176

Browse files
committed
Add conda packaging support and update docs
Introduced a conda-recipe directory with meta.yaml, build.sh, and documentation for building and uploading the package to Anaconda. Updated README.md and contributing.md to include instructions for conda packaging, installation, and future conda-forge submission.
1 parent a73d0f9 commit 734e176

File tree

5 files changed

+154
-10
lines changed

5 files changed

+154
-10
lines changed

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,29 @@ To create a new release:
155155
git tag v1.2.0
156156
git push origin v1.2.0
157157

158-
# 2. Build and publish
158+
# 2. Build and publish to PyPI
159159
hatch build
160160
twine upload dist/*
161+
162+
# 3. Build and publish to conda
163+
conda build conda-recipe/ --output-folder ./conda-builds
164+
anaconda upload ./conda-builds/noarch/spectral_connectivity-*.tar.bz2
161165
```
162166

163167
The version number is automatically extracted from the git tag (without the 'v' prefix).
164168

169+
### Conda Package
170+
171+
This package is also available on conda via the `edeno` channel:
172+
173+
```bash
174+
conda install -c edeno spectral_connectivity
175+
```
176+
177+
**Not yet on conda-forge?** Help us get there! If you'd like this package on conda-forge for easier installation, please:
178+
- 👍 React to [this issue](https://github.com/Eden-Kramer-Lab/spectral_connectivity/issues) requesting conda-forge support
179+
- Or volunteer to help maintain the conda-forge feedstock
180+
165181
## Contributing
166182

167183
We welcome contributions to `spectral_connectivity`! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details on:

conda-recipe/README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Conda Recipe for spectral_connectivity
2+
3+
This directory contains the conda recipe for building the `spectral_connectivity` package.
4+
5+
## Building the package
6+
7+
```bash
8+
# Build the conda package
9+
conda build conda-recipe/ --output-folder ./conda-builds
10+
11+
# Upload to anaconda.org (requires anaconda-client)
12+
anaconda upload ./conda-builds/noarch/spectral_connectivity-*.tar.bz2
13+
```
14+
15+
## Recipe Files
16+
17+
- `meta.yaml` - Main recipe file with package metadata, dependencies, and build configuration
18+
- `build.sh` - Build script for Unix systems (Linux/macOS)
19+
20+
## Notes
21+
22+
- The recipe uses `noarch: python` for platform-independent builds
23+
- Dependencies are synchronized with `pyproject.toml`
24+
- Version is currently hardcoded but could be templated from git tags
25+
- The recipe builds from PyPI source, not local source
26+
27+
## Conda-forge (Future Enhancement)
28+
29+
**Status: Not currently on conda-forge**
30+
31+
This package could benefit from conda-forge submission for:
32+
- Automated builds across platforms
33+
- Community maintenance
34+
- Better discoverability
35+
- Integration with conda-forge ecosystem
36+
37+
To submit to conda-forge:
38+
1. Fork https://github.com/conda-forge/staged-recipes
39+
2. Copy this `meta.yaml` to `recipes/spectral_connectivity/meta.yaml`
40+
3. Submit pull request to staged-recipes
41+
4. Address reviewer feedback
42+
5. Once merged, conda-forge creates automated feedstock
43+
44+
**Benefits after conda-forge acceptance:**
45+
- Users can install with: `conda install -c conda-forge spectral_connectivity`
46+
- Automatic rebuilds for dependency updates
47+
- Multi-platform builds (Windows, macOS, Linux)
48+
- Community maintenance support

conda-recipe/build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
# Build script for conda package
4+
$PYTHON -m pip install . -vv --no-deps --no-build-isolation

conda-recipe/meta.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{% set name = "spectral_connectivity" %}
2+
{% set version = "1.1.2" %}
3+
4+
package:
5+
name: {{ name|lower }}
6+
version: {{ version }}
7+
8+
source:
9+
url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/spectral_connectivity-{{ version }}.tar.gz
10+
sha256: # This will be automatically filled by conda-build from PyPI
11+
12+
build:
13+
number: 0
14+
noarch: python
15+
script: {{ PYTHON }} -m pip install . -vv
16+
entry_points:
17+
# Add any console scripts here if you have them
18+
19+
requirements:
20+
host:
21+
- python >=3.9
22+
- pip
23+
- hatchling
24+
- hatch-vcs
25+
run:
26+
- python >=3.9
27+
- numpy >=1.21
28+
- scipy >=1.7
29+
- xarray >=0.20
30+
- matplotlib >=3.4
31+
32+
test:
33+
imports:
34+
- spectral_connectivity
35+
- spectral_connectivity.connectivity
36+
- spectral_connectivity.transforms
37+
- spectral_connectivity.wrapper
38+
commands:
39+
- python -c "import spectral_connectivity; print(spectral_connectivity.__version__)"
40+
requires:
41+
- pytest
42+
43+
about:
44+
home: https://github.com/Eden-Kramer-Lab/spectral_connectivity
45+
license: GPL-3.0-only
46+
license_family: GPL3
47+
license_file: LICENSE
48+
summary: Frequency domain functional and directed connectivity analysis tools for electrophysiological data
49+
description: |
50+
spectral_connectivity is a Python software package that computes multitaper
51+
spectral estimates and frequency-domain brain connectivity measures such as
52+
coherence, spectral granger causality, and the phase lag index using the
53+
multitaper Fourier transform.
54+
doc_url: https://spectral-connectivity.readthedocs.io/
55+
dev_url: https://github.com/Eden-Kramer-Lab/spectral_connectivity
56+
57+
extra:
58+
recipe-maintainers:
59+
- edeno

docs/contributing.md

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,38 @@ python -m build
4040
twine upload dist/*
4141
```
4242

43-
3. Upload to conda. This requires anaconda and conda-build.
43+
3. Upload to conda. This requires anaconda-client and conda-build.
4444

4545
```bash
46-
CONDA_DIR=~/miniconda3
47-
USER=edeno
46+
# Build conda package using recipe
47+
conda build conda-recipe/ --output-folder ./conda-builds
4848

49-
conda skeleton pypi spectral_connectivity --noarch-python --python-version 3.6
49+
# Upload to your personal conda channel
50+
anaconda upload ./conda-builds/noarch/spectral_connectivity-*.tar.bz2
5051

51-
conda build spectral_connectivity --no-anaconda-upload --python 3.6
52+
# Clean up build artifacts
53+
rm -rf ./conda-builds
54+
conda build purge
55+
```
5256

53-
anaconda upload $CONDA_DIR/conda-bld/*/spectral_connectivity-*.tar.bz2 -u $USER --skip
57+
**For conda-forge submission (future enhancement):**
5458

55-
rm -r spectral_connectivity
56-
conda build purge-all
57-
```
59+
This package is not currently on conda-forge. To add it:
60+
61+
1. **Prepare for submission:**
62+
- Ensure package has stable releases and good maintenance
63+
- Recipe should be well-tested with the conda-recipe/ directory
64+
65+
2. **Submit to conda-forge:**
66+
- Fork https://github.com/conda-forge/staged-recipes
67+
- Copy `conda-recipe/meta.yaml` to `recipes/spectral_connectivity/meta.yaml`
68+
- Submit PR to conda-forge staged-recipes
69+
- Respond to reviewer feedback
70+
71+
3. **After acceptance:**
72+
- conda-forge creates automated feedstock
73+
- Maintainers get notifications for new releases
74+
- Users can install with: `conda install -c conda-forge spectral_connectivity`
5875

5976
4. Release on github.
6077

0 commit comments

Comments
 (0)