Skip to content

Commit 698c850

Browse files
Merge pull request #22 from hsaunders1904/replace_poetry_with_uv
Remove Poetry and use uv
2 parents d075e2a + 25e08ae commit 698c850

File tree

10 files changed

+697
-718
lines changed

10 files changed

+697
-718
lines changed

.github/workflows/ci.yaml

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,22 @@ jobs:
88
name: Test
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v3
12-
- uses: actions/setup-python@v4
11+
- uses: actions/checkout@v4
12+
- name: Install uv
13+
uses: astral-sh/setup-uv@v5
1314
with:
14-
python-version: '3.8'
15+
cache-dependency-glob: "uv.lock"
16+
enable-cache: true
17+
python-version: "3.9"
18+
version: "0.6.13"
19+
- name: Install pyautoenv
20+
run: uv sync --all-groups
1521
- name: Code Quality
1622
run: |
17-
python -m pip install pre-commit
18-
pre-commit run --all-files
23+
uv run pre-commit run --all-files
1924
- name: Test
2025
run: |
21-
python -m pip install poetry
22-
poetry install --only=test
23-
poetry run pytest --cov --cov-report=term-missing --cov-report=xml
26+
uv run pytest --cov --cov-report=term-missing --cov-report=xml
2427
- name: Upload coverage to Codecov
2528
uses: codecov/codecov-action@v3
2629
with:
@@ -29,12 +32,16 @@ jobs:
2932
name: Test-Windows
3033
runs-on: windows-latest
3134
steps:
32-
- uses: actions/checkout@v3
33-
- uses: actions/setup-python@v4
35+
- uses: actions/checkout@v4
36+
- name: Install uv
37+
uses: astral-sh/setup-uv@v5
3438
with:
35-
python-version: '3.8'
39+
cache-dependency-glob: "uv.lock"
40+
enable-cache: true
41+
python-version: "3.9"
42+
version: "0.6.13"
43+
- name: Install pyautoenv
44+
run: uv sync --all-groups
3645
- name: Test
3746
run: |
38-
python -m pip install poetry
39-
poetry install --only=test
40-
poetry run pytest --cov --cov-report=term-missing
47+
uv run pytest --cov --cov-report=term-missing

.github/workflows/release.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@ jobs:
1111
name: Release
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v3
14+
- uses: actions/checkout@v4
1515
- uses: actions/setup-python@v4
1616
with:
17-
python-version: '3.8'
17+
python-version: '3.9'
1818
- name: Validate Version
1919
run: |
2020
python -m pip install toml
21-
poetry_version="$(python -c 'import toml; print(toml.load("pyproject.toml")["tool"]["poetry"]["version"])')"
22-
echo "Version from input: ${{ github.event.inputs.version }}"
23-
echo "Version from poetry: ${poetry_version}"
24-
if ! [ "${{ github.event.inputs.version }}" = "${poetry_version}" ]; then
21+
pyproject_version="$(python -c 'import toml; print(toml.load("pyproject.toml")["project"]["version"])')"
22+
echo "Version from input: ${{ github.event.inputs.version }}"
23+
echo "Version from pyproject.toml: ${pyproject_version}"
24+
if ! [ "${{ github.event.inputs.version }}" = "${pyproject_version}" ]; then
2525
exit 1;
2626
fi
2727
script_version="$(python -c 'import pyautoenv; print(pyautoenv.__version__)')"
28-
echo "Version from script: ${script_version}"
29-
if ! [ "${poetry_version}" = "${script_version}" ]; then
28+
echo "Version from script: ${script_version}"
29+
if ! [ "${pyproject_version}" = "${script_version}" ]; then
3030
exit 1;
3131
fi
3232
- name: Release

