Skip to main content

All Questions

Tagged with
0 votes
0 answers
32 views

API design for precomputation cache [closed]

In my numeric code library I have a function totient_sum that depends on an expensive one-time precomputation totsum_range = [...], then different calls to totient_sum(n) are quick. There are several ...
qwr's user avatar
  • 342
1 vote
2 answers
65 views

Hierachy and API design for a CSS-selector-related Python library

I'm writing a Python CSS-selector library that allows one to write these kinds of expressions in Python as a pet project. The goal of the library is to represent selectors in a flat, intuitive and ...
InSync's user avatar
  • 137
3 votes
2 answers
377 views

Best approach to microservice shared databse architecture

I have two microservices, one Flask (python) and one Spring (java), they currently share a database. The Flask microservice handles processing json files (~40mb) for each user (could be 100's or 1000'...
MSmith's user avatar
  • 31
2 votes
1 answer
10k views

Is it considered as bad practice to have code on the __init__.py? [closed]

I am a bit confused about best practices when it comes to where and how to initiate the Flask() or FastAPI() for a data-intensive web API. The vast majority of the code available online is using this ...
Pierre-Alexandre's user avatar
0 votes
1 answer
2k views

Designing a system to hit multiple HTTP requests serially

Hope this is the right StackExchange community to ask this question. I am building a (Python) project that will have a list if URLs to hit. They have to be hit serially, and part of response of one ...
Shod's user avatar
  • 109
-1 votes
1 answer
885 views

Why is `replace(dataclass, **kwargs)` a function, and not a member?

Imagine a simple data class: @dataclass class Settings: m: int s: str old = Settings(m=10, s="ten") It feels normal to write new = old.replace(m=1), but we have to write new = replace(...
xtofl's user avatar
  • 344
3 votes
2 answers
3k views

Communication between two apps

I am thinking of creating two applications, one of which (App 1) will be in Django (DRF) and other (App 2)might be Django but might be another more lightweight framework (maybe Flask or plain Django ...
Alex T's user avatar
  • 161
3 votes
3 answers
490 views

Indexable iterators

Suppose someone designs an indexable iterator class, i.e. an iterator that supports __getitem__ for (non-negative) integer indexes such as the following: In [1] it = indexed_iter("abcdefghij"...
gsakkis's user avatar
  • 413
0 votes
2 answers
712 views

User-friendly parameter parsing from yaml

Problem I have designed an evaluation tool (in python) and need some help to make it more user friendly. The tool requires ~100 (nested) parameters, which it gets from a yaml file and stores ...
gebbissimo's user avatar
0 votes
1 answer
106 views

Design decision of reading XLSX file at once or intermittently

I am working on converting an existing python based monolith solution to a microservice. The current flow is pretty straight forward: Accept XLSX as input -> Run some complex algorithms based on ...
Pro's user avatar
  • 173
1 vote
1 answer
298 views

mongodb queries architecture - resolving lots of nested referenced objects

I have an angular 8 application, with a Python + MongoDB API on the backend. At present, I have 4 collections, namely: Users, Tasks, Companies and Groups. All of these resource types are retrievable ...
Slepton's user avatar
  • 51
1 vote
1 answer
1k views

Designing an Entity Component System for interfacing with a scripting language

I am currently building an Entity Component System (ECS) in cython in order to speed up operating on large numbers of game objects in python. In the process of building this system, I ran into the ...
CodeSurgeon's user avatar
-1 votes
1 answer
122 views

Making the REST API to act as a playlist

Imagine the application I am building as a normal media playlist (Video / Music). On the client side, I select the files I want to play (Files are located on server), and I send its paths to the ...
Dino's user avatar
  • 107
3 votes
2 answers
129 views

Designing a Python API with defaults

I'm designing an API for a Python library. The user will create objects with several parameters. In most cases, the user will either leave these at their default values or will set them globally, for ...
N. Virgo's user avatar
  • 894
4 votes
3 answers
1k views

How can I resolve this **kwargs antipattern?

I am a hobbyist programmer, working on a much more complex Python project than I've attempted before, which is in the form of a Python library. I find that I'm often passing **kwargs around (as ...
N. Virgo's user avatar
  • 894

15 30 50 per page