agentleFS
apacheapache/skywalking-ai-sessionizer/.claude/skills/pypi/SKILL.md

pypi

Skill7 starsChanged 51 days agoApache-2.0View on GitHub

Publish a released version of the Apache SkyWalking AI Sessionizer LangChain plugin, apache-skywalking-asz-langchain, to PyPI. Says what a release manager sets up before the first upload, downloads the voted source package, verifies it, builds the source distribution and the wheel from plugins/langchain inside it, checks and installs them, and uploads them with twine. Use after a version is published.

  • Installs packages

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. SiteSkills/siteskills-cowork-plugin★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository4 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Ask for the version when it is not given.

    line 17
  2. Distinctive:

    Check it without printing it.

    line 36
  3. Distinctive:

    Never print the token, and never write it into a file.

    line 42
  4. Distinctive:

    Stop if either check fails.

    line 68

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

PyPI

apache-skywalking-asz-langchain is the LangChain plugin under plugins/langchain. It is in the voted source package, and PyPI is a convenience channel written after the vote, as the Homebrew tap and the apt repository are. Nothing is uploaded for a candidate, and the version uploaded is the released one, which release.sh prepare wrote into plugins/langchain/pyproject.toml.

Unlike the Homebrew and apt skills, this one opens no pull request. It uploads, and an upload cannot be undone: PyPI never accepts a file name twice, even after the file is deleted.

Ask for the version when it is not given. Then:

0. Set up the upload

The project apache-skywalking-asz-langchain is on PyPI since 0.5.0, whose upload created it. Only an owner or a maintainer of the project on PyPI can upload. A release manager who is neither asks an owner to add them.

  1. A PyPI account with two-factor authentication. PyPI refuses an upload from an account without it.
  2. An API token. A token scoped to a project can only be made once the project exists. So the upload that creates a project needs a token scoped to the whole account, as 0.5.0 did. Every later upload uses a token scoped to apache-skywalking-asz-langchain. After the first upload, replace the account token with a project token, and delete the account token.
  3. The token in SW_PYPI_TOKEN, exported from the shell profile, such as ~/.zprofile, before Claude Code starts. When the 0.5.0 token was added to the profile during a session, the session did not see it until Claude Code was started again. Reading it out of the profile from inside the session was refused by the permission check of auto mode.

Check it without printing it. Stop and tell the user when it is not set:

[ -n "$SW_PYPI_TOKEN" ] && echo "SW_PYPI_TOKEN is set, ${#SW_PYPI_TOKEN} characters"

Never print the token, and never write it into a file.

1. Download the voted source package and verify it

The newest version is on downloads.apache.org minutes after the move. archive.apache.org holds every version, but gets a new one later: for 0.5.0 it still answered 404 fifteen minutes after the move, and 200 when checked again four hours later. So try the download site first.

v=VERSION
pkg=apache-skywalking-ai-sessionizer-$v-src.tgz
W=$(mktemp -d); cd "$W"
for f in "$pkg" "$pkg.sha512" "$pkg.asc"; do
  curl --noproxy '*' -fsSLO "https://downloads.apache.org/skywalking/ai-sessionizer/$v/$f" ||
    curl --noproxy '*' -fsSLO "https://archive.apache.org/dist/skywalking/ai-sessionizer/$v/$f"
done
curl --noproxy '*' -fsSL -o KEYS https://downloads.apache.org/skywalking/KEYS
gpg --dearmor < KEYS > keys.gpg
shasum -a 512 -c "$pkg.sha512" && gpgv --keyring "$W/keys.gpg" "$pkg.asc" "$pkg"
tar -xzf "$pkg"

gpgv reads KEYS from a file of its own, so the user's keyring is left alone. gpg --import into a scratch directory under a long path hung on macOS, waiting to start gpg-agent. A local proxy can break HTTPS to Apache hosts, which is why the commands go around it.

Stop if either check fails. Nothing is built from a package that did not verify.

2. Build from the package, not from a checkout

A checkout can hold what the vote did not.

python3 -m venv build-env && . build-env/bin/activate
pip install --quiet build twine
python -m build --outdir dist "apache-skywalking-ai-sessionizer-$v-src/plugins/langchain"
twine check dist/*

dist/ holds apache_skywalking_asz_langchain-$v.tar.gz and apache_skywalking_asz_langchain-$v-py3-none-any.whl. Check the version in the file names is $v, and that unzip -l dist/*.whl lists LICENSE and NOTICE under the .dist-info directory.

3. Install the wheel where nothing else is, and run it

asz-langchain status exits 1 while the plugin is not enabled and 0 while it is, so the checks below say which exit code they expect. enable writes only into the environment's own site directory.

python3 -m venv try-env && . try-env/bin/activate
pip install --quiet dist/*.whl
asz-langchain status && { echo "enabled before enable"; exit 1; }
asz-langchain enable && asz-langchain status || { echo "enable did not take"; exit 1; }
asz-langchain disable && ! asz-langchain status || { echo "disable did not take"; exit 1; }
deactivate

status must say "not enabled", then "enabled at ...", then "not enabled" again. Stop if a line prints its message.

4. Upload

. build-env/bin/activate
TWINE_USERNAME=__token__ TWINE_PASSWORD="${SW_PYPI_TOKEN:?SW_PYPI_TOKEN is not set}" \
  twine upload --non-interactive dist/*

--non-interactive makes a missing or refused token fail, rather than wait for a password prompt that nobody sees. To correct a version once it is uploaded, release the next version.

5. Check it landed

PyPI must hold the two files that were built, byte for byte, and they must install. Run this in the directory of the upload: a build run again from the same source gives other bytes. Measured on 0.5.0, a rebuilt wheel held the same files with the same bytes as the uploaded one, and differed only in the time recorded for the files the build writes.

curl -fsSL "https://pypi.org/pypi/apache-skywalking-asz-langchain/$v/json" |
  python3 -c 'import json, sys; [print(f["digests"]["sha256"] + "  " + f["filename"]) for f in json.load(sys.stdin)["urls"]]'
shasum -a 256 dist/*
python3 -m venv pypi-env && . pypi-env/bin/activate
pip install --quiet --no-cache-dir "apache-skywalking-asz-langchain==$v"
pip index versions apache-skywalking-asz-langchain
asz-langchain status; echo "exit $? (1: installed, not enabled)"
deactivate

Then say what was uploaded and where, and clean up $W. After an upload made with a token scoped to the whole account, remind the user to replace it with a token scoped to the project.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.