Skip to content

Commit b0d0eb2

Browse files
authored
feat: migrate from poetry to uv (#3)
2 parents 434a514 + 3eba346 commit b0d0eb2

File tree

16 files changed

+1836
-1636
lines changed

16 files changed

+1836
-1636
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,52 +8,49 @@ on:
88
- master
99
jobs:
1010
test:
11-
runs-on: ubuntu-latest
11+
runs-on: ubuntu-22.04
1212
services:
1313
mssql:
14-
image: mcr.microsoft.com/mssql/server:2019-CU15-ubuntu-20.04
14+
image: mcr.microsoft.com/mssql/server:2022-CU15-ubuntu-22.04
1515
ports:
1616
- 1433:1433
1717
env:
1818
ACCEPT_EULA: Y
1919
SA_PASSWORD: Abcd12345678
2020
options: >-
21-
--health-cmd "/opt/mssql-tools/bin/sqlcmd -U sa -P Abcd12345678 -Q 'select 1' -b -o /dev/null"
21+
--health-cmd "/opt/mssql-tools18/bin/sqlcmd -C -S localhost -U sa -P Abcd12345678 -Q 'SELECT 1' -b -o /dev/null"
2222
--health-interval 10s
2323
--health-timeout 5s
2424
--health-retries 5
2525
env:
2626
TEST_MSSQL_PASS: Abcd12345678
2727
strategy:
2828
matrix:
29-
python-version: [ "3.8", "3.9", "3.10" ]
29+
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13", "3.14" ]
3030
steps:
31-
- uses: actions/cache@v2
32-
with:
33-
path: ~/.cache/pip
34-
key: ${{ runner.os }}-pip-${{ hashFiles('**/poetry.lock') }}
35-
restore-keys: |
36-
${{ runner.os }}-pip-
37-
- uses: actions/checkout@v2
38-
- uses: actions/setup-python@v2
31+
- uses: actions/checkout@v5
32+
- uses: actions/setup-python@v6
3933
with:
4034
python-version: ${{ matrix.python-version }}
41-
- name: Install and configure Poetry
42-
run: |
43-
pip install -U pip poetry
44-
poetry config virtualenvs.create false
45-
- name: Install requirements
46-
run: make deps
35+
allow-prereleases: true
4736
- name: Install ODBC driver
4837
run: |
49-
sudo curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
50-
sudo curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list -o /etc/apt/sources.list.d/mssql-release.list
38+
curl -sSL -O https://packages.microsoft.com/config/ubuntu/$(grep VERSION_ID /etc/os-release | cut -d '"' -f 2)/packages-microsoft-prod.deb
39+
sudo dpkg -i packages-microsoft-prod.deb
5140
sudo apt-get update
52-
ACCEPT_EULA=Y sudo apt-get install -y msodbcsql18
53-
- name: Run ci
54-
run: make ci
41+
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18
42+
- uses: astral-sh/setup-uv@v7
43+
with:
44+
enable-cache: true
45+
activate-environment: true
46+
- name: Install requirements
47+
run: make deps
48+
- name: Check style
49+
run: make check
50+
- name: Run tests
51+
run: make testall
5552
- name: Upload Coverage
56-
run: coveralls --service=github
53+
run: uvx coveralls --service=github
5754
env:
5855
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5956
COVERALLS_FLAG_NAME: ${{ matrix.python-version }}
@@ -62,8 +59,7 @@ jobs:
6259
coveralls:
6360
name: Finish Coveralls
6461
needs: test
65-
runs-on: ubuntu-latest
66-
container: python:3-slim
62+
runs-on: ubuntu-22.04
6763
steps:
6864
- name: Finished
6965
run: |

.github/workflows/pypi.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ jobs:
77
publish:
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v2
11-
- uses: actions/setup-python@v1
10+
- uses: actions/checkout@v5
11+
- uses: actions/setup-python@v6
1212
with:
1313
python-version: '3.x'
14-
- name: Install and configure Poetry
14+
- name: Install dependencies
1515
run: |
16-
pip install -U pip poetry
17-
poetry config virtualenvs.create false
18-
- name: Build dists
19-
run: make build
16+
python -m pip install --upgrade pip
17+
pip install build
18+
- name: Build package
19+
run: python -m build
2020
- name: Pypi Publish
21-
uses: pypa/gh-action-pypi-publish@master
21+
uses: pypa/gh-action-pypi-publish@release/v1
2222
with:
2323
user: __token__
2424
password: ${{ secrets.pypi_password }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,4 @@ sqlite.db
7070
# virtual envs
7171
venv*/
7272
virtualenv*/
73+
.venv*/

CONTRIBUTING.rst

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,24 +55,29 @@ There are several ways to make a virtual environment.
5555
If you like to use *virtualenv* please run::
5656

5757
$ cd asyncodbc
58-
$ virtualenv --python=`which python3.5` venv
58+
$ virtualenv --python=`which python3.13` venv
5959

6060
For standard python *venv*::
6161

6262
$ cd asyncodbc
63-
$ python3.5 -m venv venv
63+
$ python3.13 -m venv venv
6464

6565
For *virtualenvwrapper*::
6666

6767
$ cd asyncodbc
68-
$ mkvirtualenv --python=`which python3.5` asyncodbc
68+
$ mkvirtualenv --python=`which python3.13` asyncodbc
69+
70+
For *uv*::
71+
72+
$ cd asyncodbc
73+
$ uv venv --python=3.13 --prompt=asyncodbc-py3.13
6974

7075
There are other tools like *pyvenv* but you know the rule of thumb
71-
now: create a python3.5 virtual environment and activate it.
76+
now: create a python3 virtual environment and activate it.
7277

7378
After that please install libraries required for development::
7479

75-
$ pip install -r requirements-dev.txt
80+
$ pip install -r pyproject.toml --group dev --group test -e .
7681

7782
We also recommend to install *ipdb* but it's on your own::
7883

@@ -93,16 +98,16 @@ Run asyncodbc test suite
9398
After all the preconditions are met you can run tests typing the next
9499
command::
95100

96-
$ make test
101+
$ make ci
97102

98103
Or if you want to run only one particular test::
99104

100-
$ py.test tests/test_connection.py -k test_basic_cursor
105+
$ pytest tests/test_connection.py -k test_basic_cursor
101106

102107
The command at first will run the static and style checkers (sorry, we don't
103108
accept pull requests with `pep8` or `pyflakes` errors).
104109

105-
On `flake8` success the tests will be run.
110+
On `ruff` success the tests will be run.
106111

107112
Please take a look on the produced output.
108113

@@ -116,7 +121,7 @@ We are trying hard to have good test coverage; please don't make it worse.
116121

117122
Use::
118123

119-
$ make cov
124+
$ make testall
120125

121126
to run test suite and collect coverage information. Once the command
122127
has finished check your coverage at the file that appears in the last
@@ -133,10 +138,11 @@ We encourage documentation improvements.
133138

134139
Please before making a Pull Request about documentation changes run::
135140

136-
$ make doc
141+
$ pip install --group docs
142+
$ make docs
137143

138144
Once it finishes it will output the index html page
139-
``open file:///.../asyncodbc/docs/_build/html/index.html``.
145+
``open file:///.../asyncodbc/build/html/index.html``.
140146

141147
Go to the link and make sure your doc changes looks good.
142148

@@ -147,5 +153,5 @@ After finishing all steps make a GitHub_ Pull Request, thanks.
147153

148154

149155
.. _unixODBC: http://www.unixodbc.org/
150-
.. _GitHub: https://github.com/aio-libs/asyncodbc
156+
.. _GitHub: https://github.com/aio-libs/aioodbc
151157
.. _docker: https://docs.docker.com/engine/installation/

MANIFEST.in

Lines changed: 0 additions & 5 deletions
This file was deleted.

Makefile

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,52 @@ py_warn = PYTHONDEVMODE=1
33
pytest_opts = -n auto --cov=asyncodbc --tb=native -q
44

55
up:
6-
@poetry update
6+
@uv lock --upgrade
77

88
deps:
9-
@poetry install
9+
@uv sync --inexact --all-extras --all-groups --no-group docs $(options)
1010

11-
check: deps build
12-
ifneq ($(shell which black),)
13-
black --check $(checkfiles) || (echo "Please run 'make style' to auto-fix style issues" && false)
14-
endif
15-
pflake8 $(checkfiles)
11+
_style:
12+
@ruff format $(checkfiles)
13+
@ruff check --fix $(checkfiles)
14+
style: deps _style
15+
16+
_codeqc:
1617
#mypy $(checkfiles)
17-
#pylint -d C,W,R $(checkfiles)
18-
#bandit -r $(checkfiles)
18+
bandit -c pyproject.toml -r $(checkfiles)
1919
twine check dist/*
20+
codeqc: build _codeqc
21+
22+
_check: _build
23+
@ruff format --check $(checkfiles) || (echo "Please run 'make style' to auto-fix style issues" && false)
24+
@ruff check $(checkfiles)
25+
$(MAKE) _codeqc
26+
check: deps _check
2027

28+
_lint: _build _style _codeqc
29+
lint: deps _lint
2130

22-
test_mssql: deps
31+
test: deps test_mssql
32+
33+
test_mssql:
2334
$(py_warn) TEST_DSN="DRIVER=ODBC Driver 18 for SQL Server;SERVER=127.0.0.1,1433;UID=sa;PWD=$(TEST_MSSQL_PASS);TrustServerCertificate=YES;MARS_Connection=YES" pytest $(pytest_opts)
2435

2536
_testall: test_mssql
2637

2738
testall: deps _testall
2839
coverage report
2940

30-
ci: check testall
41+
ci: check _testall
3142

3243
docs: deps
44+
uv pip install --group docs
3345
rm -fR ./build
3446
sphinx-build -M html docs build
3547

36-
style: deps
37-
isort -src $(checkfiles)
38-
black $(checkfiles)
39-
40-
build: deps
48+
_build:
4149
rm -fR dist/
42-
poetry build
50+
uv build
51+
build: deps _build
4352

4453
publish: deps build
4554
twine upload dist/*

README.rst

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
asyncodbc
22
=========
3-
.. image:: https://travis-ci.com/tortoise/asyncodbc.svg?branch=master
3+
.. image:: https://travis-ci.com/tortoise/asyncodbc.svg?branch=main
44
:target: https://travis-ci.com/tortoise/asyncodbc
5-
.. image:: https://coveralls.io/repos/tortoise/asyncodbc/badge.svg?branch=master&service=github
6-
:target: https://coveralls.io/github/tortoise/asyncodbc?branch=master
5+
.. image:: https://coveralls.io/repos/tortoise/asyncodbc/badge.svg?branch=main&service=github
6+
:target: https://coveralls.io/github/tortoise/asyncodbc?branch=main
77
.. image:: https://img.shields.io/pypi/v/asyncodbc.svg
88
:target: https://pypi.python.org/pypi/asyncodbc
99

10-
**asyncodbc** is a Python 3.5+ module that makes it possible to access ODBC_ databases
10+
**asyncodbc** is a Python 3.9+ module that makes it possible to access ODBC_ databases
1111
with asyncio_. It relies on the awesome pyodbc_ library and preserves the same look and
12-
feel. *asyncodbc* was written using `async/await` syntax (PEP492_) and thus is not compatible
13-
with Python versions older than 3.5. Internally *asyncodbc* employs threads to avoid
12+
feel. *asyncodbc* was written using `async/await` syntax (PEP492_) and only support
13+
Python that is not end-of-life(EOL). Internally *asyncodbc* employs threads to avoid
1414
blocking the event loop, threads_ are not that as bad as you think!. Other
1515
drivers like motor_ use the same approach.
1616

@@ -137,7 +137,7 @@ Run tests
137137
For testing purposes you need to install docker_ and the development
138138
requirements::
139139

140-
$ pip install -r requirements-dev.txt
140+
$ pip install -r pyproject.toml --group test -e .
141141

142142
In order to simplify development you should install the provided docker container.
143143
This way you don't need to install any databases or other system libraries, everything happens inside the container.
@@ -150,31 +150,32 @@ Then just execute::
150150
The test will automatically pull images and build containers with
151151
the required databases.
152152

153-
*NOTE:* Running tests requires Python 3.6 or higher.
153+
*NOTE:* Running tests requires Python 3.9 or higher.
154154

155155

156156
Other SQL Drivers
157157
-----------------
158158

159-
* aiopg_ - asyncio client for PostgreSQL
159+
* asyncpg_ - asyncio client for PostgreSQL
160160
* aiomysql_ - asyncio client form MySQL
161161

162162

163163
Requirements
164164
------------
165165

166-
* Python_ 3.5+
166+
* Python_ 3.9+
167167
* pyodbc_
168168
* uvloop_ (optional)
169169

170170

171171
.. _Python: https://www.python.org
172-
.. _asyncio: http://docs.python.org/3.4/library/asyncio.html
172+
.. _asyncio: http://docs.python.org/3.14/library/asyncio.html
173173
.. _pyodbc: https://github.com/mkleehammer/pyodbc
174174
.. _uvloop: https://github.com/MagicStack/uvloop
175175
.. _ODBC: https://en.wikipedia.org/wiki/Open_Database_Connectivity
176-
.. _aiopg: https://github.com/tortoise/aiopg
177-
.. _aiomysql: https://github.com/tortoise/aiomysql
176+
.. _asyncpg: https://github.com/MagicStack/asyncpg
177+
.. _aiopg: https://github.com/aio-libs/aiopg
178+
.. _aiomysql: https://github.com/aio-libs/aiomysql
178179
.. _PEP492: https://www.python.org/dev/peps/pep-0492/
179180
.. _unixODBC: http://www.unixodbc.org/
180181
.. _threads: http://techspot.zzzeek.org/2015/02/15/asynchronous-python-and-databases/

0 commit comments

Comments
 (0)