GitXplorerGitXplorer
m

python-private-packages

public
0 stars
0 forks
0 issues

Commits

List of commits on branch main.
Verified
7bf178fb2d7200bf22758f6c743c3215e6c4afbc

Merge pull request #1 from miketheman/dependabot/pip/black-24.3.0

mmiketheman committed 10 months ago
Verified
4616083c1fc3251daebfa057b2c4bf48bf6e40f0

build(deps-dev): Bump black from 20.8b1 to 24.3.0

ddependabot[bot] committed 10 months ago
Verified
7bc4ea0a04805e6b4f60316d125700f300ef69c1

test: remove tests for internals, only test public

mmiketheman committed 4 years ago
Verified
dc0bbe89924c64acfb1b3dfcde7cc4eca64dd2b6

refactor: move words to a private package

mmiketheman committed 4 years ago
Verified
dd739d7ab0bb6c1113e9efc738ce2c15d0197224

Initial structure

mmiketheman committed 4 years ago

README

The README file for this repository.

python-private-packages

An exercise exploring the behaviors of Python Packages and how to create private packages.

The approach is to take a simple task, and refactor it to an extreme

In reality, you likely would never do this specifically, but the exmaple is here to be explored for its structural benefits, not the task itself.

Requirements

To measure the success here, I set myself some guidelines:

  • The code has to be readily testable by pytest
  • The code has to pass pylint with no customiztion/overrides

Note: In most real-world scenarios, there's often some configuration for pylint, such as removing a requirement for test functions to have docstrings. Instead of trying to disable things, I've opted to not configure pylint, rather provide simple (if not very useful) docstrings to pass the linter. Please don't judge the content of these docstrings.

The App

Well, the ultimate goal of "my awesome app" is to return a "Hello, world." string.

Yes, that's it.

But instead of simply accomplishing the task like some normal person, let's refactor the task to a crazy degree, splitting pieces of work apart to explore import and test structure.

As a way to separate concerns, the myawesomeapp package is only responsible for the execution part - not the internals of how to construct and represent the desired outcome.

The rest of the phrase's work is delegated to the helloworld package, which could be an open source/installed package, or part of the same codebase.

By segregating the internals of what is essentially a subdirectory structure wth a naming convention, we create a boundary which can be broken, but convention shows the user the "right way".

After all, we are all responsible users.

Running

If you want to checkout the code, run the tests yourself, please do!

  1. Clone the repository locally
  2. Run make init to install the requisite dependencies
  3. Run make test to execute the tests

Run make uninstall to have pipenv remove the created virtualenv. We don't remove [pipenv][] itself, since it's an awesome tool, check it out.

Author