r/learnpython • • 1d ago

How do you keep a small open-source package maintained over time?

I recently published my first package on PyPI. It works and has tests and CI, but I've never maintained anything long term. For those of you with packages people actually use:

  • How to determine which features should be in a patch and which in a small release. And when to upgrade to 1.0?

  • How to ensure that your dependencies and GitHub actions are up-to-date without it becoming tedious. For example, is Dependabot or Renovate (or another tool) used?

  • Should dependencies be version locked or not?

  • How much time do you allocate to this? And how do you manage it if you are particularly busy?

All good practice and common errors are really appreciated!

7 Upvotes

13 comments sorted by

8

u/1One2Twenty2Two 1d ago
  • Start at 0.1.0 and increase the minor or patch according to semver. FastAPI still a major of 0 after like 6 years, so don't worry about that. Just be consistent.

  • Yes, use Dependabot or Renovate

  • Always. You can use a package manager like uv or pip compile to generate the equivalent of lock files.

  • Only you can answer this one!

1

u/MostimaSimp 1d ago

Thank you!

For Pinning - I think you're referring to pinning development and CI environment libraries but allowing version ranges (for example pandas>=2.2) to be used in published code. I believe that if a library pins versions then this can lead to issues when it is installed with other packages.

I've been setting up Dependabot this week. As for my final query, yes I'm targeting around one hour per day, together with a nightly CI process which connects to actual data sources. This means that I can rapidly ascertain if upstream issues are arising.

2

u/1One2Twenty2Two 1d ago

For Pinning - I think you're referring to pinning development and CI environment libraries but allowing version ranges (for example pandas>=2.2) to be used in published code

Exactly. You can provide ranges but try to always provide a minimal version.

1

u/MostimaSimp 1d ago

Alright, thanks! Whilst each requirement has a minimum set, only the pandas one is validated in CI. I will create a job which installs all requirements at their minimum versions so that the minimums are valid.

1

u/latkde 22h ago

allowing version ranges (for example pandas>=2.2) to be used in published code. I believe that if a library pins versions then this can lead to issues when it is installed with other packages.

Yes, it's a best practice to set a lower bound, but not an upper bound. Otherwise, downstream users can't upgrade other packages (including security updates!) without having to wait for you. Most major versions will not break your code, so it's best to allow them.

(In rare cases, you may know about actual incompatibilities, in which case upper bounds may be warranted, but that can also cause pip/poetry/uv to select unintuitive dependency solutions, like downgrading to an older version of your package where constraints were more relaxed. It's better to fix incompatibilities, using imports with fallbacks if necessary.)

Specifically, avoid upper bounds in these pyproject fields:

  • [project] requires-python

  • [project] dependencies

  • [project.optional-dependencies]

In contrast, these places may be fine:

  • [dependency-groups], as these only apply when working on your project, without affecting downstream code. For example, put dev-dependencies here.

  • [build-system] has no clear recommendation. This is irrelevant for downstream users if you publish a pure-Python wheel.

3

u/kilkil 23h ago
  1. there is a standard for this which most people follow, called Semantic Versioning (aka "SemVer"). Read through the rules, it addresses both of your questions (patch vs release, when to go to 1.0).

  2. not sure on keep dependencies up-to-date, curious to hear others' solutions to this as well.

  3. yes 100%, your dependencies need to have their exact versions pinned and they should only be updated when you explicitly want to do it. otherwise your project has much higher risk to have inconsistent, difficult-to-reproduce bugs, not to mention a much higher vulnerability to supply chain attacks.

  4. no clue on this one either, sorry. it's a tough problem, being an open source maintainer under capitalism is rough.

2

u/MostimaSimp 22h ago

Thanks for the SemVer reminder!

2

u/billsil 22h ago

I don’t really care about version releases. I hate packaging. I like being creative.

I pick python 3.11-3.15 and try to support various package combinations and all versions of all dependencies. It doesn’t add that much if a limitation. Test low and test high and you’re good. I play whack-a-mole occasionally. It’s not bad if you stay up on it. Oh package x changed. It obviously broke it. Fix the warnings.

If I’m busy I don’t do it. It’s not my day job.

2

u/MostimaSimp 22h ago

​That sounds like a super sustainable way to keep it fun without burning out—testing low and high dependency bounds is a great sanity check. Really appreciate your input!

1

u/Top-Cauliflower-1808 19h ago

Patch is bug fixes only and minor is new backward compatible features. Save 1.0 for when you are ready to support the public interface for years. Renovate groups updates better than Dependabot and locking dependencies is right for applications but wrong for a library. Thirty minutes a week is enough if you ignore most update noise and only act on security and breaking changes.

1

u/Sufficient-Tale6131 9h ago

For that minimum versions job, uv can do the resolving for you: uv sync --resolution lowest-direct (or uv pip install --resolution lowest-direct . if you're not using uv projects) installs the lowest version allowed by each of your direct dependencies, straight from pyproject. So there's no second pinned list to keep in sync. Run it on the oldest Python you support though, old pandas releases often have no wheels for newer Pythons and it'll try to build from source.

1

u/Downtown_Cat_7425 9h ago

For a small package, the biggest maintenance win is keeping the surface area tiny. Keep runtime dependencies at zero if you can, put CI on at least two Python versions, write a CHANGELOG from day one, and add a CONTRIBUTING file with the exact test command. Use semantic versioning even for 0.x so breaking changes are obvious, and tag releases in git. Add issue templates that ask for reproduction details - it cuts the back-and-forth massively. A quiet repo with a clear README is fine; burnout is the main reason small packages die.