arrow-py / arrow-py/arrow

Migration guide for v1.0.0

Open
#832 1 comment 0 reactions 0 assignees View on GitHub
documentation
Dominant language
Python
Stars
9.1k
Forks
784
PR merge metrics
No merged PRs in 30d

Description

The v1.0.0 release of Arrow contains breaking changes, this migration guide outlines the changed APIs and functionality. Please visit #923 to discuss the changes and ask any questions.

1. Python `2.7` and `3.5` are no longer supported.

2. The `.timestamp` property has been removed to improve compatibility with `datetime`. Use `.int_timestamp` for the same results.

```python
>>> arrow.utcnow().int_timestamp
1608640233
```

3. Arrow has a new method `timestamp()` which wraps the `datetime` method of the same name.

```python
>>> arrow.utcnow().timestamp()
1608641039.22176
```

4. It's no longer possible to set the `tzinfo` property directly, instead use `replace()`.

```python
>>> dt=arrow.utcnow()
>>> dt.tzinfo=tz.gettz("US/Pacific")
Traceback (most recent call last):
File "", line 1, in
AttributeError: can't set attribute
>>> dt.replace(tzinfo=tz.gettz("US/Pacific"))

```

5. `arrow.get(None)` now returns an error rather than current UTC.

```python
>>> arrow.get(None)
Traceback (most recent call last):
File "", line 1, in
File "/home/chris/arrow/arrow/api.py", line 80, in get
return _factory.get(*args, **kwargs)
File "/home/chris/arrow/arrow/factory.py", line 228, in get
raise TypeError("Cannot parse argument of type None.")
TypeError: Cannot parse argument of type None.
```

6. The `"X"` token now returns a `float` rather than an `int`.

```python
>>> arrow.utcnow().format("X")
'1614719652.85991'
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Review the v1.0.0 breaking-change list in the issue and read #923 for the related discussion. A migration guide is done when it documents the six listed changes, including the replacement APIs, version support change, and examples showing the new behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.