Skip to content

Commit 74323f1

Browse files
committed
INTPYTHON-380 Add task runner and project manager
1 parent eff7c03 commit 74323f1

File tree

6 files changed

+46
-110
lines changed

6 files changed

+46
-110
lines changed

.github/workflows/test-python.yml

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,22 @@ env:
1717
MONGODB_VERSION: "7.0"
1818

1919
jobs:
20-
pre-commit:
21-
runs-on: ubuntu-latest
20+
static:
21+
runs-on: "ubuntu-latest"
2222
steps:
23-
- uses: actions/checkout@v4
24-
with:
25-
persist-credentials: false
26-
- uses: actions/setup-python@v5
27-
- name: "Run pre-commit"
28-
run: |
29-
pip install -U -q pre-commit
30-
pre-commit run --all-files --hook-stage manual
23+
- uses: actions/checkout@v4
24+
with:
25+
persist-credentials: false
26+
fetch-depth: 0
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@v5
29+
with:
30+
enable-cache: true
31+
python-version: ${{ matrix.python-version }}
32+
- uses: extractions/setup-just@v2
33+
- run: just install
34+
- run: just lint
35+
- run: just docs
3136
build:
3237
runs-on: ${{ matrix.os }}
3338
strategy:
@@ -41,10 +46,12 @@ jobs:
4146
with:
4247
persist-credentials: false
4348
fetch-depth: 0
44-
- name: Setup Python
45-
uses: actions/setup-python@v5
49+
- name: Install uv
50+
uses: astral-sh/setup-uv@v5
4651
with:
52+
enable-cache: true
4753
python-version: ${{ matrix.python-version }}
54+
- uses: extractions/setup-just@v2
4855
- name: Start MongoDB on Linux
4956
if: ${{ startsWith(runner.os, 'Linux') }}
5057
run: |
@@ -67,10 +74,5 @@ jobs:
6774
mongod --remove
6875
mongod --install --dbpath=$(pwd)/data --logpath=$PWD/mongo.log
6976
net start MongoDB
70-
- name: Install package and pytest
71-
run: |
72-
python -m pip install .
73-
python -m pip install pytest
74-
- name: Run the tests
75-
run: |
76-
pytest .
77+
- run: just install
78+
- run: just test

.readthedocs.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,15 @@ build:
33
os: ubuntu-22.04
44
tools:
55
python: "3.11"
6+
jobs:
7+
create_environment:
8+
- asdf plugin add uv
9+
- asdf install uv latest
10+
- asdf global uv latest
11+
install:
12+
- uv sync
13+
build:
14+
html:
15+
- uv run sphinx-build -T -b html docs $READTHEDOCS_OUTPUT/html
616
sphinx:
717
configuration: docs/conf.py
8-
python:
9-
install:
10-
- requirements: docs/requirements.txt

CONTRIBUTING.md

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,34 +36,17 @@ actual bugs and improvement requests.
3636

3737
## Recommended development environment
3838

39-
- MacOS or Linux
40-
- Python 2.7
39+
We ust [justfile](https://just.systems/man/en/packages.html) for task running
40+
and [uv](https://docs.astral.sh/uv/getting-started/installation/) for python project management.
4141

42-
Using 2.7 ensures that you don't accidentally break Python2.7 support.
43-
Flask-PyMongo will support Python 2.7 for as long as it is an officially
44-
supported version of Python (util some time in 2020).
42+
To set up your dev environment, run `just install`.
4543

46-
- Run tests with [tox](https://tox.readthedocs.io/en/latest/), eg `tox -e
47-
pymongo30-mongo32-flask0_11`
44+
To run the tests, run `just test`. You can pass argments through to `pytest`.
4845

49-
Since the build matrix is very big, you may want to select a single
50-
or a few matrix versions to test. Run `tox -l` to see all the builds.
46+
To run the linters, run `just lint`.
5147

52-
All tests, against all supported versions, are run by
53-
[Travis-CI](https://travis-ci.org/dcrosta/flask-pymongo) for each commit
54-
and pull request.
48+
To build the docs, run `just docs` and open `_build/html/index.html` in your browser to view the docs.
5549

56-
- Check style compliance with `tox -e style`
57-
58-
59-
## Building the docs
60-
61-
Build the docs in the `docs` directory using Sphinx:
62-
63-
cd docs
64-
make html
65-
66-
Open `_build/html/index.html` in your browser to view the docs.
6750

6851
## Contributors
6952

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Flask-PyMongo provides helpers for some common tasks:
8383

8484
.. autoclass:: flask_pymongo.helpers.BSONObjectIdConverter
8585

86-
.. autoclass:: flask_pymongo.helpers.JSONEncoder
86+
.. autoclass:: flask_pymongo.helpers.BSONProvider
8787

8888
Configuration
8989
-------------

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,11 @@ unfixable = [
5959
"T20", # Removes print statements
6060
"F401", # Unused imports
6161
]
62+
63+
[dependency-groups]
64+
dev = [
65+
"markdown2>=2.5.2",
66+
"pre-commit>=4.0.1",
67+
"pytest>=8.3.4",
68+
"sphinx>=7.4.7",
69+
]

tox.ini

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

0 commit comments

Comments
 (0)