sdispater's comments

sdispater | 7 years ago | on: Poetry: Python dependency management and packaging made easy

Poetry comes with an exhaustive and efficient dependency resolver which pip does not have.

It's also a packaging tool, which means you can build and publish packages with (on PyPI for instance).

And finally, it always creates a virtualenv for each project so that you always work isolated from the global Python installation.

sdispater | 8 years ago | on: Show HN: Poetry – Python dependency management and packaging made easy

Pipenv sees the wrong constraint. It just aggregates the constraint for pbr that it sees.

In details:

oslo.utils==1.4.0 requires:

- pbr (>= 0.6, != 0.7, < 1.0) - oslo.i18n (>= 1.3)

So, poetry will take the latest version of oslo.i18n which requires:

- pbr (!= 2.1, >= 2.0)

Poetry will detect the conflict and backtrack oslo.i18n to version 2.1.0 which requires:

- pbr (>= 0.11, < 2.0)

This is compatible with the requirements of oslo.utils and pbr==0.11.1 will be installed

sdispater | 8 years ago | on: Show HN: Poetry – Python dependency management and packaging made easy

Poetry is a new tool to help you manage your Python projects.

It is both a dependency management tool and a packaging tool. Most of the reasons why I started this are detailed in the README (along with why I don’t want to use Pipenv) here: https://github.com/sdispater/poetry#why, but if you want to know the advantages of Poetry compared to existing tools, here are a few:

- Exhaustive dependency resolver

