Skip to content

Commit c2c3218

Browse files
committed
build: add github workflow to build and publish to pypi
This is long overdue, but we should be publishing to pypi to amke the program easier for people to install and use.
1 parent 393eae2 commit c2c3218

File tree

3 files changed

+104
-12
lines changed

3 files changed

+104
-12
lines changed

.github/workflows/unittests.yml

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ name: Continuous Integration
33

44
on:
55
push:
6-
branches:
7-
- 'master'
86
pull_request:
97

108
jobs:
@@ -14,6 +12,8 @@ jobs:
1412

1513
steps:
1614
- uses: actions/checkout@v4
15+
with:
16+
persist-credentials: false
1717
- name: Set up Python 3.9
1818
uses: actions/setup-python@v5
1919
with:
@@ -30,3 +30,59 @@ jobs:
3030
- name: Run unit tests
3131
run: |
3232
uv run pytest
33+
- name: Build distribution artifacts
34+
run: |
35+
uv build
36+
- name: Store artifacts
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: python-package-distribution
40+
path: dist/
41+
42+
publish-to-pypi:
43+
name: Publish to PyPI
44+
needs:
45+
- continous-integration
46+
47+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
48+
49+
runs-on: ubuntu-latest
50+
environment:
51+
name: pypi
52+
url: https://pypi.org/p/evdevremapkeys
53+
permissions:
54+
id-token: write # IMPORTANT: mandatory for trusted publishing
55+
56+
steps:
57+
- name: Download all the dists
58+
uses: actions/download-artifact@v4
59+
with:
60+
name: python-package-distributions
61+
path: dist/
62+
- name: Publish distribution 📦 to PyPI
63+
uses: pypa/gh-action-pypi-publish@release/v1
64+
65+
publish-to-testpypi:
66+
name: Publish to TestPyPI
67+
needs:
68+
- continous-integration
69+
70+
runs-on: ubuntu-latest
71+
72+
environment:
73+
name: testpypi
74+
url: https://test.pypi.org/p/evdevremapkeys
75+
76+
permissions:
77+
id-token: write # IMPORTANT: mandatory for trusted publishing
78+
79+
steps:
80+
- name: Download all the dists
81+
uses: actions/download-artifact@v4
82+
with:
83+
name: python-package-distribution
84+
path: dist/
85+
- name: Publish distribution 📦 to TestPyPI
86+
uses: pypa/gh-action-pypi-publish@release/v1
87+
with:
88+
repository-url: https://test.pypi.org/legacy/

README.md

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,36 @@ client receives events, and then forward all un-modified events through
4545
your virtual device. It's annoying but unavoidable - you can't hide individual
4646
events from other clients.
4747

48-
## libinput's lua plugin based future?
49-
50-
In the years since I first wrote `evdevremapkeys`, there wasn'tt been any real
51-
movement towards exposing a meaningful remapping capability from libinput. In
52-
2025, they started development of a
53-
[lua](https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1192)
54-
plugin framework, which might turn out to be a real solution. When that lands,
55-
and as long as it doesn't depend on the Wayland compositor to expose access to
56-
it, it might turn out to be a better long term approach. But it's too early to
57-
say right now.
48+
# Software Setup
49+
50+
## Install from PyPI
51+
52+
The recommended way to install the program is to use `pipx`.
53+
54+
```bash
55+
$ pipx install evdevremapkeys
56+
```
57+
58+
You can also use `pip`, but on modern distros, `pipx` is a far better experience.
59+
60+
## Create a configuration
61+
62+
You will need to create an initial configuration file for the program to be
63+
able to run and doing anything useful.
64+
65+
It's recommended to start from one of the
66+
[example](https://github.com/philipl/evdevremapkeys/tree/master/examples) config
67+
files and adapt it for your hardware and the remapping you need.
68+
69+
Place your final file at: `~/.config/evdevremapkeys/config.yml`
70+
71+
## Run the program
72+
73+
```bash
74+
evdevremapkeys
75+
```
76+
77+
## More details
78+
79+
See [RUNNING.md](https://github.com/philipl/evdevremapkeys/blob/master/RUNNING.md) for
80+
more details.

RUNNING.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ is all handled by logind/systemd/X automatically.
3131

3232
# Software Setup
3333

34+
## Install from PyPI
35+
36+
The recommended way to install the program is to use `pipx`.
37+
38+
```bash
39+
$ pipx install evdevremapkeys
40+
```
41+
42+
You can also use `pip`, but on modern distros, `pipx` is a far better experience.
43+
3444
## Prerequisites
3545

3646
This project uses [uv](https://docs.astral.sh/uv/) to build and run. You will need to install
@@ -66,6 +76,9 @@ or
6676
$ pipx install <source-tarball>
6777
```
6878

79+
If you are trying to do active developing, installing with `--editable` will cause the
80+
installation to always reflect your changes.
81+
6982
## Building a self-contained executable
7083

7184
You will not usually need a self-contained executable, given the existing options for running

0 commit comments

Comments
 (0)