.pre-commit-config.yaml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.6.0
3+
rev: v5.0.0
44
hooks:
55
- id: end-of-file-fixer
66
- id: trailing-whitespace
@@ -10,21 +10,18 @@ repos:
1010
hooks:
1111
- id: remove-crlf
1212
- id: forbid-tabs
13-
- repo: https://github.com/psf/black
14-
rev: 24.4.2
15-
hooks:
16-
- id: black
17-
- repo: https://github.com/charliermarsh/ruff-pre-commit
18-
rev: v0.5.3
13+
- repo: https://github.com/astral-sh/ruff-pre-commit
14+
rev: v0.11.5
1915
hooks:
2016
- id: ruff
17+
- id: ruff-format
2118
- repo: https://github.com/pre-commit/mirrors-mypy
22-
rev: v1.10.1
19+
rev: v1.15.0
2320
hooks:
2421
- id: mypy
2522
additional_dependencies:
2623
- types-toml
2724
- repo: https://github.com/google/yamlfmt
28-
rev: v0.13.0
25+
rev: v0.16.0
2926
hooks:
3027
- id: yamlfmt

CONTRIBUTING.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Contributing to pyautoenv
2+
3+
Contributions to improve `pyautoenv` are very welcome.
4+
You can contribute to `pyautoenv` in many ways, including:
5+
6+
- Reporting bugs.
7+
- Requesting/recommending features.
8+
- Opening a pull request to implement features or fix bugs.
9+
- Updating, improving, or reporting errors in documentation.
10+
11+
Please open an issue to allow for discussion before starting work.
12+
13+
## How `pyautoenv` Works
14+
15+
The majority of work is done by the `pyautoenv.py` script.
16+
The script generates activation/deactivation commands
17+
based on environment variables and the working directory.
18+
19+
Activation scripts for each shell call the Python script
20+
and run the generated commands on each change of directory.
21+
22+
## Opening an Issue
23+
24+
When opening an issue please ensure you outline,
25+
in as much detail as possible, the changes you wish to develop.
26+
27+
If reporting a bug, provide as much detail as possible,
28+
ideally giving a minimal reproducible example
29+
and the scenario which led to the problem.
30+
Tracebacks and/or scripts are very useful.
31+
32+
## Setting Up a Development Environment
33+
34+
`pyautoenv` uses [`uv`](https://docs.astral.sh/uv/)
35+
to manage its development environment.
36+
Install `uv`, by following the instructions in their
37+
[docs](https://docs.astral.sh/uv/getting-started/installation/).
38+
39+
To make a virtual environment and install the development dependencies, run:
40+
41+
```console
42+
uv sync --all-groups
43+
```
44+
45+
### Tests
46+
47+
Tests are currently all written in Python using `pytest`.
48+
To run the test suite:
49+
50+
```console
51+
uv run pytest tests/
52+
```
53+
54+
### Code Quality
55+
56+
Python linting and code formatting is provided by `ruff`.
57+
These can be run using:
58+
59+
```console
60+
uv run ruff check .
61+
uv run ruff format .
62+
```
63+
64+
A `pre-commit` config is provided to run checks on each commit.
65+
Install pre-commit with:
66+
67+
```console
68+
uv run pre-commit install
69+
```
70+
71+
You can also run all linting/formatting checks using `pre-commit`:
72+
73+
```console
74+
uv run pre-commit run --all-files
75+
```

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Python environment when you cd into the directory that defines that environment
1717
contains a `poetry.lock` file or a `.venv/` directory).
1818
Environments are automatically deactivated when you leave the directory.
1919

20-
Supports Python versions 3.8 and up.
20+
Supports Python versions 3.9 and up.
2121

2222
## Install
2323

@@ -62,6 +62,8 @@ source <path to pyauotenv>/pyautoenv.bash
6262
Add this to your `.bashrc` to activate the application permanently.
6363

6464
Note that this script will clobber the `cd` command.
65+
It is highly recommended to use a more modern shell,
66+
like ZSH or Fish, when using `pyautoenv`.
6567

6668
</details>
6769

@@ -117,3 +119,7 @@ There are some environment variables you can set to configure `pyautoenv`.
117119
The directories, and their children,
118120
will be treated as though no virtual environment exists for them.
119121
This means any active environment will be deactivated when changing to them.
122+
123+
## Contributing
124+
125+
See [CONTRIBUTING.md](./CONTRIBUTING.md).

0 commit comments

Comments
 (0)