3

Does anyone know of any example of a single source code repository (e.g., GitHub repository) containing (i.e., hosting) multiple python packages. I want to identify the package directory within a repository when the repository contains multiple packages. Is there a reliable way to do this given that python packages can use different build tools (e.g., setuptools, poetry) and have different file structures?

Nasif Imtiaz Ohi
  • 1,563
  • 5
  • 24
  • 45
  • What exactly do you mean by "repository" in this context? PyPI evidently contains multiple packages, and I don't think you're asking about a git repository? Are you asking if a package contains multiple modules? – Grismar Nov 17 '21 at 00:01
  • source repository, e.g. GitHub repository. – Nasif Imtiaz Ohi Nov 17 '21 at 00:02
  • Nope. Multiple packages hosted in a single GitHub repository. How to locate package directory within such a repository? – Nasif Imtiaz Ohi Nov 17 '21 at 00:03
  • I see, there might be some way to do it, but not a trivial one, as Git isn't specific to Python packages - why do you need to know? What are you trying to achieve? – Grismar Nov 17 '21 at 00:03
  • I am trying to map files in package wheel files to corresponding file path into its source repository. In a normal case, it may be trivial. However, in a corner case where a repository contains multiple packages, and those packages may share a file with a similar name, it is non-trivial to gain such file path mapping. – Nasif Imtiaz Ohi Nov 17 '21 at 00:06
  • for a compairson, npm api provides such directory info. See `repository` key in https://registry.npmjs.org/react-dom – Nasif Imtiaz Ohi Nov 17 '21 at 00:08
  • If you know the repo and path into the repo for the wheel, how does it affect your mapping if there's also other packages in there? Python's packaging file structure shouldn't cause confusion? If you feel there *is* a practical problem, please describe the actual problem in your question. – Grismar Nov 17 '21 at 00:13
  • This: https://stackoverflow.com/a/19516714/7976758 ? Found in https://stackoverflow.com/search?q=%5Bgit%5D+%5Bpip%5D+subdirectory – phd Nov 17 '21 at 00:17
  • Does this answer your question? [How can I install from a git subdirectory with pip?](https://stackoverflow.com/questions/13566200/how-can-i-install-from-a-git-subdirectory-with-pip) – Peter Badida Nov 17 '21 at 00:18
  • I want to know the "path into the repo for the wheel" @Grismar – Nasif Imtiaz Ohi Nov 17 '21 at 00:21
  • Not really @PeterBadida, say I found such a package wheel (published from a subdirectory) from the pypi, and then want I to reverse engineer which subdirectory the wheel came from (given that I know the repository URL). – Nasif Imtiaz Ohi Nov 17 '21 at 00:23
  • 1
    How do you "know the repository URL", but don't know the location in the repository? Where are you getting it from? Please provide some actual code and a clearer description. I'm voting to close for lack of debugging details. – Grismar Nov 17 '21 at 00:32
  • 1
    My question originally was that do you know of any such GitHub repo example? – Nasif Imtiaz Ohi Nov 17 '21 at 00:34
  • I am looking for the same thing. The question is clear, one repo used to produce multiple packages (wheels). – sorin Jul 05 '22 at 09:47

0 Answers0