Skip to content

Commit

Permalink
debug build failed on linux (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
ringsaturn authored Oct 25, 2024
1 parent 7f5104e commit 8b2e208
Show file tree
Hide file tree
Showing 9 changed files with 206 additions and 143 deletions.
19 changes: 5 additions & 14 deletions .github/workflows/Bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ on:
pull_request:
workflow_dispatch:

env:
UV_CACHE_DIR: "/tmp/.uv-cache"

jobs:
benchmark_with_bencher:
name: Continuous Benchmarking with Bencher
Expand All @@ -19,26 +16,20 @@ jobs:
BENCHER_TESTBED: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.13
- name: Restore uv cache
uses: actions/cache@v4
with:
path: ${{ env.UV_CACHE_DIR }}
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
uv-${{ runner.os }}

- uses: bencherdev/bencher@main
- name: Install tzfpy and test
shell: bash
run: |
uv sync
make sync
source .venv/bin/activate
bencher run \
--file results.json \
Expand Down
19 changes: 5 additions & 14 deletions .github/workflows/CodSpeed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,24 @@ on:
pull_request:
workflow_dispatch:

env:
UV_CACHE_DIR: "/tmp/.uv-cache"

jobs:
benchmark_with_codspeed:
name: Continuous Benchmarking with CodSpeed
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Collect Workflow Telemetry
uses: runforesight/workflow-telemetry-action@v2
with:
comment_on_pr: false
- uses: actions/checkout@v4
- name: Set up uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.13
- name: Restore uv cache
uses: actions/cache@v4
with:
path: ${{ env.UV_CACHE_DIR }}
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
uv-${{ runner.os }}

- name: Install
run: |
Expand Down
23 changes: 9 additions & 14 deletions .github/workflows/Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ concurrency:

env:
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: 1
UV_PYTHON_PREFERENCE: only-system
CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_DEBUG: true

jobs:
Testing:
runs-on: ${{ matrix.os }}
env:
UV_CACHE_DIR: "/tmp/.uv-cache"
strategy:
fail-fast: false
matrix:
Expand All @@ -27,26 +27,21 @@ jobs:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Set up uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Restore uv cache
uses: actions/cache@v4
with:
path: ${{ env.UV_CACHE_DIR }}
key: uv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}
uv-${{ runner.os }}

- name: Install tzfpy and test
shell: bash
run: |
uv run ruff check .
uv run pytest | tee benchmark_result.txt
make lint
make test | tee benchmark_result.txt
- name: Setup benchmark file name
id: gen-benchmark-file-name
Expand Down
44 changes: 44 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
export UV_PYTHON_PREFERENCE=only-system
export PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1
export CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_DEBUG=true

.PHONY: help build fmt lint sync lock upgrade all test

help:
@echo "Available commands:"
@echo " build - Build the project using uv"
@echo " fmt - Format the code using ruff"
@echo " lint - Lint the code using ruff"
@echo " sync - Sync and compile the project using uv"
@echo " lock - Lock dependencies using uv"
@echo " upgrade - Upgrade dependencies using uv"
@echo " all - Run lock, sync, fmt, lint, and test"
@echo " test - Run tests using pytest"

build:
uv build

fmt:
uv run ruff check --select I --fix .
uv run ruff format .

lint:
uv run ruff check .
uv run ruff format --check .

sync:
uv sync --compile

lock:
uv lock

upgrade:
uv lock --upgrade

all: lock sync
make fmt
make lint
make test

test: lint
uv run pytest -v .
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,30 @@ I recommend to read timezonefinder's
[Comparison to pytzwhere](https://timezonefinder.readthedocs.io/en/latest/3_about.html#comparison-to-pytzwhere)
since it's very detailed.

## Contributing

Install:

- [Rust](https://www.rust-lang.org/tools/install)
- [Python](https://www.python.org/downloads/)
- [uv](https://docs.astral.sh/uv/)

```console
Available commands:
build - Build the project using uv
fmt - Format the code using ruff
lint - Lint the code using ruff
sync - Sync and compile the project using uv
lock - Lock dependencies using uv
upgrade - Upgrade dependencies using uv
all - Run lock, sync, fmt, lint, and test
test - Run tests using pytest
```

```bash
make all
```

## LICENSE

This project is licensed under the [MIT license](./LICENSE). The data is
Expand Down
16 changes: 13 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ requires = ["maturin>=1,<2"]
classifiers = [
"Programming Language :: Rust",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand All @@ -18,7 +17,18 @@ license = "MIT"
description = "Probably the fastest Python package to convert longitude/latitude to timezone name"
name = "tzfpy"
requires-python = ">=3.9"
authors = [{ name = "ringsaturn", email = "ringsaturn.me@gmail.com" }]
maintainers = [{ name = "ringsaturn", email = "ringsaturn.me@gmail.com" }]
keywords = [
"tzf",
"timezone",
"timezone-name",
"timezone-lookup",
"gps",
"gps-coordinates",
"gps-location",
"longitude",
"latitude",
]

[project.optional-dependencies]
pytz = ["pytz>=2024.2"]
Expand All @@ -35,7 +45,7 @@ features = ["pyo3/extension-module"]

[tool.uv]
dev-dependencies = [
"ruff>=0.6.9",
"ruff>=0.7.1",
"citiespy>=0.6.5",
"maturin>=1.7.4",
"pytest>=8.3.3",
Expand Down
1 change: 0 additions & 1 deletion tests/test_bench.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from citiespy import random_city

from tzfpy import get_tz

# warmup lazy init
Expand Down
3 changes: 1 addition & 2 deletions tests/test_compatibility.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from unittest import TestCase, main

from citiespy import all_cities

from tzfpy import get_tzs, timezonenames, data_version
from tzfpy import data_version, get_tzs, timezonenames


class TestCompatibility(TestCase):
Expand Down
Loading

0 comments on commit 8b2e208

Please sign in to comment.