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
48 changes: 18 additions & 30 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,66 +43,55 @@ When creating each pull request, it is crucial to adhere to the provided
instructions:

01. [Fork][fork] the repo and clone it to your machine.
02. Go to the project's root directory to create the virtual environment and
activate it:
02. Go to the project's root directory and sync development dependencies with
[uv][uv]:

```console
$ python -m venv .venv && . .venv/bin/activate
$ uv sync --locked
```

> In order to precisely reproduce the development environment, it is
> recommended to use the Python version specified in
> [`.python-version`][python-version]. The version given therein is checked
> out by default in all the CI environments.
> The command above creates a local virtual environment (`.venv`) and
> installs all dependencies required for development. If a compatible
> Python version is not available on your machine, `uv` will resolve and
> install one automatically.

03. Install the package in editable (development) mode, along with all the
optional dependencies:
03. Install [Pre-commit][pre-commit] hooks:

```console
$ pip install -e ".[dev,docs,lint,test]"
$ uv run pre-commit install
```

04. Install [Pre-commit][pre-commit] hooks:
04. Run linters and tests using [Nox][nox]:

```console
$ pre-commit install
```

05. Run linters and tests using [Nox][nox]:

```console
$ nox
$ uv run nox
```

This will check your fork's setup, the code quality with linters, run the
existing tests in different Python environments, and measure the coverage.

> Note that you should have all the versions of Python installed on your
> machine. Consider using [`pyenv`][pyenv] to work with multiple Python
> interpreters.

If you want to be more specific, you can only run the linting or testing
suites via the respective Nox sessions. All the available sessions can be
listed using the command:

```console
$ nox -l
$ uv run nox -l
```

For more details, see [`noxfile.py`][noxfile] and [Nox docs][nox-docs].
Besides, note that all the linters and testing tools are installed in the
virtual environment anyway. Therefore, feel absolutely free to use them
independently of Nox as well.
local uv-managed virtual environment. Therefore, feel absolutely free to
invoke them independently of Nox via `uv run`, e.g., `uv run ruff check .`.

06. Check out a new feature branch and introduce changes.
05. Check out a new feature branch and introduce changes.

> All the changes affecting the codebase must be accompanied by relevant
> unit tests and documentation updates. We always attempt to maintain 100%
> test coverage, and we require that from all pull requests as well. Those
> with tests missing (if they are needed, of course) have exactly zero
> chance of being merged!

07. Run Nox.
06. Run Nox.

If all the Nox sessions are successful and the changes are covered by tests,
commit your changes and push them to remote.
Expand All @@ -112,7 +101,7 @@ instructions:
> test everything locally before pushing to remote and opening a pull
> request.

08. [Create a pull request][create-pull-request] from the feature branch of your
07. [Create a pull request][create-pull-request] from the feature branch of your
fork to the `main` branch of the original repository.

