/r/PythonCoding monthly "What are you working on?" thread

Share what you're working on in this thread. What's the end goal, what are design decisions you've made and how are things working out? Discussing trade-offs or other kinds of reflection are encouraged!

If you include code, we'll be more lenient with moderation in this thread: feel free to ask for help, reviews or other types of input that normally are not allowed.

5 comments · 72% upvoted · other discussions

comments

dogweather

I'm working on a data-driven app, without a database. Instead of primary keys and foreign key constraints, I'm using typing.Literal and Pydantic models. This makes sense to try because the final product is a statically generate website. My Python code does all the content preparation.

So, for example:

```python Category = Literal[ 'Data Formats and Serialization', 'Data Structures', 'Data and Text Processing',

...

]

Topic = Literal[ 'Calculating a date in the future or past', 'Capitalizing a string', 'Checking if a directory exists',

...

]

CATEGORIES_AND_TOPICS: dict[Category, list[Topic]] = { "Getting Started": [ "Starting a new project", ], "Strings": [ "Capitalizing a string", "Concatenating strings",

...

}

class ArticleSpec(BaseModel): """ A specification of a programming article. It consists of a topic, programming language, and natural language. """ model_config = ConfigDict(frozen=True)

human_lang: HumanLang
prog_lang:  ProgLang
topic:      Topic

```

Etc. I can now make complicated data structures from these Literals and I have existence checking right in my IDE. It catches typos right away, etc.

My Python CLI app is idempotent, so when I run it, it only fills in missing data. So for me to add new content and regenerate, it's pretty easy.

TheMeticulousNinja

Need to revisit my Tetris project

DmitrievichLevin

Just released Beta of an Open Source Pure Python Binary Protocol Buffer (Renity), check it out!

Renity @ Github

JackLogan007

Volcanic ash plume height detection