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

pendulum dependency cannot be installed on 32-bit arches #1451

Closed
3 tasks done
mgorny opened this issue Feb 18, 2024 · 4 comments · Fixed by #1452
Closed
3 tasks done

pendulum dependency cannot be installed on 32-bit arches #1451

mgorny opened this issue Feb 18, 2024 · 4 comments · Fixed by #1452

Comments

@mgorny
Copy link

mgorny commented Feb 18, 2024

Description

The current version of pendulum is broken on 32-bit architectures, and prevents pgcli from being installed, e.g. on x86:

$ pip install pgcli
[…]
Building wheels for collected packages: pendulum
  Building wheel for pendulum (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for pendulum (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [44 lines of output]
      Running `maturin pep517 build-wheel -i /tmp/venv/bin/python --compatibility off`
      🍹 Building a mixed python/rust project
      🔗 Found pyo3 bindings
      🐍 Found CPython 3.11 at /tmp/venv/bin/python
         Compiling target-lexicon v0.12.6
         Compiling python3-dll-a v0.2.9
         Compiling libc v0.2.139
         Compiling autocfg v1.1.0
         Compiling proc-macro2 v1.0.51
         Compiling once_cell v1.17.1
         Compiling unicode-ident v1.0.6
         Compiling quote v1.0.23
         Compiling syn v1.0.109
         Compiling parking_lot_core v0.9.7
         Compiling cc v1.0.79
         Compiling cfg-if v1.0.0
         Compiling scopeguard v1.1.0
         Compiling smallvec v1.10.0
         Compiling indoc v1.0.9
         Compiling unindent v0.1.11
         Compiling lock_api v0.4.9
         Compiling memoffset v0.9.0
         Compiling pyo3-build-config v0.19.1
         Compiling libmimalloc-sys v0.1.35
         Compiling parking_lot v0.12.1
         Compiling pyo3-ffi v0.19.1
         Compiling pyo3 v0.19.1
         Compiling mimalloc v0.1.39
         Compiling pyo3-macros-backend v0.19.1
         Compiling pyo3-macros v0.19.1
         Compiling _pendulum v3.0.0 (/tmp/pip-install-5opl0f4t/pendulum_6a9ca1944a154f03b7118e4016b5accf/rust)
      error: this arithmetic operation will overflow
        --> src/helpers.rs:59:20
         |
      59 |         seconds += ((146_097 - 10957) * SECS_PER_DAY as usize) as isize;
         |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `135140_usize * 86400_usize`, which would overflow
         |
         = note: `#[deny(arithmetic_overflow)]` on by default
      
      error: could not compile `_pendulum` (lib) due to previous error
      💥 maturin failed
        Caused by: Failed to build a native library through cargo
        Caused by: Cargo build finished with "exit status: 101": `PYO3_ENVIRONMENT_SIGNATURE="cpython-3.11-64bit" PYO3_PYTHON="/tmp/venv/bin/python" PYTHON_SYS_EXECUTABLE="/tmp/venv/bin/python" "cargo" "rustc" "--message-format" "json-render-diagnostics" "--manifest-path" "/tmp/pip-install-5opl0f4t/pendulum_6a9ca1944a154f03b7118e4016b5accf/rust/Cargo.toml" "--release" "--lib" "--crate-type" "cdylib"`
      Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/tmp/venv/bin/python', '--compatibility', 'off'] returned non-zero exit status 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pendulum
Failed to build pendulum
ERROR: Could not build wheels for pendulum, which is required to install pyproject.toml-based projects

The issue apparently affects all 32-bit architectures. It has been reported upstream two months ago but it has no received no attention. Additionally, the author does not have time to actively maintain the package since December 2021 (which makes the decision to rewrite it in Rust a bit surprising).

Given that it's only used to display human readable durations, could you please either make it optional or replace it with a portable package? FWICS it was introduced in #1199 but I don't really understand why — perhaps the change could be reverted.

Your environment

  • Please provide your OS and version information.

Gentoo/Linux x86

  • Please provide your CLI version.

pgcli-4.0.1-py3-none-any.whl.metadata

  • What is the output of pip freeze command.

Empty, since it didn't manage to install anything ;-).

Original bug report: https://bugs.gentoo.org/924881

@dbaty
Copy link
Member

dbaty commented Feb 19, 2024

I wasn't even sure what it was used for and how it looked like. Here is an example:

> select pg_sleep(2)
+----------+
| pg_sleep |
|----------|
|          |
+----------+
SELECT 1
Time: 2.013s (2 seconds), executed in: 2.003s (2 seconds)

> select pg_sleep(62)
+----------+
| pg_sleep |
|----------|
|          |
+----------+
SELECT 1
Time: 62.066s (1 minute 2 seconds), executed in: 62.063s (1 minute 2 seconds)

Pendulum (that is currently used) and Humanize (which was used before, as noted by the reporter) have translations, but pgcli does not even use them (which is understandable, since the rest of the UI is in English).

It's thus a bit sad to require a third-party package for such a small feature. @j-bennet: I'm inclined to rewrite a corresponding function within pgcli (and drop the requirement on pendulum), what do you think?

Actually, I am not even sure that displaying the duration in words is that useful... What's your take on this?

dbaty added a commit that referenced this issue Feb 19, 2024
`pgcli` uses Pendulum to display the query execution time in words:

    > select pg_sleep(62)
    +----------+
    | pg_sleep |
    |----------|
    |          |
    +----------+
    SELECT 1
    Time: 62.066s (1 minute 2 seconds), executed in: 62.063s (1 minute 2 seconds)

Pendulum 3 (which has been released in December 2023 and is now
written in Rust) does not build on 32-bit architectures [1]. As such,
installing `pgcli` on such architectures fails. We could pin Pendulum
to version 2 (which was written in Python and builds "everywhere"),
but requiring a whole library and its own dependencies for such a
small feature seems unwarranted.

This commit thus removes the requirement on Pendulum and replaces it
by a simple "duration-to-words" function.

Fixes #1451.

[1] Upstream issue: sdispater/pendulum#784
dbaty added a commit that referenced this issue Feb 19, 2024
`pgcli` uses Pendulum to display the query execution time in words:

    > select pg_sleep(62)
    +----------+
    | pg_sleep |
    |----------|
    |          |
    +----------+
    SELECT 1
    Time: 62.066s (1 minute 2 seconds), executed in: 62.063s (1 minute 2 seconds)

Pendulum 3 (which has been released in December 2023 and is now
written in Rust) does not build on 32-bit architectures [1]. As such,
installing `pgcli` on such architectures fails. We could pin Pendulum
to version 2 (which was written in Python and builds "everywhere"),
but requiring a whole library and its own dependencies for such a
small feature seems unwarranted.

This commit thus removes the requirement on Pendulum and replaces it
by a simple "duration-to-words" function.

Fixes #1451.

[1] Upstream issue: sdispater/pendulum#784
dbaty added a commit that referenced this issue Feb 19, 2024
`pgcli` uses Pendulum to display the query execution time in words:

    > select pg_sleep(62)
    +----------+
    | pg_sleep |
    |----------|
    |          |
    +----------+
    SELECT 1
    Time: 62.066s (1 minute 2 seconds), executed in: 62.063s (1 minute 2 seconds)

Pendulum 3 (which has been released in December 2023 and is now
written in Rust) does not build on 32-bit architectures [1]. As such,
installing `pgcli` on such architectures fails. We could pin Pendulum
to version 2 (which was written in Python and builds "everywhere"),
but requiring a whole library and its own dependencies for such a
small feature seems unwarranted.

This commit thus removes the requirement on Pendulum and replaces it
by a simple "duration-to-words" function.

Fixes #1451.

[1] Upstream issue: sdispater/pendulum#784
dbaty added a commit that referenced this issue Feb 19, 2024
`pgcli` uses Pendulum to display the query execution time in words:

    > select pg_sleep(62)
    +----------+
    | pg_sleep |
    |----------|
    |          |
    +----------+
    SELECT 1
    Time: 62.066s (1 minute 2 seconds), executed in: 62.063s (1 minute 2 seconds)

Pendulum 3 (which has been released in December 2023 and is now
written in Rust) does not build on 32-bit architectures [1]. As such,
installing `pgcli` on such architectures fails. We could pin Pendulum
to version 2 (which was written in Python and builds "everywhere"),
but requiring a whole library and its own dependencies for such a
small feature seems unwarranted.

This commit thus removes the requirement on Pendulum and replaces it
by a simple "duration-to-words" function.

Fixes #1451.

[1] Upstream issue: sdispater/pendulum#784
@dbaty
Copy link
Member

dbaty commented Feb 19, 2024

I went ahead and created a pull request (#1452) where I remove the dependency on Pendulum and replaces it by a home-made function.

dbaty added a commit that referenced this issue Feb 19, 2024
`pgcli` uses Pendulum to display the query execution time in words:

    > select pg_sleep(62)
    +----------+
    | pg_sleep |
    |----------|
    |          |
    +----------+
    SELECT 1
    Time: 62.066s (1 minute 2 seconds), executed in: 62.063s (1 minute 2 seconds)

Pendulum 3 (which has been released in December 2023 and is now
written in Rust) does not build on 32-bit architectures [1]. As such,
installing `pgcli` on such architectures fails. We could pin Pendulum
to version 2 (which was written in Python and builds "everywhere"),
but requiring a whole library and its own dependencies for such a
small feature seems unwarranted.

This commit thus removes the requirement on Pendulum and replaces it
by a simple "duration-to-words" function.

Fixes #1451.

[1] Upstream issue: sdispater/pendulum#784
@j-bennet
Copy link
Contributor

I went ahead and created a pull request (#1452) where I remove the dependency on Pendulum and replaces it by a home-made function.

Well done @dbaty, thanks for the quick turnaround.

dbaty added a commit that referenced this issue Feb 20, 2024
`pgcli` uses Pendulum to display the query execution time in words:

    > select pg_sleep(62)
    +----------+
    | pg_sleep |
    |----------|
    |          |
    +----------+
    SELECT 1
    Time: 62.066s (1 minute 2 seconds), executed in: 62.063s (1 minute 2 seconds)

Pendulum 3 (which has been released in December 2023 and is now
written in Rust) does not build on 32-bit architectures [1]. As such,
installing `pgcli` on such architectures fails. We could pin Pendulum
to version 2 (which was written in Python and builds "everywhere"),
but requiring a whole library and its own dependencies for such a
small feature seems unwarranted.

This commit thus removes the requirement on Pendulum and replaces it
by a simple "duration-to-words" function.

Fixes #1451.

[1] Upstream issue: sdispater/pendulum#784
dbaty added a commit that referenced this issue Feb 20, 2024
`pgcli` uses Pendulum to display the query execution time in words:

    > select pg_sleep(62)
    +----------+
    | pg_sleep |
    |----------|
    |          |
    +----------+
    SELECT 1
    Time: 62.066s (1 minute 2 seconds), executed in: 62.063s (1 minute 2 seconds)

Pendulum 3 (which has been released in December 2023 and is now
written in Rust) does not build on 32-bit architectures [1]. As such,
installing `pgcli` on such architectures fails. We could pin Pendulum
to version 2 (which was written in Python and builds "everywhere"),
but requiring a whole library and its own dependencies for such a
small feature seems unwarranted.

This commit thus removes the requirement on Pendulum and replaces it
by a simple "duration-to-words" function.

Fixes #1451.

[1] Upstream issue: sdispater/pendulum#784
@dbaty dbaty closed this as completed in 9f114c4 Feb 20, 2024
@mgorny
Copy link
Author

mgorny commented Feb 20, 2024

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants