Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsafe class discovery #28

Merged
merged 8 commits into from May 23, 2019
Merged

Unsafe class discovery #28

merged 8 commits into from May 23, 2019

Conversation

matyama
Copy link
Contributor

@matyama matyama commented May 12, 2019

Description

  • Adds package unsafe for impure code
  • Adds module reflection with functions for discovery of all implementations of a class

Test plan

Passing release check and tested in other project from which is the code being migrated.

@matyama matyama added the enhancement New feature or request label May 12, 2019
@matyama matyama self-assigned this May 12, 2019
@matyama
Copy link
Contributor Author

matyama commented May 12, 2019

Question: Does this code belong to ftoolz?
Answer: Perhaps not, but I don't really want to start and manage new repo for this kind of stuff 🙈

ftoolz/unsafe/reflection.py Show resolved Hide resolved
ftoolz/unsafe/reflection.py Outdated Show resolved Hide resolved
tm-drtina
tm-drtina previously approved these changes May 12, 2019
martinbabka
martinbabka previously approved these changes May 13, 2019
Copy link
Contributor

@martinbabka martinbabka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for pkgutil requirement, looks perfect.

ftoolz/unsafe/reflection.py Show resolved Hide resolved
@matyama
Copy link
Contributor Author

matyama commented May 13, 2019

Just found out that there are some issues with the import, I'll investigate but lets postpone merging this one :(

@matyama matyama changed the base branch from pipenv-migration to master May 13, 2019 09:49
@matyama
Copy link
Contributor Author

matyama commented May 15, 2019

Added a fix which solves the import issues while keeping the discovery API (impementations()) the same.

The only difference is that I moved doctest to ordinary UTs because there were some issues with getting the doctest-defined classes from a module object - some doctest thing I guess.

@matyama matyama merged commit b1a330d into master May 23, 2019
@matyama matyama deleted the ftoolz-unsafe-class-discovery branch May 23, 2019 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants