Skip to content

Commit

Permalink
Merge pull request #285 from seapagan/convert-to-uv
Browse files Browse the repository at this point in the history
  • Loading branch information
seapagan authored Oct 26, 2024
2 parents f34480c + 6268015 commit a6c6d91
Show file tree
Hide file tree
Showing 13 changed files with 1,889 additions and 2,214 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Type Checking

on: [push, pull_request, workflow_dispatch]

jobs:
mypy:
# uncomment the line before to disable this job if needed.
# if: false
name: mypy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Set up Python
run: uv python install 3.12

- name: Run mypy
run: uv run mypy . --strict
44 changes: 44 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Test Suite

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

jobs:
testing:
name: python
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Run tests
# For example, using `pytest`
run:
uv run --all-extras -p ${{ matrix.python-version }} pytest tests
--cov-report=xml

- name: Run codacy-coverage-reporter
env:
CODACY_CONFIGURED: ${{ secrets.CODACY_PROJECT_TOKEN }}
if: ${{ env.CODACY_CONFIGURED != ''}}
uses: codacy/codacy-coverage-reporter-action@v1
continue-on-error: true
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: ./coverage.xml
69 changes: 0 additions & 69 deletions .github/workflows/tests.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,4 @@ pyrightconfig.json
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
.github_changelog_generator
.changelog_generator.toml
.envrc
67 changes: 28 additions & 39 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ci:
autofix_commit_msg: "[pre-commit.ci] auto fixes from pre-commit.com hooks [dependabot skip]"
autofix_commit_msg: "[pre-commit.ci] auto fixes from pre-commit.com hooks"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-yaml
args: [--unsafe]
Expand All @@ -11,59 +11,48 @@ repos:
- id: check-merge-conflict
- id: end-of-file-fixer

- repo: https://github.com/renovatebot/pre-commit-hooks
rev: 38.131.2
hooks:
- id: renovate-config-validator
files: ^renovate\.json$

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.1
rev: v0.7.1
hooks:
- id: ruff
name: "lint with ruff"
- id: ruff-format
name: "format with ruff"

- repo: https://github.com/jackdewinter/pymarkdown
rev: v0.9.22
hooks:
- id: pymarkdown
name: "check markdown"
exclude: ^.github/|CHANGELOG
args: [-d, "MD046", scan]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.11.1" # Use the sha / tag you want to point at
rev: "v1.13.0" # Use the sha / tag you want to point at
hooks:
- id: mypy
name: "run mypy"
additional_dependencies:
- pydantic

- repo: https://github.com/python-poetry/poetry
rev: "1.8.0"
hooks:
- id: poetry-check
name: "check poetry files"
# - id: poetry-lock

- repo: https://github.com/python-poetry/poetry-plugin-export
rev: "1.8.0"
- repo: https://github.com/astral-sh/uv-pre-commit
# uv version.
rev: 0.4.27
hooks:
- id: poetry-export
name: "export production dependencies"
# Update the uv lockfile
- id: uv-lock
- id: uv-export
name: "Export dependencies to 'requirements.txt'"
args:
[
"--without-hashes",
"-f",
"requirements.txt",
"-o",
"requirements.txt",
"--without",
"dev",
"--no-hashes",
"--no-dev",
"--no-emit-project",
"--output-file=requirements.txt",
]
- id: poetry-export
name: "export development dependencies"
- id: uv-export
name: "Export dev dependencies to 'requirements-dev.txt'"
args:
[
"--without-hashes",
"-f",
"requirements.txt",
"-o",
"requirements-dev.txt",
"--with",
"dev",
"--no-hashes",
"--no-emit-project",
"--output-file=requirements-dev.txt",
]
27 changes: 17 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ Python installed on your machine. You can download the latest version of Python
from the [official website](https://www.python.org/downloads/) or using your
Operating system's package manager.

- I'd recommend using [pyenv](https://github.com/pyenv/pyenv) to manage your
Python installations, the
- We use [uv](https://docs.astral.sh/uv/) to manage our dependencies. You
should have this installed as well. You can install this by folllowing the
instructions on their website.

- If not using `uv` to manange your Python versions, I'd recommend using
[pyenv](https://github.com/pyenv/pyenv) to manage your Python installations, the
[pyenv-installer](https://github.com/pyenv/pyenv-installer) works for Linux and
Mac OS X. For Windows, you can use the
[pyenv-win](https://github.com/pyenv-win/pyenv-win) port. See
Expand All @@ -27,11 +31,6 @@ instructions.

- This project requires **Python 3.9** or higher.

- We also use [Poetry](https://python-poetry.org/) to manage our dependencies. You
should have this installed as well. You can install Poetry by following the
instructions on the [Poetry
website](https://python-poetry.org/docs/#installation).

## Getting Started

Before you start contributing, please make sure you have read and understood our
Expand All @@ -53,13 +52,21 @@ To get started, follow these steps:
Run the following command to install the required dependencies:

```console
$ poetry install
$ uv sync
```

You then need to activate the virtual environment:

```console
$ poetry shell
On Linux or Mac OS

```terminal
$ source .venv/bin/activate
```

On Windows

```terminal
$ .venv\Scripts\activate
```

From here you can start working on the project. If you are using an IDE such as
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,15 @@ feel free to make suggestions for improvements.
## Installation

You should install this package into a virtual environment. You can use
[uv](https://docs.astral.sh/uv/) (recommended), or
[Poetry](https://python-poetry.org/) to do this:

```console
$ uv add simple-toml-settings
```

or

```console
$ poetry add simple-toml-settings
```
Expand Down
12 changes: 10 additions & 2 deletions docs/installation.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
# Installation

You should install this package into a virtual environment. You can use
[Poetry](https://python-poetry.org/){:target="_blank"} to do this:
[uv](https://docs.astral.sh/uv/){:target = "_blank"} (recommended), or
[Poetry](https://python-poetry.org/){:target = "_blank"} to do this:

```console
$ uv add simple-toml-settings
```

or

```console
$ poetry add simple-toml-settings
```

If you don't want to use Poetry, you can use pip:
If you don't want to use Poetry, you can use pip from inside your virtual
environment:

```console
$ pip install simple-toml-settings
Expand Down
Loading

0 comments on commit a6c6d91

Please sign in to comment.