> Don't forget to mark the pull request with an appropriate Gitmoji! 😜
Expand All @@ -135,5 +124,4 @@ project's maintainers as soon as possible. 🧐
[open-feature-request]: https://github.com/paduszyk/python-gitmojis/issues/new?template=feature-request.yml
[open-issue]: https://github.com/paduszyk/python-gitmojis/issues/new/choose
[pre-commit]: https://pre-commit.com
[pyenv]: https://github.com/pyenv/pyenv
[python-version]: https://github.com/paduszyk/python-gitmojis/blob/main/.python-version
[uv]: https://docs.astral.sh/uv/
26 changes: 10 additions & 16 deletions .github/workflows/build-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,16 @@ jobs:
steps:
- name: Check out 🎉
uses: actions/checkout@v4.2.2
- name: Set up Python 🐍
uses: actions/setup-python@v5.3.0
- name: Set up uv 🐍
uses: astral-sh/setup-uv@v9.0.0
with:
cache: pip
enable-cache: true
- name: Install Nox 📦
run: |
python -m pip install --upgrade pip
python -m pip install nox
uv sync --only-group=nox --locked
- name: Run Nox 🦊
run:
nox -s ${{ matrix.session }}
uv run nox -s ${{ matrix.session }}
test:
name: Run tests
runs-on: ${{ matrix.platform }}
Expand All @@ -52,21 +51,16 @@ jobs:
steps:
- name: Check out 🎉
uses: actions/checkout@v4.2.2
- name: Set up Python 🐍
uses: actions/setup-python@v5.3.0
- name: Set up uv 🐍
uses: astral-sh/setup-uv@v9.0.0
with:
python-version: |
3.10
3.11
3.12
cache: pip
enable-cache: true
- name: Install Nox 📦
run: |
python -m pip install --upgrade pip
python -m pip install nox
uv sync --only-group=nox --locked
- name: Run Nox 🦊
run:
nox -s test
uv run nox -s test
- name: Upload coverage reports to Codecov ⛱️
if: ${{ matrix.platform == 'ubuntu-latest' }}
uses: codecov/codecov-action@v5.1.2
Expand Down
22 changes: 8 additions & 14 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ jobs:
steps:
- name: Check out 🎉
uses: actions/checkout@v4.2.2
- name: Set up Python 🐍
uses: actions/setup-python@v5.3.0
- name: Set up uv 🐍
uses: astral-sh/setup-uv@v9.0.0
with:
cache: pip
enable-cache: true
- name: Get the package version 🔖
id: package-version
run:
echo "package-version=$(python ./scripts/package_version.py)" >> "$GITHUB_OUTPUT"
run: echo "package-version=$(uv run python ./scripts/package_version.py)" >> "$GITHUB_OUTPUT"
pypi-publish:
needs: get-release-tag
name: Upload to PyPI
Expand All @@ -32,17 +31,12 @@ jobs:
steps:
- name: Check out 🎉
uses: actions/checkout@v4.2.2
- name: Set up Python 🐍
uses: actions/setup-python@v5.3.0
- name: Set up uv 🐍
uses: astral-sh/setup-uv@v9.0.0
with:
cache: pip
- name: Install PyPA `build` package 📦
run: |
python -m pip install --upgrade pip
python -m pip install build
enable-cache: true
- name: Build the package 👷
run:
python -m build
run: uv build
- name: Publish to PyPI 🚀
uses: pypa/gh-action-pypi-publish@v1.12.3
create-release-tag:
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/sync-api-backup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@ jobs:
steps:
- name: Check out 🎉
uses: actions/checkout@v4.2.2
- name: Set up Python 🐍
uses: actions/setup-python@v5.3.0
- name: Set up uv 🐍
uses: astral-sh/setup-uv@v9.0.0
with:
cache: pip
enable-cache: true
- name: Install the package 📦
run: |
python -m pip install --upgrade pip
python -m pip install -e .
uv sync --no-dev --locked
- name: Run the `sync` command 🚀
run:
gitmojis sync
uv run gitmojis sync
- name: Create pull request 🎉
uses: peter-evans/create-pull-request@v7.0.5
with:
Expand Down
19 changes: 9 additions & 10 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
import nox
import nox_uv

# Nox sessions and configuration
# https://nox.thea.codes/en/stable/config.html

nox.options.default_venv_backend = "uv"

@nox.session()

@nox_uv.session(uv_only_groups=["black"])
def black(session: nox.Session) -> None:
session.install("black")
session.run("black", "--check", "--diff", ".")


@nox.session()
@nox_uv.session(uv_groups=["mypy"])
def mypy(session: nox.Session) -> None:
session.install("-e", ".")
session.install("mypy")
session.run("mypy", "--install-types", "--non-interactive", ".")


@nox.session()
@nox_uv.session(uv_only_groups=["ruff"])
def ruff(session: nox.Session) -> None:
session.install("ruff")
session.run("ruff", "check", "--diff", ".")


@nox.session(
@nox_uv.session(
uv_groups=["test"],
python=[
"3.10",
"3.11",
"3.12",
]
],
)
def test(session: nox.Session) -> None:
session.install("-e", ".[test]")
session.run("pytest")
51 changes: 33 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,47 @@ classifiers = [
]
requires-python = ">= 3.10"
dependencies = [
"click",
"requests",
"click>=8.4.2,<9.0.0",
"requests>=2.34.2,<3.0.0",
]

[project.optional-dependencies]
[project.scripts]
"gitmojis" = "gitmojis.__main__:main"

[dependency-groups]
black = [
"black>=26.5.1,<27.0.0",
]
dev = [
"nox",
"pre-commit",
{ include-group = "black" },
{ include-group = "local" },
{ include-group = "nox" },
{ include-group = "mypy" },
{ include-group = "ruff" },
{ include-group = "test" },
]
local = [
"pre-commit>=4.6.1,<5.0.0",
]
lint = [
"black",
"mypy",
"ruff",
"types-requests",
nox = [
"nox>=2026.7.11,<2027.0.0",
"nox-uv>=0.8.0",
]
ruff = [
"ruff>=0.15.22,<0.16.0",
]
mypy = [
"mypy>=2.3.0,<3.0.0",
"types-requests>=2.33.0.20260712,<3.0.0.0",
]
test = [
"pytest",
"pytest-click",
"pytest-cov",
"pytest-custom-exit-code",
"pytest-mock",
"pytest>=9.1.1,<10.0.0",
"pytest-click>=1.1.0,<2.0.0",
"pytest-cov>=7.1.0,<8.0.0",
"pytest-custom-exit-code>=0.3.0,<0.4.0",
"pytest-mock>=3.15.1,<4.0.0",
]

[project.scripts]
"gitmojis" = "gitmojis.__main__:main"

[tool.setuptools.packages.find]
include = ["gitmojis*"]
where = ["src"]
Expand Down
Loading
Loading