Comments (7)
I don't really care to be honest. I've been merging almost every pull request, so go nuts.
from python-github-backup.
Go for it. Honestly, I more or less merge anything that doesn't break functionality I use, so if you think this is a good move, thats fine by me.
from python-github-backup.
Doesn't seem like this is going to happen, but PRs welcome :)
from python-github-backup.
I apologize for bumping a dead issue, but thought I could mention a workaround I put together until a PR gets made addressing this.
I used some importlib
magic in my code to expose the github_backup library functions.
This has only been used in an Ubuntu 18.04 & lambda environment, and has not been tested with other operating systems or flavors.
This exact code may not work, as I had to exclude most of the content, and only copied what I recall as being relevant.
You should not use this in production. Just sayin'.
import os
import sys
from importlib.util import spec_from_loader, module_from_spec
from importlib.machinery import SourceFileLoader
try:
# "normal" pycharm development
import github_backup
except ModuleNotFoundError:
# docker/lambda development
# `package` is in the path because that's what I named the directory for my lambda package...
import package.github_backup as github_backup
init_path = github_backup.__file__
if "/lib" in init_path:
init_ancestor = init_path.split('/lib', maxsplit=1)[0]
else:
init_ancestor = init_path.split('/github_backup', maxsplit=1)[0]
desired_path = os.sep.join([init_ancestor, 'bin', 'github-backup'])
zspec = spec_from_loader("github_backup", SourceFileLoader("github_backup", desired_path))
zmodule = module_from_spec(zspec)
zspec.loader.exec_module(zmodule)
sys.modules["github_backup"] = zmodule
github_backup = zmodule
You can then pump arguments into sys.argv before calling github_backup.main(), though I did it before this oddball loading business.
EDIT:
I should add that this isn't everything required to make it work in lambda. I also had to change the way github_backup imports __version__ from "itself" to used the import path package.github_backup
.
from python-github-backup.
@josegonzalez Is there a particular reason for structuring the module such that the actual code resides in bin/github-backup
while the module's init file resides in github_backup/__init__.py
?
What was the motivation for putting the code in the bin
directory?
from python-github-backup.
None, other than it was a very small binary before and I didn't see a need to put it into the namespace.
from python-github-backup.
@josegonzalez are there any functions you wouldn't want exposed when the library gets imported?
from python-github-backup.
Related Issues (20)
- Feature request: read personal access token (PAT) from stdin HOT 1
- The release script is broken HOT 1
- Personal Access Token (PAT) - Which scopes are need to backup an organiziation? HOT 1
- Add a --quiet option HOT 1
- Download watchers, forks, and stargazers of a repo
- A way to include the actual commits of backupped PRs?
- Add option to disable --prune when updating repository
- how to correctly update local backup? HOT 7
- Backup images and attachments in the issues
- Github-backup in 140 repository org backups nothing HOT 3
- Exclude specific repositories from backup HOT 1
- Add support for fine-grained tokens HOT 2
- Proposal to use API repository `pushed_at` instead of `update_at` field for `last_updated`
- something awry in --releases HOT 1
- When the `--lfs` option is used, after first clone non-lfs content is no longer fetched HOT 1
- Feature: offer docs how to run in docker HOT 4
- ERROR: 'gaierror' object is not iterable
- Automate releases HOT 5
- `--all-starred` does not backup anything HOT 7
- Backing up releases using fine-grained token ends with an error HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-github-backup.