Skip to content

test: add local VCS helper package; VCS entries for environment and requirements testbeds - #1163

Open
pinsara23 wants to merge 1 commit into
CycloneDX:mainfrom
pinsara23:tests/pipenv-local-vcs
Open

pinsara23 wants to merge 1 commit into
CycloneDX:mainfrom
pinsara23:tests/pipenv-local-vcs

Conversation

@pinsara23

@pinsara23 pinsara23 commented Nov 30, 2026 •

Copy link
Copy Markdown

Adds test data for VCS dependencies, as discussed above. Snapshots record the current behavior, so the fix for #1152 will show its effect as snapshot changes.

  • new helper _helpers/local_pckages/e_vcs: a tiny package plus init_repo.py, which turns the folder into a local git repo on demand (skips if .git exists; fixed author/branch via git config, fixed commit date, core.autocrlf=input, so the commit hash is reproducible across machines). .git is gitignored. See its README.
  • environment: local testbed runs init_repo.py and installs package-e via git+file:// (absolute URL resolved at install time; pip doesn't support relative VCS URLs)
  • requirements: git+ssh://git@… entry added to with-urls.txt; local git+file:///… entry added to local.txt

Follow-up PRs: pipenv and poetry lock files, regenerated with the real tools against the helper repo.

No code changes. Prepares #1152.

I used Claude Code to help prepare this change; I reviewed it myself.

@pinsara23
pinsara23 requested a review from a team as a code owner November 30, 2026 11:24
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@jkowalleck

Copy link
Copy Markdown
Member

please also add a git+ssh://git@... link if it is missing

please streamline the test beds with existing ones

please consolidate the tested - we probably already have ones for the purposes.
I see we have a with-urls and a local already - use them.

And while on it, please dont scope this around pipenv - add them entries for all the supported methods.

After this, please adjust the PR title and description.
Thanks in advance.

@pinsara23

Copy link
Copy Markdown
Author

Thanks! I'll repurpose this PR and drop the separate local-vcs testbed. Plan:

  • requirements: add a git+ssh://git@… entry to with-urls.txt, and local VCS entries (git+file:///…, file:///…) to local.txt
  • pipenv: with-urls already covers git+ssh (six); add local VCS entries to local
  • poetry: with-urls already covers ssh://git@…; add a local git dependency to local and regenerate lock10/11/20/21
  • environment: add a local VCS install to local

Two questions before I start:

  1. Local VCS entries need a real git repo for locking/installing, and file:// URLs are absolute and machine-specific. Should the init scripts create a throwaway git repo (e.g. from _helpers/local_pckages/c) at init time, or would you prefer hand-written lock entries with a fixed placeholder path like file:///path/to/repo?
  2. For environment, installing via git+ssh needs SSH credentials, so I'd cover ssh only in the requirements/lock-file testbeds. OK?

@pinsara23 pinsara23 changed the title test(pipenv): add testbed for local VCS dependencies test: add local VCS and git+ssh entries to testbeds Nov 30, 2026
@jkowalleck

Copy link
Copy Markdown
Member

Two questions before I start:

  1. Local VCS entries need a real git repo for locking/installing, and file:// URLs are absolute and machine-specific. Should the init scripts create a throwaway git repo (e.g. from _helpers/local_pckages/c) at init time, or would you prefer hand-written lock entries with a fixed placeholder path like file:///path/to/repo?

Interesting point, and thanks for bringing this up. 👍
Did not think about this earlier.

My first idea was - and it is pretty raw:

  • lets have a new _helpers/local_pckages/<something>
    • with a readme that tells what this about and how it need to be setup
    • add all the files needed for python
    • add a .gitconfig
      • sets the default author
      • sets the default branch name
    • add a .gitignore that omits any python caches AND the .git folder
    • add a septup.py - or setup.bat(windows) and setup.sh(non-windows)
      that does the following:
      • if a .git folder exists, it will just stop
      • puts this file under git - run git init
    • did I forget something? Anything else that could be beneficial or needed?
  • lets call the respective setup script before any install that depends on it.
  • Q: can we use relative paths for the URL in the manifest(pipfile, ...)?
  • e.g. git+file:../../
  • did not test it
  • what are our options here? make a relative URL on install-time?
  1. For environment, installing via git+ssh needs SSH credentials, so I'd cover ssh only in the requirements/lock-file testbeds. OK?

please add one wherever possible - please don't write lock files from hand.

There are options to use repos without credentials - like git+ssh://git@github.com:CycloneDX/cyclonedx-python-lib.git
see existing one:

six = {ref = "1.16.0", git = "git+ssh://git@github.com/benjaminp/six.git"}

@pinsara23

Copy link
Copy Markdown
Author

