Skip to content
This repository was archived by the owner on Aug 6, 2025. It is now read-only.

Conversation

@SomeoneSerge
Copy link

This is a semi-automated change and relies on the python-rope/rope refactoring library:

$ nix shell github:SomeoneSerge/pkgs#prefix-python-modules
$ prefix-python-modules . --prefix dino

This change extends generic names, like utils, with the project project name.
This way dino can be used in the same PYTHONPATH with other projects without the risk of collision

The extra commit also adds a pyproject.toml file, which is just an easy way to have wheels automatically generated. Wheels make it easier to package dino in distributions, including those other than pypi.

The changes have been tested in a somewhat automated way12. Happy to revert or extend any particular bit if you like, just hoping to get the actual prefixes merged. Thanks

Footnotes

  1. https://github.com/SomeoneSerge/pkgs/blob/0d2b35d8704636ffb6538c24b4e5c180d9bb17a3/python-packages/by-name/om/omnimotion/preprocess-dataset.nix#L14-L18

  2. https://github.com/SomeoneSerge/pkgs/blob/0d2b35d8704636ffb6538c24b4e5c180d9bb17a3/python-packages/by-name/di/dino/package.nix#L29

This is a semi-automated change:

```bash
$ sed -i \
  -e 's/^\(\s*\)\(state_dict = torch.hub\)/\1print(f"Going to download {url=} via torch.hub")\n\1\2/' \
  utils.py
$ pname=dino
$ prefix-python-modules . --prefix $pname
```
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants