Skip to content

Instantly share code, notes, and snippets.

@mrakitin
Last active March 2, 2024 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrakitin/b53d00d7ea167f3c7515f2929dd1199c to your computer and use it in GitHub Desktop.
Save mrakitin/b53d00d7ea167f3c7515f2929dd1199c to your computer and use it in GitHub Desktop.

Commands to identify all importable modules/packages for a Python git repo


Update on 2024-03-02

blop  main 🐍 v3.11.7
🕙 12:27:07 ❯ cd src

blop/src  main
🕙 12:27:12 ❯ find blop -name "*.py" | grep -v tests | sed 's/.__init__.py//g' | sed 's/._version//g' | sed 's;/;.;g' | sed 's/\.py//g'| sort -u
blop
blop.agent
blop.bayesian
blop.bayesian.acquisition
blop.bayesian.acquisition.analytic
blop.bayesian.acquisition.monte_carlo
blop.bayesian.kernels
blop.bayesian.models
blop.bayesian.plotting
blop.bayesian.transforms
blop.de
blop.de.de_opt_utils
blop.de.de_optimization
blop.de.hardware_flyer
blop.digestion
blop.dofs
blop.experiments
blop.experiments.atf
blop.experiments.atf.atf
blop.experiments.nsls2
blop.experiments.nsls2.iss
blop.experiments.nsls2.tes
blop.experiments.sirepo
blop.experiments.sirepo.tes
blop.objectives
blop.plans
blop.utils
blop.utils.functions
blop.utils.misc
blop.utils.prepare_re_env

Update on 2023-04-25

$ find bloptools -name "*.py" | grep -v tests | sed 's/.__init__.py//g' | sed 's/._version//g' | sed 's;/;.;g' | sed 's/\.py//g'| sort -u

Example output on 2023-04-25

bloptools
bloptools.bo
bloptools.bo.acquisition
bloptools.bo.kernels
bloptools.bo.models
bloptools.de
bloptools.de.de_opt_utils
bloptools.de.de_optimization
bloptools.de.hardware_flyer
bloptools.experiments
bloptools.experiments.atf
bloptools.experiments.atf.atf
bloptools.experiments.nsls2
bloptools.experiments.nsls2.iss
bloptools.experiments.nsls2.tes
bloptools.experiments.shadow
bloptools.experiments.shadow.chx
bloptools.experiments.shadow.tes
bloptools.utils

Commands

$ project="tiled"
$ git clone https://github.com/bluesky/${project}
$ find ${project} -name "*.py" | grep -v tests | sed 's/.__init__.py//g' | sed 's;/;.;g'

Example output

This is the output for the latest commit c9d9022 on 2022-04-06:

tiled
tiled._version
tiled.adapters
tiled.adapters.array
tiled.adapters.dataframe
tiled.adapters.excel
tiled.adapters.files
tiled.adapters.hdf5
tiled.adapters.mapping
tiled.adapters.tiff
tiled.adapters.utils
tiled.adapters.xarray
tiled.authenticators
tiled.client
tiled.client._async_bridge
tiled.client.array
tiled.client.base
tiled.client.cache
tiled.client.constructors
tiled.client.context
tiled.client.dataframe
tiled.client.node
tiled.client.utils
tiled.client.xarray
tiled.commandline
tiled.commandline.main
tiled.config
tiled.database
tiled.database.alembic_utils
tiled.database.base
tiled.database.core
tiled.database.migrations.env
tiled.database.migrations.versions.481830dd6c11_initialize
tiled.database.migrations.versions.722ff4e4fcc7_add_write_scopes_to_default_roles
tiled.database.orm
tiled.examples
tiled.examples.generate_files
tiled.examples.generated
tiled.examples.generated_minimal
tiled.examples.nexus
tiled.examples.numpy_structured_dtypes
tiled.examples.toy_authentication
tiled.examples.xdi
tiled.media_type_registration
tiled.profiles
tiled.queries
tiled.query_registration
tiled.scopes
tiled.server
tiled.server.app
tiled.server.authentication
tiled.server.compression
tiled.server.core
tiled.server.dependencies
tiled.server.etag
tiled.server.metrics
tiled.server.object_cache
tiled.server.router
tiled.server.schemas
tiled.server.settings
tiled.server.utils
tiled.structures
tiled.structures.array
tiled.structures.core
tiled.structures.dataframe
tiled.structures.image_serializer_helpers
tiled.structures.node
tiled.structures.xarray
tiled.utils
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment