Skip to content
Snippets Groups Projects
  1. Dec 11, 2017
  2. Dec 10, 2017
    • Paul Sokolovsky's avatar
      docs/reference/packages: Add chapter on distribution packages and deployment. · c60fc670
      Paul Sokolovsky authored
      A long overdue overview of preparing packages, installing them with upip,
      freezing, dealing with resources. Initial version, more iterations required.
      c60fc670
    • Paul Sokolovsky's avatar
      unix/mpconfigport: Disable uio.resource_stream(). · e7fc7658
      Paul Sokolovsky authored
      This function was implemented as an experiment, and was enabled only in
      unix port. To remind, it allows to access arbitrary files frozen as
      source modules (vs bytecode).
      
      However, further experimentation showed that the same functionality can
      be implemented with frozen bytecode. The process requires more steps, but
      with suitable toolset it doesn't matter patch. This process is:
      
      1. Convert binary files into "Python resource module" with
      tools/mpy_bin2res.py.
      2. Freeze as the bytecode.
      3. Use micropython-lib's pkg_resources.resource_stream() to access it.
      
      In other words, the extra step is using tools/mpy_bin2res.py (because
      there would be wrapper for uio.resource_stream() anyway).
      
      Going frozen bytecode route allows more flexibility, and same/additional
      efficiency:
      
      1. Frozen source support can be disabled altogether for additional code
      savings.
      2. Resources could be also accessed as a buffer, not just as a stream.
      
      There're few caveats too:
      
      1. It wasn't actually profiled the overhead of storing a resource in
      "Python resource module" vs storing it directly, but it's assumed that
      overhead is small.
      2. The "efficiency" claim above applies to the case when resource
      file is frozen as the bytecode. If it's not, it actually will take a
      lot of RAM on loading. But in this case, the resource file should not
      be used (i.e. generated) in the first place, and micropython-lib's
      pkg_resources.resource_stream() implementation has the appropriate
      fallback to read the raw files instead. This still poses some distribution
      issues, e.g. to deployable to baremetal ports (which almost certainly
      would require freezeing as the bytecode), a distribution package should
      include the resource module. But for non-freezing deployment, presense
      of resource module will lead to memory inefficiency.
      
      All the discussion above reminds why uio.resource_stream() was implemented
      in the first place - to address some of the issues above. However, since
      then, frozen bytecode approach seems to prevail, so, while there're still
      some issues to address with it, this change is being made.
      
      This change saves 488 bytes for the unix x86_64 port.
      e7fc7658
  3. Dec 09, 2017
  4. Dec 08, 2017
  5. Dec 07, 2017
  6. Dec 06, 2017
  7. Dec 05, 2017
  8. Dec 04, 2017
  9. Dec 03, 2017
  10. Dec 01, 2017
Loading