Skip to content

Commit d16506a

Browse files
author
Daniel Sanz
committed
Revert "fix: replace setuptools with hatchling (elementsinteractive#192)"
This reverts commit 24f8609.
1 parent 870434b commit d16506a

File tree

13 files changed

+1467
-1300
lines changed

13 files changed

+1467
-1300
lines changed

.github/workflows/lint.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,31 @@ jobs:
1212
lint:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v3
16+
- name: Set up Python 3.13
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: "3.13"
1620
- name: Install just
1721
run: |
1822
sudo apt update
1923
sudo snap install --edge --classic just
20-
- name: Install uv
21-
uses: astral-sh/setup-uv@v5
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
python -m pip install poetry
28+
poetry install
29+
2230
- name: Lint
2331
run: |
24-
just python_version="3.13" lint
32+
just lint
2533
2634
lint-commit:
2735
runs-on: ubuntu-latest
2836
name: "Lint commit message"
2937
steps:
3038
- name: Check out
31-
uses: actions/checkout@v4
39+
uses: actions/checkout@v3
3240
- name: Install commitizen
3341
run: |
3442
python -m pip install --upgrade pip

.github/workflows/publish.yml

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This workflow will publish our package on pypi, dockerhub, and create the release notes
1+
# This workflow will publish our package on pypi
22

33
name: Publish
44

@@ -11,28 +11,23 @@ permissions:
1111
contents: write
1212

1313
jobs:
14-
publish_to_pypi:
14+
push_to_pypi:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v4
18-
- name: Install uv
19-
uses: astral-sh/setup-uv@v5
17+
- uses: actions/checkout@v3
18+
- name: Publish python package
19+
uses: JRubics/poetry-publish@v2.1
2020
with:
21-
version: "0.6.3"
22-
- name: Publish to PyPi
23-
run: |
24-
uv build
25-
uv publish
26-
env:
27-
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
21+
pypi_token: ${{ secrets.PYPI_TOKEN }}
22+
poetry_install_options: "--without dev"
2823

2924
push_to_docker_hub:
30-
needs: publish_to_pypi
25+
needs: push_to_pypi
3126
name: Push Docker image to Docker Hub
3227
runs-on: ubuntu-latest
3328
steps:
3429
- name: Check out the repo
35-
uses: actions/checkout@v4
30+
uses: actions/checkout@v3
3631

3732
- name: Log in to Docker Hub
3833
uses: docker/login-action@v2

.github/workflows/security.yml

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,12 @@ on:
99
branches: ["main"]
1010

1111
jobs:
12-
generate-dependencies-file:
13-
runs-on: ubuntu-latest
14-
steps:
15-
- uses: actions/checkout@v4
16-
- name: Install uv
17-
uses: astral-sh/setup-uv@v5
18-
- name: Create dependencies file
19-
run: |
20-
UV_PROJECT_ENVIRONMENT=.venv uv sync
21-
UV_PROJECT_ENVIRONMENT=.venv uv pip freeze > requirements.txt
22-
- uses: actions/upload-artifact@v4
23-
with:
24-
name: requirements
25-
path: requirements.txt
26-
overwrite: true
27-
2812
osv-scanner:
29-
needs: generate-dependencies-file
3013
runs-on: ubuntu-latest
3114
container:
3215
image: ghcr.io/google/osv-scanner:v1.9.2
3316
steps:
34-
- uses: actions/download-artifact@v4
35-
with:
36-
name: requirements
17+
- uses: actions/checkout@v3
3718
- name: Run OSV Scanner
3819
run: |
3920
/osv-scanner --skip-git --format table -r .
@@ -42,21 +23,24 @@ jobs:
4223
container:
4324
image: returntocorp/semgrep:latest
4425
steps:
45-
- uses: actions/checkout@v4
26+
- uses: actions/checkout@v3
4627
- name: Run Semgrep
4728
run: |
4829
semgrep scan --config auto
4930
twyn:
50-
needs: generate-dependencies-file
5131
runs-on: ubuntu-latest
5232
steps:
53-
- uses: actions/checkout@v4
54-
- uses: actions/download-artifact@v4
33+
- uses: actions/checkout@v3
34+
- name: Set up Python
35+
uses: actions/setup-python@v4
5536
with:
56-
name: requirements
57-
- name: Install uv
58-
uses: astral-sh/setup-uv@v5
37+
python-version: "3.13"
38+
- name: Install dependencies
39+
run: |
40+
python -m pip install --upgrade pip
41+
python -m pip install poetry
42+
poetry install --only main
5943
- name: Run Twyn against our dependencies
6044
run: |
61-
uv run twyn --version
62-
uv run twyn run -vv
45+
poetry run twyn --version
46+
poetry run twyn run -vv

.github/workflows/test.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,21 @@ jobs:
1818
runs-on: [ubuntu-latest]
1919

