Better Python Project Maintenance

In the process of maintaining PyPI packages and projects, I often encounter two main pain points:

  1. Complexity of Uploading and Publishing: In the past, uploading a PyPI package typically required configuring a PyPI Token, which poses a security risk. It also required local or CI packaging and uploading. For projects involving .whl files, additional environment configurations were necessary, which added to the workload.
  2. Slow Dependency Locking: Larger Python projects often have many sub-dependencies, and not locking versions can lead to compatibility issues due to upstream changes. Traditional tools like PDM and Poetry are somewhat slow when locking dependencies, and the process can be frustrating. Back in 2021, I used Poetry to lock a project’s dependencies, and after 10 minutes, it still failed; since then, I haven’t used it.

Fortunately, solutions for these issues have emerged in recent years.

Read more

What Does the Python Version Number x.y Actually Mean?

At work, we use uv to manage Python projects, which allows us to quickly install dependencies and lock sub-dependency versions. After returning from a period of leave, I routinely updated the packages on my computer and noticed that uv had a new version, so I updated it. However, after updating the uv.lock file in a project, I found that many wheels for dependencies had disappeared from the lock file.

For example, here’s the configuration of the pyproject.toml file:

Read more

Better work status

I want to share 2 storirs about me on handling work status:

  1. Short term remote work
  2. Get more focus time in the morning

Life in Suzhou

Back in the summer of 2021, my house rental was canceled by the owner, and I had to move to another place. By then, the renting prices in Beijing were too high for me to rent a house. Fortunately, I was lucky enough to book a house one month after my current house was canceled. So, I needed to find a place to live for one month. My friend decided to move to Suzhou, a city near Shanghai, which is much more affordable than Beijing. For a month, I sat in a coffee shop and worked remotely.

Read more

Python you let me down

Personally, I’m very disappointed about the some Python community people/projects.

It’s been years that PEP 3000(the year was 2006) came up, but we need to wait years until Python 3.11(the year was 2022) to get real performance improvements? Why people keep using Python and spending lots of time to add typing which doesn’t have run time check instead of rewriting codes in Go to get huge speed up while enjoying static language’s safe static type?

Read more

Thought on Python’s DataFrame

Note

History of package tzf

The basic development work of tzf and related projects has basically stabilized. In the previous article, there are sporadic information about the development and design process:

This article is the final summary, from the start-up of the project to the gradual optimization and evolution.

Read more

Geographic aggregation using the map tile index

When dealing with large amounts of scattered data, sometimes we need to provide a read-only query API to visualize on a map. When the amount of data is too large, say millions, it is not appropriate to return it all to the front end for processing on the browser. Some aggregation should be completed within the back-end service to return the aggregated search to the front end. Here’s how to do this with the MongoDB + tile index in Go.

Read more

Computing AQI in Go

I write a package named aqi.

Install:

go install github.com/ringsaturn/aqi

For China’s HJ633-2012 standar:

package main

import (
	"fmt"

	"github.com/ringsaturn/aqi"
	"github.com/ringsaturn/aqi/mep"
)

func main() {
	algo := &mep.Algo{}
	inputs := []*aqi.Var{
		{
			P:     aqi.Pollutant_PM2_5_1H,
			Value: 16,
		},
		{
			P:     aqi.Pollutant_PM10_1H,
			Value: 88,
		},
		{
			P:     aqi.Pollutant_CO_1H,
			Value: 0.2,
		},
		{
			P:     aqi.Pollutant_SO2_1H,
			Value: 3,
		},
		{
			P:     aqi.Pollutant_NO2_1H,
			Value: 11,
		},
		{
			P:     aqi.Pollutant_O3_1H,
			Value: 75,
		},
	}
	aqi, primaryPollutant, err := algo.Calc(inputs...)
	if err != nil {
		panic(err)
	}
	levelDesc, err := algo.AQIToDesc(aqi)
	if err != nil {
		panic(err)
	}
	fmt.Printf("aqi=%v as level=%v with primary pollutant as %v\n", aqi, levelDesc, primaryPollutant)
}

Output:

Read more