Thanks! Agreed on the helper-package approach. A few findings before I build it:

  1. Relative URLs: pip rejects them for VCS. I tried git+file:repos/pkg, git+file:./repos/pkg and git+file://./repos/pkg, and all fail. So the setup step would resolve the absolute git+file:// URL at install/lock time.
  2. A .gitconfig inside the folder isn't picked up by git (only ~/.gitconfig and .git/config are read), so the setup script would pass author/branch via git -c … / GIT_* env vars, with a fixed author date, so the commit hash is reproducible (it ends up in lock files and snapshots).
  3. I'd avoid naming it setup.py, since pip would treat it as the package's build script. Suggest one cross-platform init_repo.py instead of .bat/.sh.
  4. git+ssh://git@github.com/… always needs an SSH key on GitHub, even for public repos (git@ is just the ssh user). That's fine for lock files, which are only read, but the environment testbed installs in CI, so ssh there would need a key. OK to cover ssh in requirements/pipenv/poetry only?

Plan: add _helpers/local_pckages/e_vcs (README, package files, .gitignore incl. .git, init_repo.py); call it from the environment init.py; regenerate pipenv and poetry lock files with the real tools instead of hand edits.

To keep reviews manageable, I'd split this: this PR → helper package + environment + requirements; follow-up PRs for pipenv and poetry lock files. OK?

@jkowalleck

Copy link
Copy Markdown
Member
  1. Relative URLs: pip rejects them for VCS. I tried git+file:repos/pkg, git+file:./repos/pkg and git+file://./repos/pkg, and all fail. So the setup step would resolve the absolute git+file:// URL at install/lock time.

Understood. Sounds good to me.

  1. A .gitconfig inside the folder isn't picked up by git (only ~/.gitconfig and .git/config are read), so the setup script would pass author/branch via git -c … / GIT_* env vars, with a fixed author date, so the commit hash is reproducible (it ends up in lock files and snapshots).

I see. or have a separate section in the setup scripts - git config ....
Pick whatever appears right to you.

  1. I'd avoid naming it setup.py, since pip would treat it as the package's build script. Suggest one cross-platform init_repo.py instead of .bat/.sh.

good catch. fully agree!

  1. git+ssh://git@github.com/… always needs an SSH key on GitHub, even for public repos (git@ is just the ssh user). That's fine for lock files, which are only read, but the environment testbed installs in CI, so ssh there would need a key. OK to cover ssh in requirements/pipenv/poetry only?

sounds reasonable - lets start with this. If needed, we can add on it later.

Plan: add _helpers/local_pckages/e_vcs (README, package files, .gitignore incl. .git, init_repo.py); call it from the environment init.py; regenerate pipenv and poetry lock files with the real tools instead of hand edits.

To keep reviews manageable, I'd split this: this PR → helper package + environment + requirements; follow-up PRs for pipenv and poetry lock files. OK?

thank you very much. please go ahead.

@jkowalleck jkowalleck added the CT Continuous Testing label Nov 30, 2026
@pinsara23
pinsara23 force-pushed the tests/pipenv-local-vcs branch from 38defdb to 96f52ab Compare November 30, 2026 17:51
@pinsara23 pinsara23 changed the title test: add local VCS and git+ssh entries to testbeds test: add local VCS helper package; VCS entries for environment and requirements testbeds Nov 30, 2026
@read-the-docs-community

read-the-docs-community Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 CycloneDX Python SBOM Tool | 🛠️ Build #36273066 | 📁 Comparing af028a7 against latest (617e617)

  🔍 Preview build  

1 file changed
± changelog.html

…d requirements testbeds

Signed-off-by: Pinsara Sarathchandra <113714@foe.sjp.ac.lk>
@pinsara23
pinsara23 force-pushed the tests/pipenv-local-vcs branch from 96f52ab to af028a7 Compare November 30, 2026 17:54
@pinsara23

Copy link
Copy Markdown
Author

Fixed: the first push accidentally recorded e_vcs as an embedded repo (gitlink); it's now the 5 real files. Sorry for the noise.

Started on the pipenv follow-up and found a design question, which also applies to poetry:

  • pipenv (2026.8.0) rejects relative VCS URLs too: git+file:../../_helpers/… fails an assertion, and a bare relative path is refused as an unsupported URL.
  • With an absolute git+file:///… it locks fine, and ref = "main" resolves to the reproducible commit from init_repo.py.
  • But then Pipfile/Pipfile.lock (and snapshots) contain the absolute path of whichever machine ran the lock.

Options I see:
A) commit the lock as generated, absolute path included (the tool only reads it)
B) lock with the real tool, then rewrite the machine-specific prefix to a placeholder via a small script
C) generate Pipfile + Pipfile.lock at test-init time via an init.py, like the environment testbeds

Which would you prefer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CT Continuous Testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants