Skip to content

Commit

Permalink
prepare next release
Browse files Browse the repository at this point in the history
  • Loading branch information
ariebovenberg committed Jul 4, 2024
1 parent 7c35f86 commit 7854b3b
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 70 deletions.
1 change: 1 addition & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
python-version: '3.12'

# ensure 32-bit target is tested
# FUTURE: Add a linux 32-bit target
- uses: actions/setup-python@v5
if: ${{ matrix.os == 'windows-latest' }}
with:
Expand Down
72 changes: 46 additions & 26 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,50 +11,70 @@ permissions:

jobs:
binary:
name: build on ${{ matrix.os }} - (target ${{ matrix.target || 'all' }}) - (filter ${{ matrix.build_only || 'all' }})
name: build on ${{ matrix.os }} (${{ matrix.target }}) (${{ matrix.manylinux || 'auto' }})
strategy:
fail-fast: false
matrix:
os: [windows, macos, linux]
target: [x86_64, aarch64]
include:
- os: windows-latest
- os: macos-latest
- os: ubuntu-latest
target: x86_64
- os: ubuntu-latest
target: i686
- os: ubuntu-latest
# additional linux targets
- os: linux
target: x86
- os: linux
target: armv7
- os: linux
target: ppc64le
- os: ubuntu-latest
- os: linux
target: s390x
# parallelized because they are slow
- os: ubuntu-latest

# musl targets
- os: linux
target: x86_64
manylinux: musllinux_1_2
- os: linux
target: x86
manylinux: musllinux_1_2
- os: linux
target: aarch64
build_only: 'musllinux'
- os: ubuntu-latest
manylinux: musllinux_1_2
- os: linux
target: armv7
manylinux: musllinux_1_2

- os: windows
python-architecture: x86
target: x86

exclude:
- os: windows
target: aarch64
build_only: 'manylinux'

