Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uv, tox and Python 3.12 #168

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
20 changes: 20 additions & 0 deletions docs/xocto/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,26 @@ of this workflow:
This is why typically in shared projects version releases are separated into
their own pull requests.

## Altering dependencies

* Edit `pyproject.toml`.
* `make sync_requirements` to refresh `requirements.txt`.
* `make install test format_check lint_check mypy`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably worth copying the makefile targets from the CookieCutterPackage repo:
https://github.com/octoenergy/cookiecutter-kraken-package/blob/main/%7B%7B%20cookiecutter.repo_name%20%7D%7D/makefile


When you are ready, commit both `pyproject.toml` and
`requirements.txt`.

## tox

Run [tox](https://tox.wiki/) to test the package on supported versions
of Python.

Each versions of Python listed in `tox.ini` must be present on your
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐼 "version"

system. On Linux it is probably easiest to build each version from
source, using `make altinstall`.
If you use Mac you can install each version using homebrew e.g.,
`brew install python@3.9`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


## Publishing

### Version number
Expand Down
6 changes: 4 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
install:
pip install pip==23.3.1
pip install -e '.[dev,docs]'
pip install uv==0.2.34
uv pip install -r requirements.txt --editable .
Copy link
Contributor Author

@quicklizard99 quicklizard99 Aug 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer this to be uv pip sync requirements.txt but without --editable . CI fails with importlib.metadata.PackageNotFoundError: xocto.


sync_requirements:
uv pip compile --output-file=requirements.txt --extra=dev pyproject.toml

# CI step wrappers

Expand Down
47 changes: 26 additions & 21 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
license = {text = "MIT"}
dependencies = [
Expand All @@ -41,27 +42,29 @@ dependencies = [

[project.optional-dependencies]
dev = [
"boto3==1.26.53",
"botocore==1.29.53",
"hypothesis==6.62.1",
"moto[s3,sqs]==4.1",
"mypy-boto3-s3==1.34.120",
"mypy==1.10.0",
"numpy==1.22.2",
"pre-commit>=3.7.1",
"psycopg2>=2.8.4",
"pyarrow-stubs==10.0.1.6",
"pytest-django==4.8.0",
"pytest-mock==3.12.0",
"pytest==8.0.2",
"ruff==0.4.9",
"time-machine==2.14.1",
"twine==4.0.2",
"types-openpyxl==3.0.4.5",
"types-python-dateutil==2.8.19.20240106",
"types-pytz==2024.1.0.20240203",
"types-requests==2.28.11.8",
"wheel==0.38.4",
"boto3",
"botocore",
"hypothesis",
"moto[s3,sqs]",
"mypy-boto3-s3",
"mypy",
"numpy>=1.26.4",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's worth a comment to explain why we need the version filter.

"pre-commit",
"psycopg2",
"pyarrow-stubs>=10.0.1.9",
"pytest-django",
"pytest-mock",
"pytest",
"ruff",
"time-machine",
"tox",
"tox-uv",
"twine",
"types-openpyxl",
"types-python-dateutil",
"types-pytz",
"types-requests",
"wheel",
]
docs = [
"Sphinx==7.2.6",
Expand Down Expand Up @@ -207,6 +210,8 @@ section-order = [
filterwarnings = [
"error::RuntimeWarning",
"error::DeprecationWarning",
"ignore:datetime.datetime.utcfromtimestamp\\(\\) is deprecated and scheduled for removal in a future version:DeprecationWarning",
"ignore:datetime.datetime.utcnow\\(\\) is deprecated and scheduled for removal in a future version:DeprecationWarning",
"ignore:defusedxml.lxml:DeprecationWarning:zeep",
"ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3:DeprecationWarning:(graphene|singledispatch)",
# https://github.com/ktosiek/pytest-freezegun/issues/35
Expand Down
Loading