Skip to content

Commit

Permalink
Merge pull request #72 from iscoe/feature/poetry-packaging
Browse files Browse the repository at this point in the history
Move to `src` layout for ezmsg and extensions, switch to `poetry`
  • Loading branch information
pperanich committed Dec 21, 2023
2 parents d61d4c8 + a073914 commit a7692c9
Show file tree
Hide file tree
Showing 85 changed files with 2,977 additions and 314 deletions.
69 changes: 32 additions & 37 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,46 @@ name: Test package

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]
workflow_dispatch:

jobs:
build:

strategy:
matrix:
python-version: [3.8, 3.9, '3.10']
python-version: [3.8, 3.9, "3.10"]
os:
- 'ubuntu-latest'
- 'windows-latest'
- 'macos-latest'
- "ubuntu-latest"
- "windows-latest"
- "macos-latest"
runs-on: ${{matrix.os}}

steps:

- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
pip install -e ".[test]"
pip install -e extensions/ezmsg-sigproc
pip install -e extensions/ezmsg-websocket
pip install -e extensions/ezmsg-zmq
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --statistics
- name: Test ezmsg
run: |
python -m pytest -v tests
- name: Test ezmsg-sigproc
run: |
python -m pytest -v extensions/ezmsg-sigproc/tests
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip pipx
pipx install poetry
poetry install -E zmq -E websocket -E sigproc --with test
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --statistics
- name: Test ezmsg
run: |
python -m pytest -v tests
- name: Test ezmsg-sigproc
run: |
python -m pytest -v extensions/ezmsg-sigproc/tests
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ Testing `ezmsg` requires:
```bash
$ python3 -m venv env
$ source env/bin/activate
(env) $ pip install --upgrade pip
(env) $ pip install -e ".[test]"
(env) $ pip install --upgrade pip poetry
(env) $ poetry install --with test

(env) $ python -m pytest tests # Optionally, Perform tests
```

Note that it is generally recommended to install poetry into it's own standalone venv via the `pipx` cli tool.

## Documentation

https://ezmsg.readthedocs.io/en/latest/
Expand All @@ -41,6 +43,21 @@ https://ezmsg.readthedocs.io/en/latest/

## Extensions

`ezmsg` extensions can be installed individually or all at once. To install all the extension packages in one go, you can use the following command:

```bash
pip install "ezmsg[all_ext]"
```

This will install all the available public extension packages for `ezmsg` that are listed in `pyproject.toml`.
If you prefer to install the extension packages individually, you can use the following command:

```bash
pip install "ezmsg[zmq,sigproc,...]"
```

Please note that the `ezmsg` package itself can still be installed without any additional extensions using `pip install ezmsg`.

See the extension directory for more details

- `ezmsg-sigproc` -- Timeseries signal processing modules
Expand Down
1 change: 0 additions & 1 deletion extensions/ezmsg-sigproc/ezmsg/sigproc/__init__.py

This file was deleted.

1 change: 0 additions & 1 deletion extensions/ezmsg-sigproc/ezmsg/sigproc/__version__.py

This file was deleted.

290 changes: 290 additions & 0 deletions extensions/ezmsg-sigproc/poetry.lock

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions extensions/ezmsg-sigproc/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[tool.poetry]
name = "ezmsg-sigproc"
version = "1.2.3"
description = "Timeseries signal processing implementations in ezmsg"
authors = [
"Milsap, Griffin <griffin.milsap@gmail.com>",
"Peranich, Preston <pperanich@gmail.com>",
]
license = "MIT"
readme = "README.md"
packages = [{ include = "ezmsg", from = "src" }]

[tool.poetry.dependencies]
python = "^3.8"
ezmsg = "^3.3.0"
numpy = "^1.19.5"
scipy = "^1.6.3"

[tool.poetry.group.test.dependencies]
pytest = "^7.0.0"
pytest-cov = "*"

[tool.pytest.ini_options]
addopts = ["--import-mode=importlib"]
pythonpath = ["src", "tests"]
testpaths = "tests"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
27 changes: 0 additions & 27 deletions extensions/ezmsg-sigproc/setup.cfg

This file was deleted.

7 changes: 0 additions & 7 deletions extensions/ezmsg-sigproc/setup.py

This file was deleted.

4 changes: 4 additions & 0 deletions extensions/ezmsg-sigproc/src/ezmsg/sigproc/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import importlib.metadata


__version__ = importlib.metadata.version("ezmsg-sigproc")
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

from typing import Optional, Any, Tuple, List, Dict, AsyncGenerator

## Dev/test apparatus
import asyncio
from ezmsg.util.debuglog import DebugLog
from ezmsg.sigproc.synth import Oscillator, OscillatorSettings


@dataclass(unsafe_hash = True)
class SampleTriggerMessage:
Expand Down Expand Up @@ -202,15 +207,6 @@ async def on_signal(self, msg: AxisArray) -> AsyncGenerator:
self.STATE.last_msg = msg


## Dev/test apparatus
import asyncio

from ezmsg.testing.debuglog import DebugLog
from ezmsg.sigproc.synth import Oscillator, OscillatorSettings

from typing import AsyncGenerator


class TriggerGeneratorSettings(ez.Settings):
period: Tuple[float, float] # sec
prewait: float = 0.5 # sec
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion extensions/ezmsg-websocket/ezmsg/websocket/__init__.py

This file was deleted.

1 change: 0 additions & 1 deletion extensions/ezmsg-websocket/ezmsg/websocket/__version__.py

This file was deleted.

66 changes: 66 additions & 0 deletions extensions/ezmsg-websocket/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 23 additions & 5 deletions extensions/ezmsg-websocket/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
[build-system]
requires = [
"setuptools>=42",
"wheel"
[tool.poetry]
name = "ezmsg-websocket"
version = "1.1.2"
description = "Websocket server and client units for ezmsg"
authors = [
"Milsap, Griffin <griffin.milsap@gmail.com>",
"Peranich, Preston <pperanich@gmail.com>",
]
license = "MIT"
readme = "README.md"
packages = [{ include = "ezmsg", from = "src" }]
classifiers = [
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
]
build-backend = "setuptools.build_meta"

[tool.poetry.dependencies]
python = "^3.8"
ezmsg = "^3.3.0"
websockets = "^8.1"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
26 changes: 0 additions & 26 deletions extensions/ezmsg-websocket/setup.cfg

This file was deleted.

7 changes: 0 additions & 7 deletions extensions/ezmsg-websocket/setup.py

This file was deleted.

4 changes: 4 additions & 0 deletions extensions/ezmsg-websocket/src/ezmsg/websocket/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import importlib.metadata


__version__ = importlib.metadata.version("ezmsg-websocket")
1 change: 0 additions & 1 deletion extensions/ezmsg-zmq/ezmsg/zmq/__init__.py

This file was deleted.

1 change: 0 additions & 1 deletion extensions/ezmsg-zmq/ezmsg/zmq/__version__.py

This file was deleted.

Loading

0 comments on commit a7692c9

Please sign in to comment.