- Intuitive CLI (See https://poetry.eustace.io/docs/cli/)

- Emphasis on semantic versioning and constraint specification so that wildcard dependencies (`*`) will be considered bad practice

- Support for dependencies caret, tilde, wildcard, inequality and multiple requirements.

- Only one file: the standardised pyproject.toml which aims at being readable and clear.

- Mandatory compatible python versions specification.

Also, Poetry is Python 3.6+ only but can manage Python 2 projects without any problem.

And finally, Poetry is not completely stable yet so internally things can change but the CLI and commands are pretty much stable so backwards-incompatible changes should not happen too often.

sdispater | 8 years ago | on: Poetry: Python dependency management and packaging made easy

Poetry is a new tool to help you manage your Python projects.

It is both a dependency management tool and a packaging tool. Note that for the moment the focus has been on the dependency management part but the work on the packaging/publishing has started and is ready for simple, pure-python projects.

Most of the reasons why I started this are detailed in the README (along with why I don’t want to use Pipenv) but if you want to know the advantages of Poetry compared to existing tools, here are a few:

- Exhaustive dependency resolver

- Intuitive CLI (See [Commands](https://github.com/sdispater/poetry#commands))

- Emphasis on semantic versioning and constraint specification so that wildcard dependencies (`*`) will be considered bad practice

- Support for dependencies caret, tilde, wildcard, inequality and multiple requirements.

- Only one file: the standardised `pyproject.toml` which aims at being readable and clear.

- Mandatory compatible python versions specification.

This project is a revamped version of [pypoet](https://github.com/sdispater/poet) to have a cleaner codebase.

Be aware that not all the features described in the README are implemented yet (but most of them are).

Also, Poetry is Python 3.6+ only but can manage Python 2 projects without any problem.

And finally, Poetry is not stable yet so internally things can change but the CLI and commands are pretty much stable so backwards-incompatible changes should not happen too often.

sdispater | 8 years ago | on: Show HN: Pendulum – Python datetimes made easy

It’s been months since I first showcased Pendulum on HN (https://news.ycombinator.com/item?id=12299013). At the time it was not stable but I received a lot of valuable feedback to shape it to what it is now.

It’s now stable (since January actually) and has gain traction since I first introduced it, so I thought I’d share it here again so that it can be of use to more people.

For those wondering, Pendulum is a library for Python to ease datetimes, timedeltas and timezones manipulation.

Each Pendulum classes are subclasses of the standard classes so you can use them as drop-in replacements in your code (some exceptions exist, see https://pendulum.eustace.io/docs/#limitations)

Link to the official website: https://pendulum.eustace.io

Link to the official documentation: https://pendulum.eustace.io/docs/

Link to the github project: https://github.com/sdispater/pendulum

sdispater | 9 years ago | on: Poet – Package and dependency management for Python

Poet is a new tool for Python to help you declare, manage and install dependencies of your projects.

I started building it because I wanted to have something simpler than what is currently existing.

Packaging system and dependency management in Python is rather convoluted and hard to understand for newcomers. Even for seasoned developers it might be cumbersome at times to create all files needed in a Python project: `setup.py`, `requirements.txt`, `setup.cfg`, `MANIFEST.in`.

So I wanted a tool that would limit everything to a single configuration file to do everything: dependency management, packaging and publishing.

It takes inspiration in tools that exist in other languages, like `composer` (PHP) or `cargo` (Rust). The `poetry.toml` file is really similar to the `Cargo.toml` one for example.

Note that there is no magic here, `poet` uses existing tools (`pip`, `twine`, `setuptools`, `distutils`, `pip-tools`) under the hood to achieve that in a more intuitive way.

I would also like to point out that, at this time, it is highly experimental and mostly still at a proof of concept stage but I’d gladly appreciate feedback and pull requests to improve it.

sdispater | 9 years ago | on: Pendulum (Python datetimes made easy) reaches its first stable version

For those of you who don’t know, Pendulum is a library for Python to ease datetimes, timedeltas and timezones manipulation. It has come a long way since the early releases and has now reached its first stable version.

It provides objects and classes that directly inherits from the standard library ones so you can use them transparently (exceptions exist, see https://github.com/sdispater/pendulum#limitations)

Basically, the Pendulum class is a replacement for the native datetime one with some useful and intuitive methods, the Interval class is intended to be a better timedelta class and the Period class is a datetime-aware timedelta. It also provides Date and Time classes (introduced in version 0.7.0).

Timezones are also easier to deal with: Pendulum will automatically normalize your datetime to handle DST transitions for you.

    import pendulum
    
    pendulum.create(2013, 3, 31, 2, 30, 0, 0, 'Europe/Paris’)
    # 2:30 for the 31th of March 2013 does not exist
    # so pendulum will return the actual time which is 3:30+02:00
    '2013-03-31T03:30:00+02:00’
    
    dt = pendulum.create(2013, 3, 31, 1, 59, 59, 999999, 'Europe/Paris’)
    '2013-03-31T01:59:59.999999+01:00’
    dt = dt.add(microseconds=1)
    '2013-03-31T03:00:00+02:00’
    dt.subtract(microseconds=1)
    '2013-03-31T01:59:59.999998+01:00’
Note that on creation, the normalization behavior is configurable (see https://pendulum.eustace.io/docs/#timezones for more information).

To those wondering: yes I know Arrow (http://crsmithdev.com/arrow/) exists but its flaws and strange API (you can throw almost anything at get() and it will do its best to determine what you wanted, for instance) motivated me to start this project. You can check why I think Arrow is flawed here: https://pendulum.eustace.io/faq/#why-not-arrow (or https://github.com/sdispater/pendulum#why-not-arrow)

Link to the official documentation: https://pendulum.eustace.io/docs/

Link to the github project: https://github.com/sdispater/pendulum

sdispater | 9 years ago | on: Pendulum – Python datetimes made easy

That's a problem Pendulum is trying to solve

    d1 = datetime(2012, 1, 1, 1, 2, 3, tzinfo=pytz.UTC)
    d2 = datetime(2011, 12, 31, 22, 2, 3, tzinfo=pytz.UTC)
    delta = d2 - d1
    delta.days
    -1
    delta.seconds
    75600
    
    d1 = Pendulum(2012, 1, 1, 1, 2, 3)
    d2 = Pendulum(2011, 12, 31, 22, 2, 3)
    delta = d2 - d1
    delta.days
    0
    delta.hours
    -3

sdispater | 9 years ago | on: Pendulum – Python datetimes made easy

I am not too kind on raising an error by default (which pytz does not do by default either but rather return the pre-DST transition time).

I think the best thing to do here is keep the current behavior (post-DST) but with an option to choose what you want exactly (post-DST, pre-DST)

sdispater | 9 years ago | on: Pendulum – Python datetimes made easy

I see what you mean but as soon as you deal with timezone-aware datetimes you don't really have a choice, if an hour has been skipped, it simply doesn't exist.

What is important here, I think, is that any time arithmetic is not affected by this normalization, so if you add an hour the difference will be an hour, so you don't really have to think about it.

sdispater | 9 years ago | on: Pendulum – Python datetimes made easy

Mainly, its API which tries to be as close as possible as the one provided by the standard datetime library while providing a bunch of helpful methods.

Also, Pendulum is not just about datetimes but also provides both the Interval class and Period class which are improvements over the native timedelta class.

And finally, it handles properly time shifting around DST transition times and normalization of datetimes when creating them which neither Delorean nor Arrow do well.

sdispater | 9 years ago | on: Pendulum – Python datetimes made easy

Pendulum is a new library for Python to ease datetimes, timedeltas and timezones manipulation.

It is heavily inspired by [Carbon](http://carbon.nesbot.com) for PHP.

Basically, the Pendulum class is a replacement for the native datetime one with some useful and intuitive methods, the Interval class is intended to be a better time delta class and, finally, the Period class is a datetime-aware timedelta.

Timezones are also easier to deal with: Pendulum will automatically normalize your datetime to handle DST transitions for you.

    import pendulum
    
    pendulum.create(2013, 3, 31, 2, 30, 0, 0, 'Europe/Paris’)
    # 2:30 for the 31th of March 2013 does not exist
    # so pendulum will return the actual time which is 3:30+02:00
    '2013-03-31T03:30:00+02:00’
    
    dt = pendulum.create(2013, 3, 31, 1, 59, 59, 999999, 'Europe/Paris’)
    '2013-03-31T01:59:59.999999+01:00’
    dt = dt.add(microseconds=1)
    '2013-03-31T03:00:00+02:00’
    dt.subtract(microseconds=1)
    '2013-03-31T01:59:59.999998+01:00’
To those wondering: yes I know [Arrow](http://crsmithdev.com/arrow/) exists but its flaws and strange API (you can throw almost anything at get() and it will do its best to determine what you wanted, for instance) motivated me to start this project. You can check why I think Arrow is flawed here: https://pendulum.eustace.io/faq/#why-not-arrow

Link to the official documentation: https://pendulum.eustace.io/docs/

Link to the github project: https://github.com/sdispater/pendulum

page 1