Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ jobs:
- name: Install the world
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -e .[dev]
python -m pip install -r requirements_dev.txt
pip install -e .
- name: Run linting
run: |
flake8 ./pyee ./tests
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ jobs:
- name: Install the world
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -e .[dev]
python -m pip install -r requirements_dev.txt
pip install -e .
- name: Build Package Distributions
run: python -m build
- name: Store Package Distributions
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ version.txt
scratchpad.ipynb
.tox/
node_modules
venv
.venv
site
_build
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

- Use `uv` instead of `pip-tools`
- Move `dev` extras to `dev` dependency group
- Drop support for Python 3.8, 3.9, 3.10 and 3.11

## 2026/02/14 Version 13.0.1

- Check for listener's existence before attempting to remove it
Expand Down
72 changes: 7 additions & 65 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@

## Prerequisites

- Python 3.10+ - either system python3 or conda
- npm - namely `npx`
- [uv](https://docs.astral.sh/uv/)
- `npm` - namely `npx`
- [just](https://github.com/casey/just)

## Environment Setup

To set everything up, run:
This project uses `uv` to manage dependencies. `uv` is pretty good at automatically sync-ing. But if you need to explicitly set everything up, try:

```bash
just install
```

This will create a virtualenv at `./venv` and install dependencies with pip and
pip-tools.
This will create a virtualenv at `./.venv` and install dependencies with `uv`.

## Just Tasks

Expand All @@ -28,7 +27,6 @@ Available recipes:
check # Check type annotations with pyright
clean # Clean up loose files
compile # Generate locked requirements files based on dependencies in pyproject.toml
console # Open a Jupyter console
default # By default, run checks and tests, then format and lint
docs # Live generate docs and host on a development webserver
format # Format with black and isort
Expand All @@ -55,57 +53,6 @@ To update the modules being used, run:
just update
```

Alternately, run everything with the just tasks, which source the activate
script before running commands. You can get a full list with `just --list`.

### conda

The author doesn't currently use Conda on any machines, and is unsupported.
Howeer, an `environment.yml` *is* provided, and is intended to manage a Conda
environment named `pyee`. These notes are a guide to how Conda *could* be
used, and for anybody who wants to add Conda support to the `justfile`.

In general, `conda env create`, `conda activate pyee` and `conda env update`
should work as far as Conda is concerned. However, you'll need to use lower
level commands to update the requirements files with pip-tools.

Instead of running `just install`, run:

```bash
just compile # generate requirements files
conda env install # or conda env update
```

Instead of running `just update`, run:

```bash
just clean # removes existing requirements files
just compile
conda env update
```

Note that the other just tasks assume an activate script at `./venv/bin/activate`.
For now, you could probably stub it so that it calls `conda activate pyee`.
Supporting it would probably look like generating that script in the
venv setup task.

Finally, be cautioned that, in the past, dependencies with compiled components
were installed with Conda, such that pip left them alone after finding they
were the same version. The reason for this is that source builds will have
issues linking to non-Conda libraries. Now that it's a few years later,
however, those modules may install binary wheels and be just fine.

Either way, there's a decent shot a module with compiled components will have issues
and need to be added to `environment.yml`. In the past, I manually kept the
version matching `requirements_dev.txt`, but now that this is being generated
by pip-tools - with locks for transient dependencies - this
sort of bookkeeping is a lot harder. One option is to write a script that
will naively grep versions from the requirements file, though keep in mind
that pip versions aren't fully compatible with Conda versions. Another is
to find the conda package for the binary dependency, and install that so the
linter works. A final option is to punch Conda's linker - I've done this in
the past, but it's pretty fragile and hopefully unnecessary.

## Interactive Environments

To activate the venv in a subshell:
Expand Down Expand Up @@ -197,10 +144,9 @@ off manually. Log into [RTD](https://readthedocs.org), log in, then go
to [the pyee project page](https://readthedocs.org/projects/pyee/) and build
latest and stable.

### (Optional) Announce on Social Media

### (Optional) Announce on Twitter

It's not official, but I like to announce the release on Twitter.
It's not official, but I like to announce the release on Bluesky and Mastodon.


### (Optional) Build and Publish Manually
Expand All @@ -211,8 +157,4 @@ If you want to publish the package manually, run:
just publish
```

This should automatically build the package and upload with twine. However,
you can also build the package manually with `just build`, or upload the
existing build with `just upload`.


This should automatically build the package and upload with `uv`.
1 change: 0 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ channels:
dependencies:
- python=3.10.11
- pip
- pip-tools
- wheel
- pip:
- -r requirements_dev.txt
Expand Down
74 changes: 24 additions & 50 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ sphinx-builddir := "_build"

# By default, run checks and tests, then format and lint
default:
if [ ! -d venv ]; then just install; fi
@just format
@just check
@just test
Expand All @@ -17,41 +16,18 @@ default:
# Installing, updating and upgrading dependencies
#

_venv:
if [ ! -d venv ]; then python3 -m venv venv; . ./venv/bin/activate && pip install pip pip-tools wheel; fi

_clean-venv:
rm -rf venv

# Install all dependencies
install:
@just _venv
@just compile
. ./venv/bin/activate && pip install -r requirements_dev.txt
. ./venv/bin/activate && pip install -e .
uv sync --dev

# Update all dependencies
update:
@just _venv
. ./venv/bin/activate && pip install pip pip-tools wheel --upgrade
@just _clean-compile
@just install

# Update all dependencies and rebuild the environment
upgrade:
if [ -d venv ]; then just update && just check && just _upgrade; else just update; fi

_upgrade:
@just _clean-venv
@just _venv
@just _clean-compile
uv sync --dev --upgrade
@just compile
@just install

# Generate locked requirements files based on dependencies in pyproject.toml
compile:
. ./venv/bin/activate && python -m piptools compile --resolver=backtracking -o requirements.txt pyproject.toml --verbose
. ./venv/bin/activate && python -m piptools compile --resolver=backtracking --extra=dev -o requirements_dev.txt pyproject.toml --verbose
uv pip compile -o requirements.txt pyproject.toml
uv pip compile --group dev -o requirements_dev.txt pyproject.toml

_clean-compile:
rm -f requirements.txt
Expand All @@ -63,25 +39,25 @@ _clean-compile:

# Format with black and isort
format:
. ./venv/bin/activate && black ./docs './pyee' ./tests
. ./venv/bin/activate && isort --settings-file . ./docs './pyee' ./tests
uv run black ./docs './pyee' ./tests
uv run isort --settings-file . ./docs './pyee' ./tests

# Lint with flake8
lint:
. ./venv/bin/activate && flake8 ./docs './pyee' ./tests
. ./venv/bin/activate && validate-pyproject ./pyproject.toml
uv run flake8 ./docs './pyee' ./tests
uv run validate-pyproject ./pyproject.toml

# Check type annotations with pyright
check:
. ./venv/bin/activate && npx pyright@latest
uv run npx pyright@latest

# Check type annotations with mypy
mypy:
. ./venv/bin/activate && mypy .
uv run mypy .

# Run tests with pytest
test:
. ./venv/bin/activate && pytest ./tests
uv run pytest ./tests
@just _clean-test

_clean-test:
Expand All @@ -90,7 +66,7 @@ _clean-test:

# Run tests using tox
tox:
. ./venv/bin/activate && tox
uv run tox
@just _clean-tox

_clean-tox:
Expand All @@ -102,23 +78,23 @@ _clean-tox:

# Open a bash shell with the venv activated
shell:
. ./venv/bin/activate && bash
uv run bash

# Open a Jupyter console
console:
. ./venv/bin/activate && jupyter console
uv run jupyter console

#
# Documentation
#

# Live generate docs and host on a development webserver
docs:
. ./venv/bin/activate && mkdocs serve
uv run mkdocs serve

# Generate man page and open for preview
man: (sphinx 'man')
. ./venv/bin/activate && man -l _build/man/pyee.1
uv run man -l _build/man/pyee.1

# Build the documentation
build-docs:
Expand All @@ -127,11 +103,11 @@ build-docs:

# Run mkdocs
mkdocs:
. ./venv/bin/activate && mkdocs build
uv run mkdocs build

# Run sphinx
sphinx TARGET:
. ./venv/bin/activate && {{ sphinx-sphinxbuild }} -M "{{ TARGET }}" "{{ sphinx-sourcedir }}" "{{ sphinx-builddir }}" {{ sphinx-sphinxopts }}
uv run {{ sphinx-sphinxbuild }} -M "{{ TARGET }}" "{{ sphinx-sourcedir }}" "{{ sphinx-builddir }}" {{ sphinx-sphinxopts }}

_clean-docs:
rm -rf site
Expand All @@ -143,24 +119,22 @@ _clean-docs:

# Build the package
build:
. ./venv/bin/activate && python -m build
uv build

_clean-build:
rm -rf dist

# Tag the release in git
tag:
. ./venv/bin/activate && git tag -a "v$(python3 -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')" -m "Release $(python3 -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')"

# Upload built packages
upload:
. ./venv/bin/activate && twine upload dist/*
uv run git tag -a "v$(python3 -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')" -m "Release $(python3 -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')"

# Build the package and publish it to PyPI
publish: build upload
publish:
uv publish

# Clean up loose files
clean: _clean-venv _clean-compile _clean-test _clean-tox _clean-docs
clean: _clean-compile _clean-test _clean-tox _clean-docs
rm -rf .venv
rm -rf pyee.egg-info
rm -f pyee/*.pyc
rm -rf pyee/__pycache__
16 changes: 3 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,18 @@ classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Other/Nonlisted Topic",
]
requires-python = ">=3.8"
requires-python = ">=3.12"

dependencies = [
"typing-extensions"
]

[project.optional-dependencies]
[dependency-groups]
dev = [
"build",
"flake8",
Expand All @@ -51,12 +48,9 @@ dev = [
"mkdocstrings[python]",
"mypy",
"sphinx",
"toml",
"tox",
"trio",
"trio; python_version > '3.6'",
"trio-typing; python_version > '3.6'",
"twine",
"twisted",
"validate-pyproject[all]",
]
Expand All @@ -74,7 +68,3 @@ testpaths = [ "tests" ]

[tool.setuptools]
packages = ["pyee"]

[tool.setuptools.dynamic]
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the cause of so, so many bugs, lol

dependencies = { file = ["requirements.txt"] }
optional-dependencies.dev = { file = ["requirements_dev.txt"] }
10 changes: 3 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
#
# This file is autogenerated by pip-compile with Python 3.14
# by the following command:
#
# pip-compile --output-file=requirements.txt pyproject.toml
#
typing-extensions==4.9.0
# This file was autogenerated by uv via the following command:
# uv pip compile -o requirements.txt pyproject.toml
typing-extensions==4.15.0
# via pyee (pyproject.toml)
Loading
Loading