Skip to content

use poetry instead of setup tools as package manager#231

Merged
ramedina86 merged 1 commit intowriter:devfrom
FabienArcellier:21-use-poetry-instead-of-setup-tools-as-package-manager
Feb 8, 2024
Merged

use poetry instead of setup tools as package manager#231
ramedina86 merged 1 commit intowriter:devfrom
FabienArcellier:21-use-poetry-instead-of-setup-tools-as-package-manager

Conversation

@FabienArcellier
Copy link
Contributor

Check

implement #230

Peek 2024-02-07 08-12

Check

  • a user can run streamsync hello after installing the package with pip install streamsync[ds]
  • the user can still install optional dependencies pip install streamsync[ds]
  • a developper can run bash ./build.sh
  • files referenced in MANIFEST.in are present in the distribution package

Todo

  • configure poetry
  • configure poetry to handle virtualenv in .venv
  • migrate the build.sh
  • remove MANIFEST.in because poetry handle all the files from src
  • modify CONTRIBUTING.md
  • remove the dependency group of test, use build instead

* configure poetry
* configure poetry to handle virtualenv in `./.venv`
* migrate and fix the build.sh (mypy didn't pass)
* remove MANIFEST.in because poetry handle all the files from src
* modify CONTRIBUTING.md
* remove the dependency group of `test`, use `build` instead
* change versioning strategy to fetch version from package manifest (poetry way, one of the few defaults of poetry)
@FabienArcellier FabienArcellier added the enhancement New feature or request label Feb 7, 2024
ds = ["pandas", "pyarrow", "plotly"]

[tool.setuptools.dynamic]
version = { attr = "streamsync.VERSION" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No way to get version dynamically?

Copy link
Contributor Author

@FabienArcellier FabienArcellier Feb 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the design choices of poetry, there is a strong choice not to read a python module dynamically like in setuptools. I understand this choice but it leads to a frustrating limit regards to version number. I prefer the setuptools strategy but impossible to use it properly with poetry.

A plugin written by the creator of fastapi go over this limit but this plugin is incompatible with src layout and the PR to fix it has been open for 3 months and hasn't been merged.

self.is_app_process_server_failed = multiprocessing.Event()
self.app_process_listener: Optional[AppProcessListener] = None
self.observer: Optional[watchdog.observers.Observer] = None
self.observer: Optional[PollingObserver] = None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is, otherwise mypy was complaining in build.sh

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah nice, must be related to the dependencies I upgraded, thanks for fixing.

from streamsync.core import initial_state, component_manager, session_manager, session_verifier

VERSION = "0.3.0"
VERSION = importlib.metadata.version("streamsync")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the idea is to switch to defining version in the package and then fetching it from the code? Makes more sense I guess

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the recommended way to manage this situation. Another one is to have a utility as bumpversion to update both location. I would avoid this one.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like this option.

@ramedina86
Copy link
Collaborator

Looks good and thanks very much for updating the CONTRIBUTING.md, I'll have to consult that too.

@mmikita95 @raaymax Please have a look at this great example of updating docs while making changes in the code... Avoids documentation drift. I expect everyone to help keep docs updated; it's straightforward as it's just modifying the markdown files.

@mmikita95
Copy link
Contributor

Indeed, beautifully done. I'll make sure to commit to that as well.

Copy link
Collaborator

@raaymax raaymax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one :)

@ramedina86 ramedina86 merged commit f903963 into writer:dev Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants