@fohrloop@fosstodon.org avatar

fohrloop

@fohrloop@fosstodon.org

I post about

🐍 #python
📊 #dataanalytics
👨‍🔬 #datascience
👨🏻‍💻 #dev #developers

This profile is from a federated server and may be incomplete. Browse more on the original instance.

fohrloop, to python
@fohrloop@fosstodon.org avatar

The new python 3.13 REPL looks so useful that I might be able to switch from IPython to it entirely!

#python #python313 #pythonnews

https://treyhunner.com/2024/05/my-favorite-python-3-dot-13-feature/

fohrloop, to til
@fohrloop@fosstodon.org avatar

#TIL when creating a python project, and using some==2.2.0 to "pin" your requirements isn't actually pinning them, as the package owner (or anyone with access) may upload version 2.2.0-1, 2.2.0-2, etc. which will match the "==2.2.0".

https://www.youtube.com/watch?v=oGpyupM52IQ

#python #pythonsecurity #security #pip

fohrloop,
@fohrloop@fosstodon.org avatar

@diazona oh, right! Should have added that this "-N" is added with --build-number=N. If you want to see a demo, check the video around 3:25.

fohrloop,
@fohrloop@fosstodon.org avatar

@diazona Or are the --build-number=1 and ".post1" also the same thing? For some reason pip installs the wheel with version "2.2.0-1" instead of "2.2.0" if that's available, even if you specify "package==2.2.0".

fohrloop,
@fohrloop@fosstodon.org avatar

@diazona @hugovk

I wonder if the build tags are the way to go if you use readthedocs and want to just update the documentation. Or would you rather move the git tag and force rebuild in ReadTheDocs..?

fohrloop,
@fohrloop@fosstodon.org avatar

@hugovk
@diazona
For docs-only-change (typo, link fix, etc.) for version X.Y.Z I have just checked out with the git tag X.Y.Z, made changes, and moved the git tag X.Y.Z to the new commit, and forced doc rebuild for git tag X.Y.Z in the RTD web ui. But seems that giving the new commit tag X.Y.Z.post1 would be a better way. I wonder if that's still shown as X.Y.Z in RTD for the users..?

fohrloop,
@fohrloop@fosstodon.org avatar

@hugovk @diazona

What do you mean by /latest/ and /stable/?

I have https://wakepy.readthedocs.io/en/latest/ pointing to the latest released version (default if you just go to https://wakepy.readthedocs.io ) and then https://wakepy.readthedocs.io/en/dev/ which follows the dev branch which is the long living development branch of unreleased work (many call this master or main).

fohrloop,
@fohrloop@fosstodon.org avatar

@hugovk @diazona @pillow

Thanks I think I needed something to do on Easter Monday! How long this will run?

fohrloop, to python
@fohrloop@fosstodon.org avatar

Using #polars or #duckdb for interactive dashboard, where all data might not fit into memory (need for streaming algorithms / out-of-core computing).

Which one would you suggest? Both seem to be pretty awesome!

https://github.com/pola-rs/polars
https://github.com/duckdb/duckdb

#python #datascience #datasciencetools

driscollis, to python
@driscollis@mastodon.social avatar

#Python supports function overloading using the functools module. 🐍🔥

It isn't as full-featured as other languages, but it's a handy tool.

Here's an example:

fohrloop,
@fohrloop@fosstodon.org avatar

@driscollis yet another thing in the #python standard library I've never seen or used. I wonder when one would use the functools.singledispatch over a set of if isinstance(..) elif isinstance(..)? The singledispatch feels like a bit of magic since going to the definition of the function does not show what it does and one has to go to Ctrl-F for all the @func.register's to find the implementation 🤔

#functools #pythonstandardlibrary

fohrloop,
@fohrloop@fosstodon.org avatar

@driscollis One use case perhaps for library makers to give possibility for their users to extend their library to new types. Let's say there is somefunc which is used on many places within the library. That supports few types.

To support sometype, user could add an implementation in their own code with:

@somefunc.register(sometype)
def implementation(..):
...

fohrloop, to python
@fohrloop@fosstodon.org avatar

Hey #python developers. How do you keep your docstrings DRY? When I find myself copying same part of a docstring to 7 places after introducing a new parameter I wonder if it could be made somehow better 🤔

#pythonbestpractices

venthur, to python
@venthur@mastodon.social avatar

Inspired by @fcodvpt post about current popularity of build backends, I investigated how the popularity of build backends used in pyproject.toml evolved over time since PEP-0517 introduced them in 2015:

https://venthur.de/2024-01-26-build-backends.html

#python, #pypi

image/png

fohrloop,
@fohrloop@fosstodon.org avatar

@venthur @fcodvpt nice stats! I would have expected flit to have higher percentage. The python packaging is still in the middle of changes and it's interesting to see where this is going and what kind of tools we will be using in five years from now.

#python #pythonpackaging #flit

fohrloop,
@fohrloop@fosstodon.org avatar

@brettcannon @venthur @fcodvpt

well that's interesting. I've been a happy flit user without realizing it :D To be honest, I've just used

[build-system]
requires = ["flit_core >=3.2,<4"]
build-backend = "flit_core.buildapi"

in my pyproject.toml and that's it. I wonder what is the first sign I will have to migrate from flit if I write pure python code (No cython / C). 🤔

fohrloop,
@fohrloop@fosstodon.org avatar

@brettcannon @venthur @fcodvpt

So far I've been only creating wheels with

python -m pip wheel --no-deps .

Are there some benefits with the sdist format?

The dynamic versioning thing seems pretty fancy!

#python #pythonpackaging

fohrloop,
@fohrloop@fosstodon.org avatar

@diazona @brettcannon @venthur @fcodvpt

Thank you for the insight! I didn't know sdists have such use case, and it didn't come to my mind that the sdist has also the tests+docs included. Perhaps something that could be added to https://packaging.python.org/en/latest/glossary/#term-Source-Distribution-or-sdist

Thanks for the build module tip! Haven't stumbled onto that before.

fohrloop,
@fohrloop@fosstodon.org avatar

@diazona @brettcannon @venthur @fcodvpt

Just tested the "python -m build" on a project, and the difference of wheel and sdist was

  1. wheel has .dist-info folder with entry_points.txt, LICENSE.txt, METADATA, RECORD and WHEEL files.

  2. sdist had LICENSE.txt, PKG_INFO, pyproject.toml and README.md files at the root level

In other words, the tests (or docs other than README) were not included. I'm using flit. Maybe it's something about my configuration.

fohrloop, to python
@fohrloop@fosstodon.org avatar

Do you use the PEP634 match + case statements to replace if-elif-elif-elif-else.. ? How do you decide to use if statements or the structural pattern matching?

https://docs.python.org/3/whatsnew/3.10.html#pep-634-structural-pattern-matching

#python

fohrloop,
@fohrloop@fosstodon.org avatar

@bouncing I've never found myself from a situation where I would have liked to use the match statement. But I'm curious to hear from other devs if they found it better than if statements in some situation.

#python

arraybolt3, to python
@arraybolt3@theres.life avatar

This is why I hate Python.

fohrloop,
@fohrloop@fosstodon.org avatar

@paarth @hugovk @arraybolt3 still surprisingly many use python 3.7 or even 3.6. At least if you trust the numpy download statistics, which shows that 3.7 is still the most popular one

  • All
  • Subscribed
  • Moderated
  • Favorites
  • megavids
  • mdbf
  • osvaldo12
  • thenastyranch
  • InstantRegret
  • Youngstown
  • rosin
  • slotface
  • Durango
  • ngwrru68w68
  • khanakhh
  • kavyap
  • everett
  • DreamBathrooms
  • Leos
  • magazineikmin
  • modclub
  • GTA5RPClips
  • vwfavf
  • tacticalgear
  • ethstaker
  • cubers
  • cisconetworking
  • normalnudes
  • tester
  • anitta
  • provamag3
  • JUstTest
  • All magazines