Skip to content

Commit 323709b

Browse files
committed
Upgrade to uv
1 parent 17fd332 commit 323709b

File tree

7 files changed

+429
-835
lines changed

7 files changed

+429
-835
lines changed

.pre-commit-config.yaml

+4-18
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ repos:
2424
- id: check-yaml
2525

2626
- repo: https://github.com/codespell-project/codespell
27-
rev: v2.3.0
27+
rev: v2.4.1
2828
hooks:
2929
- id: codespell
3030
description: Checks for common misspellings.
@@ -41,20 +41,20 @@ repos:
4141
types: [python]
4242

4343
- repo: https://github.com/psf/black
44-
rev: 24.10.0
44+
rev: 25.1.0
4545
hooks:
4646
- id: black
4747
types_or: [python, pyi]
4848
entry: "black"
4949

5050
- repo: https://github.com/astral-sh/ruff-pre-commit
51-
rev: v0.8.4
51+
rev: v0.11.4
5252
hooks:
5353
- id: ruff
5454
args: ["--fix"]
5555

5656
- repo: https://github.com/pre-commit/mirrors-mypy
57-
rev: v1.14.0
57+
rev: v1.15.0
5858
hooks:
5959
- id: mypy
6060
args: [--no-strict-optional, --ignore-missing-imports, --warn-no-return, --explicit-package-bases]
@@ -65,17 +65,3 @@ repos:
6565
rev: 0.8.1
6666
hooks:
6767
- id: nbstripout
68-
69-
##############################################################################
70-
# Javascript formatting and linting
71-
##############################################################################
72-
- repo: https://github.com/pre-commit/mirrors-jshint
73-
rev: "v2.13.6"
74-
hooks:
75-
- id: jshint
76-
77-
- repo: https://github.com/pre-commit/mirrors-prettier
78-
rev: "v4.0.0-alpha.8"
79-
hooks:
80-
- id: prettier
81-
args: ["--print-width", "160"]

Dockerfile

+9-14
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,25 @@ ENV PYTHONUNBUFFERED=1 \
44
PIP_NO_CACHE_DIR=off \
55
PIP_DISABLE_PIP_VERSION_CHECK=on \
66
PIP_DEFAULT_TIMEOUT=100 \
7-
POETRY_VERSION=1.8.5 \
8-
POETRY_HOME="/opt/poetry" \
9-
POETRY_VIRTUALENVS_CREATE=false \
10-
POETRY_NO_INTERACTION=1 \
117
PYSETUP_PATH="/opt/pysetup"
12-
ENV PATH="/root/.cargo/bin:$POETRY_HOME/bin:$PATH"
8+
ENV PATH="/root/.local/bin:/root/.cargo/bin:$PATH"
139
WORKDIR $PYSETUP_PATH
1410

1511
FROM base AS builder
1612