runs-on: ${{ matrix.os }}
runs-on: ${{ (matrix.os == 'linux' && 'ubuntu') || matrix.os }}-latest
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: pip install -U twine cibuildwheel==2.19.1
- run: cibuildwheel --output-dir dist
env:
CIBW_ARCHS: ${{ matrix.target || 'auto' }}
CIBW_BUILD: '*${{ matrix.build_only }}*'
architecture: ${{ matrix.python-architecture || 'x64' }}
- run: |
pip install -U twine
sed -i ${{ (matrix.os == 'macos' && '""') || '' }} 's/build-backend = "setuptools.build_meta"/build-backend = "maturin"/' pyproject.toml
sed -i ${{ (matrix.os == 'macos' && '""') || '' }} 's/^requires = \["setuptools", .*]/requires = \["maturin>=1.0,<2.0"\]/' pyproject.toml
tail pyproject.toml
- name: build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --interpreter '3.9 3.10 3.11 3.12'
manylinux: ${{ matrix.manylinux || 'auto' }}
sccache: 'true'
rust-toolchain: stable
- run: twine check --strict dist/*
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-binary-${{ runner.os }}-${{ matrix.target || 'all' }}-${{ matrix.build_only || 'all' }}
name: wheels-binary-${{ matrix.os }}-${{ matrix.target }}-${{ matrix.manylinux || 'auto' }}
path: dist/*

sdist:
Expand Down
10 changes: 9 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ and an API more consistent with other modern libraries.

**Rationale**: Consistency with other methods.

- Added explicit ``ignore_dst=True`` flag to DST-unsafe operations such as
shifting an offset datetime.

**Rationale**: Previously, DST-unsafe operations were completely disallowed,
but to a frustrating degree. This flag is a better alternative than having
users resort to workarounds.

- Renamed ``as_utc``, ``as_offset``, ``as_zoned``, ``as_local`` to
``to_utc``, ``to_fixed_offset``, ``to_tz``, ``to_system_tz``,
and the ``NaiveDateTime.assume_*`` methods accordingly
Expand All @@ -59,6 +66,7 @@ and an API more consistent with other modern libraries.
and "fixed offset" and "tz" are more descriptive than "offset" and "zoned".

- ``disambiguate=`` is non-optional for all relevent methods.
The only exception is the constructor, which defaults to "raise".

**Rationale**: This makes it explicit how ambiguous and non-existent times are handled.
The previous default of raising an error by default was too strict.
Expand All @@ -68,7 +76,7 @@ and an API more consistent with other modern libraries.
**Rationale**: The overhead of weakrefs was too high for
such primitive objects, and the use case was not clear.

- Weekdays are now an enum instead integer.
- Weekdays are now an enum instead of an integer.

**Rationale**: Enums are more descriptive and less error-prone,
especially since ISO weekdays start at 1 and Python weekdays at 0.
Expand Down
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,37 +134,37 @@ Additionally, it hasn't been actively maintained since a breaking 3.0 release la
... )

# Identify moments in time, without timezone/calendar complexity
>>> livestream_start = Instant.from_utc(2022, 10, 24, hour=17)
Instant(2022-10-24 17:00:00Z)
>>> now = Instant.now()
Instant(2024-07-04 10:36:56Z)

# Simple, explicit conversions
>>> livestream_start.to_tz("Europe/Paris")
ZonedDateTime(2022-10-24 19:00:00+02:00[Europe/Paris])
>>> now.to_tz("Europe/Paris")
ZonedDateTime(2024-07-04 12:36:56+02:00[Europe/Paris])

# Comparison and equality
>>> Instant.now() > livestream_start
True

# A 'Naive' local time can't accidentally mix with other types.
# A 'naive' local time can't accidentally mix with other types.
# You need to explicitly convert it and handle ambiguity.
>>> party_invite = LocalDateTime(2023, 10, 28, hour=22)
>>> party_invite.add(hours=8)
>>> party_invite.add(hours=6)
Traceback (most recent call last):
ImplicitlyIgnoringDST: Adjusting a local datetime implicitly ignores DST [...]
>>> party_starts = party_invite.assume_tz("Europe/Amsterdam", disambiguate="earlier")
ZonedDateTime(2023-10-28 22:00:00+02:00[Europe/Amsterdam])

# DST-safe arithmetic
>>> party_starts.add(hours=8)
ZonedDateTime(2022-10-29 05:00:00+01:00[Europe/Amsterdam])
>>> party_starts.add(hours=6)
ZonedDateTime(2022-10-29 03:00:00+01:00[Europe/Amsterdam])

# Comparison and equality
>>> now > party_starts
True

# Formatting & parsing common formats (ISO8601, RFC3339, RFC2822)
>>> livestream_start.format_rfc2822()
"Mon, 24 Oct 2022 17:00:00 GMT"
>>> now.format_rfc2822()
"Thu, 04 Jul 2024 10:36:56 GMT"

# If you must: you can convert to/from the standard lib
>>> livestream_start.py_datetime()
datetime.datetime(2022, 10, 24, 17, 0, tzinfo=datetime.timezone.utc)
>>> now.py_datetime()
datetime.datetime(2024, 7, 4, 10, 36, 56, tzinfo=datetime.timezone.utc)
```

Read more in the [feature overview](https://whenever.readthedocs.io/en/latest/overview.html)
Expand Down
38 changes: 11 additions & 27 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ exclude = '''
)/
'''

[tool.setuptools.packages]
find = { where = ["pysrc"] }

[tool.isort]
profile = 'black'
line_length = 79
Expand All @@ -83,31 +80,18 @@ module = [
]
ignore_missing_imports = true

[tool.cibuildwheel]
skip = ["pp*", "*-musllinux_i686", "*-musllinux_ppc64le", "*-musllinux_s390x"]
free-threaded-support = true
test-command = "pytest -s {project}/tests"
test-requires = [
"pytest",
"hypothesis",
]
environment = { PATH = "$HOME/.cargo/bin:$PATH" }

[tool.cibuildwheel.linux]
before-all = "curl -sSf https://sh.rustup.rs | sh -s -- -y"
archs = ["x86_64", "i686", "aarch64", "ppc64le", "s390x"]

[tool.cibuildwheel.windows]
before-all = "rustup target add i686-pc-windows-msvc"
environment = { PATH = "$UserProfile\\.cargo\\bin;$PATH" }

[tool.cibuildwheel.macos]
before-all = "rustup target add x86_64-apple-darwin"
archs = ["x86_64", "arm64"]
[tool.setuptools.packages]
find = { where = ["pysrc"] }

[[tool.cibuildwheel.overrides]]
select = "*-musllinux*"
before-all = "curl -sSf https://sh.rustup.rs | sh -s -- -y && apk add tzdata"
# Notes about the build configuration:
# We need setuptools_rust to support enabling/disabling building the Rust
# extension from source distributions.
# However, we also use maturin to build the binary distributions (wheels)
# since it is *very* convenient for this purpose.
# During wheel building, we set build-backend to `maturin`
[tool.maturin]
python-source = "pysrc"
module-name = "whenever._whenever"

[build-system]
build-backend = "setuptools.build_meta"
Expand Down

0 comments on commit 7854b3b

Please sign in to comment.