2020
steps:
21-
- uses: actions/checkout@v4
21+
- uses: actions/checkout@v3
22+
- name: Set up Python
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: ${{ matrix.python-version }}
2226
- name: Install just
2327
run: |
2428
sudo apt update
2529
sudo snap install --edge --classic just
26-
- name: Install uv
27-
uses: astral-sh/setup-uv@v5
30+
- name: Install dependencies
31+
run: |
32+
python -m pip install --upgrade pip
33+
python -m pip install poetry
34+
poetry install
35+
2836
- name: Test with pytest
2937
run: |
30-
just python_version=${{ matrix.python-version }} test
38+
just test

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ For new feature proposals, please create first an issue to start a discussion ab
1010

1111
git clone git@github.com:<username>/twyn.git
1212
cd twyn/
13-
3. Make sure to have [uv](https://docs.astral.sh/uv/getting-started/installation/) installed in your system, as well as [just](https://github.com/casey/just).
13+
3. Make sure to have [poetry](https://python-poetry.org/) installed in your system, as well as [just](https://github.com/casey/just).
1414
4. Set up your working environment: create a virtual environment and install the project dependencies.
1515
The following command will do both:
1616

Dockerfile

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
FROM python:3.13-slim
22

3-
ARG USER=twyn
4-
ARG GROUP=twyn
5-
63
WORKDIR /app
74

85
RUN pip install twyn
96

10-
RUN groupadd -g 1001 ${GROUP} && \
11-
useradd -m -u 1001 -g ${GROUP} -s /bin/bash ${USER}
12-
13-
USER ${USER}:${GROUP}
14-
157
ENTRYPOINT ["twyn"]

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2025 Elements Interactive B.V.
3+
Copyright (c) 2023 Elements Interactive B.V.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

justfile

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
# VARIABLE DEFINITIONS
22
venv := ".venv"
3-
python_version :="3.13"
3+
bin := venv + "/bin"
4+
python := bin + "/python"
5+
python_version := "python3.13"
46
target_dirs := "src tests"
57

8+
9+
# SENTINELS
10+
venv-exists := path_exists(venv)
11+
612
# ALIASES
713
alias t := test
814

@@ -13,35 +19,32 @@ alias t := test
1319
help:
1420
just --list --unsorted
1521

16-
# Cleans all artifacts generated while running this project, including the virtualenv.
17-
venv:
18-
@UV_PROJECT_ENVIRONMENT={{ venv }} UV_PYTHON={{ python_version }} uv sync
22+
# Generate the virtual environment.
23+
venv:
24+
@if ! {{ venv-exists }}; \
25+
then \
26+
POETRY_VIRTUALENVS_IN_PROJECT=1 poetry env use {{ python_version }}; \
27+
poetry install; \
28+
fi
1929

2030
# Cleans all artifacts generated while running this project, including the virtualenv.
2131
clean:
2232
@rm -f .coverage*
2333
@rm -rf {{ venv }}
2434

2535
# Runs the tests with the specified arguments (any path or pytest argument).
26-
test *test-args='':
27-
@UV_PROJECT_ENVIRONMENT={{ venv }} UV_PYTHON={{ python_version }} uv run pytest {{ test-args }} --no-cov
36+
test *test-args='': venv
37+
poetry run pytest {{ test-args }} --no-cov
2838

2939
# Runs all tests including coverage report.
30-
test-all:
31-
@UV_PROJECT_ENVIRONMENT={{ venv }} UV_PYTHON={{ python_version }} uv run pytest
40+
test-all: venv
41+
poetry run pytest
3242

3343
# Format all code in the project.
34-
format:
35-
@UV_PROJECT_ENVIRONMENT={{ venv }} UV_PYTHON={{ python_version }} uv run ruff check {{ target_dirs }} --fix
44+
format: venv
45+
poetry run ruff check {{ target_dirs }} --fix
3646

3747
# Lint all code in the project.
38-
lint:
39-
@UV_PROJECT_ENVIRONMENT={{ venv }} UV_PYTHON={{ python_version }} uv run ruff check {{ target_dirs }}
40-
@UV_PROJECT_ENVIRONMENT={{ venv }} UV_PYTHON={{ python_version }} uv run mypy {{ target_dirs }}
41-
42-
43-
# Generate requirements.txt file
44-
dependencies:
45-
@UV_PROJECT_ENVIRONMENT={{ venv }} UV_PYTHON={{ python_version }} uv sync
46-
@UV_PROJECT_ENVIRONMENT={{ venv }} UV_PYTHON={{ python_version }} uv pip freeze > requirements.txt
47-
48+
lint: venv
49+
poetry run ruff check {{ target_dirs }}
50+
poetry run mypy {{ target_dirs }}

0 commit comments

Comments
 (0)