1713
# Install build deps
18-
RUN apt-get update && apt-get install -y curl clang git libssl-dev make pkg-config
14+
RUN apt-get update && \
15+
apt-get install -y curl clang gcc git libssl-dev make pkg-config && \
16+
apt-get clean && \
17+
rm -rf /var/lib/apt/lists/*
1918

20-
# Install Rust stable
21-
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
22-
23-
# Install poetry
24-
RUN curl -sSL https://install.python-poetry.org | python3 -
19+
# Install UV
20+
COPY uv-version ./
21+
RUN UV_VERSION=$(cat uv-version) && curl -LsSf https://astral.sh/uv/$UV_VERSION/install.sh | sh
2522

2623
# Install project
27-
COPY pyproject.toml poetry.lock ./
28-
RUN poetry install --only main
2924
COPY . ./
30-
RUN poetry install
25+
RUN uv pip install . --system
3126

3227
FROM base AS application
3328

Makefile

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
PROJECT?= nautechsystems/nautilus_data
2-
REGISTRY?= ghcr.io/
3-
IMAGE?= ${REGISTRY}${PROJECT}
4-
GIT_TAG:= $(shell git rev-parse --abbrev-ref HEAD)
5-
IMAGE_FULL?= ${IMAGE}:${GIT_TAG}
6-
PYTHON_EXECUTABLE:= $(shell which python3)
7-
NAUTILUS_PATH:= "${HOME}/.nautilus"
1+
PROJECT?=nautechsystems/nautilus_data
2+
REGISTRY?=ghcr.io/
3+
IMAGE?=${REGISTRY}${PROJECT}
4+
GIT_TAG:=$(shell git rev-parse --abbrev-ref HEAD)
5+
IMAGE_FULL?=${IMAGE}:${GIT_TAG}
6+
PYTHON_EXECUTABLE:=$(shell which python3)
7+
NAUTILUS_PATH:="${HOME}/.nautilus"
88

99
########################################
1010
# Docker development commands

poetry.lock

-741
This file was deleted.

pyproject.toml

+69-55
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,65 @@
1-
[tool.poetry]
1+
[project]
22
name = "nautilus_data"
3-
version = "0.15.0"
4-
description = ""
5-
authors = ["Nautech Systems <[email protected]>"]
6-
7-
[tool.poetry.dependencies]
8-
python = ">=3.11,<3.13"
9-
nautilus_trader = ">=1.209.0"
10-
requests = "^2.32"
3+
version = "0.16.0"
4+
description = "Example data for use with NautilusTrader"
5+
authors = [
6+
{name = "Nautech Systems", email = "[email protected]"},
7+
]
8+
requires-python = "~=3.12"
9+
dependencies = [
10+
"nautilus_trader>=1.215.0",
11+
"requests>=2.32.0,<3.0.0",
12+
]
1113

1214
[build-system]
13-
requires = ["poetry-core>=1.9.1"]
14-
build-backend = "poetry.core.masonry.api"
15+
requires = ["hatchling"]
16+
build-backend = "hatchling.build"
17+
18+
[tool.hatch.metadata]
19+
allow-direct-references = true
20+
21+
[tool.uv.sources]
22+
nautilus_trader = { index = "nautechsystems" }
23+
24+
[[tool.uv.index]]
25+
name = "nautechsystems"
26+
url = "https://packages.nautechsystems.io/simple"
27+
28+
##########################################################
29+
# Formatter configs #
30+
##########################################################
31+
[tool.black]
32+
target_version = ["py312"]
33+
line_length = 100
1534

35+
[tool.docformatter]
36+
black = true
37+
make-summary-multi-line = true
38+
pre-summary-new-line = true
39+
blank = true
40+
recursive = true
41+
in-place = true
42+
43+
##########################################################
44+
# Linter configs #
45+
##########################################################
1646
[tool.ruff]
17-
target-version = "py311"
47+
target-version = "py312"
1848
line-length = 100
49+
50+
exclude = [
51+
".benchmarks",
52+
".eggs",
53+
".git",
54+
".mypy_cache",
55+
".pytest_cache",
56+
".ruff_cache",
57+
".venv",
58+
"dist",
59+
"venv",
60+
]
61+
62+
[tool.ruff.lint]
1963
select = [
2064
"C4",
2165
"E",
@@ -63,71 +107,41 @@ ignore = [
63107
"D416", # Section name should end with a colon ('Warnings:', not 'Warnings') (incorrect?)
64108
"E741", # Ambiguous variable name (single char)
65109
"PD901", # `df` is a bad variable name. Be kinder to your future self
110+
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
66111
"S101", # Use of assert detected (OK in test suite)
67-
"S105", # Use of hardcoded password (spurious)
68-
"S106", # Use of hardcoded password (spurious)
112+
"S105", # Use of hard-coded password (spurious)
113+
"S106", # Use of hard-coded password (spurious)
69114
"S113", # Probable use of requests call without timeout **fix**
115+
"S603", # `subprocess` call: check for execution of untrusted input **fix**
70116
]
71117

72118
# Allow autofix for all enabled rules (when `--fix`) is provided
73-
fixable = [
74-
"A",
75-
"B",
76-
"C",
77-
"C4",
78-
"D",
79-
"DTZ",
80-
"E",
81-
"F",
82-
"UP",
83-
"S",
84-
"W",
85-
"I",
86-
"PIE",
87-
"PT",
88-
"PYI",
89-
"RSE",
90-
"TID",
91-
"ARG",
92-
"PD",
93-
"SIM",
94-
# "PGH",
95-
"NPY",
96-
"RUF",
97-
]
119+
fixable = ["ALL"]
98120

99121
unfixable = []
100-
101-
exclude = [
102-
".benchmarks",
103-
".eggs",
104-
".git",
105-
".mypy_cache",
106-
".pytest_cache",
107-
".ruff_cache",
108-
".venv",
109-
"build",
110-
"dist",
111-
"venv",
112-
]
113-
114122
# Allow unused variables when underscore-prefixed.
115123
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
116124

117125
[tool.ruff.isort]
126+
combine-as-imports = true
118127
force-single-line = true
119128
single-line-exclusions = ["typing"]
120129
lines-after-imports = 2
130+
split-on-trailing-comma = true
121131

122132
[tool.ruff.mccabe]
123133
max-complexity = 10
124134

135+
##########################################################
136+
# Static analysis configs #
137+
##########################################################
125138
[tool.mypy]
126-
python_version = "3.11"
127-
disallow_incomplete_defs = true
139+
python_version = "3.12"
140+
# disallow_incomplete_defs = true
128141
explicit_package_bases = true
129142
ignore_missing_imports = true
130143
namespace_packages = true
144+
no_strict_optional = true
131145
warn_no_return = true
132146
warn_unused_configs = true
133147
warn_unused_ignores = true

uv-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.6.13

0 commit comments

Comments
 (0)