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

Add developer mode #111

Closed
wants to merge 2 commits into from
Closed

Add developer mode #111

wants to merge 2 commits into from

Conversation

jedie
Copy link
Contributor

@jedie jedie commented Mar 18, 2018

#73

@jedie
Copy link
Contributor Author

jedie commented Mar 18, 2018

I made a POC with ugly code to get the "pip freeze" line, here: 2596892

But this will not work for 'toga', e.g.:

run-calculator$ ./setup.py linux 
running linux

 * Updating user code...
 * Installing requirements...
No requirements.
 * Installing platform requirements...
Install 'toga-gtk' to: '/home/jens/repos/RunCalculator-Env/src/run-calculator/linux/app_packages'
Obtaining toga_gtk from git+https://github.com/pybee/toga.git@02a47d27d32d16b54800b658d9afd2b316924fd1#egg=toga_gtk&subdirectory=src/gtk
  Skipping because already up-to-date.
Collecting toga-core==0.3.0.dev8 (from toga_gtk)
  Could not find a version that satisfies the requirement toga-core==0.3.0.dev8 (from toga_gtk) (from versions: 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.2.5, 0.2.6, 0.2.7, 0.2.8, 0.2.9, 0.2.10, 0.2.11, 0.2.12, 0.2.13, 0.2.14, 0.2.15, 0.3.0.dev1, 0.3.0.dev2, 0.3.0.dev3, 0.3.0.dev4, 0.3.0.dev5, 0.3.0.dev6, 0.3.0.dev7)
No matching distribution found for toga-core==0.3.0.dev8 (from toga_gtk)
 * Installing project code...
Processing /home/jens/repos/RunCalculator-Env/src/run-calculator
Installing collected packages: run-calculator
  Running setup.py install for run-calculator ... done
Successfully installed run-calculator-0.0.1
 * No icons defined - using default...
 * No splash screen defined...

Installation complete.

The Problem here is, that toga by himself will automatically installed platform backends and used "hardcoded" package name with version...

I see two way to handle that:

1.) Add a extra handling for "toga" in install_*_requirements()
2.) remove all version requirements from toga's setup.py files

I would prefer 2. Until 2 has been made, i try to implement 1 ;)

@jedie jedie mentioned this pull request Mar 18, 2018
@jedie
Copy link
Contributor Author

jedie commented Mar 18, 2018

With 02209e9 i tried to implement 1: extra handling for "toga" in install_*_requirements()

But this will fail, see output here: https://gist.github.com/jedie/62f7e41e7f9c462b25aa856705bf8db6

I don't see this approach succeeding...

@freakboy3742
Copy link
Member

The catch is - if you remove the version number requirement, you'll end up installing toga-cocoa 0.3.0.dev8, and toga-core 0.3.0.dev7 - which can lead to some hilarious results.

The best approach I can think of is to look to the virtual environment in which briefcase is running. If the user specifies the --dev flag to briefcase, briefcase will install the same version that is in the virtual environment, regardless of what is specified in the setup.py file.

In the case of toga-django, that means the install step is a no-op if --dev is defined.

@jedie
Copy link
Contributor Author

jedie commented Mar 18, 2018

The best approach I can think of is to look to the virtual environment in which briefcase is running. If the user specifies the --dev flag to briefcase, briefcase will install the same version that is in the virtual environment, regardless of what is specified in the setup.py file.

But why we need the "--dev" flag? Why no always install same version that is in the virtual environment?

I try to install the packages from current environment... But raise into this error:

Installing platform requirements...
install --no-deps --force-reinstall --build=/home/jens/repos/RunCalculator-Env/src/run-calculator/linux/app_packages --target=/home/jens/repos/RunCalculator-Env/src/run-calculator/linux/app_packages --editable=git+https://github.com/jedie/toga.git@7d5882d912352d1259aa93cac7ae7aca6bd507e8#egg=toga --editable=git+https://github.com/jedie/toga.git@7d5882d912352d1259aa93cac7ae7aca6bd507e8#egg=toga_core&subdirectory=src/core --editable=git+https://github.com/jedie/toga.git@7d5882d912352d1259aa93cac7ae7aca6bd507e8#egg=toga_django&subdirectory=src/django --editable=git+https://github.com/jedie/toga.git@7d5882d912352d1259aa93cac7ae7aca6bd507e8#egg=toga_dummy&subdirectory=src/dummy --editable=git+https://github.com/jedie/toga.git@7d5882d912352d1259aa93cac7ae7aca6bd507e8#egg=toga_gtk&subdirectory=src/gtk
Obtaining toga from git+https://github.com/jedie/toga.git@7d5882d912352d1259aa93cac7ae7aca6bd507e8#egg=toga
  Skipping because already up-to-date.
Obtaining toga_core from git+https://github.com/jedie/toga.git@7d5882d912352d1259aa93cac7ae7aca6bd507e8#egg=toga_core&subdirectory=src/core
  Cloning https://github.com/jedie/toga.git (to 7d5882d912352d1259aa93cac7ae7aca6bd507e8) to /home/jens/repos/RunCalculator-Env/src/toga-core
  Could not find a tag or branch '7d5882d912352d1259aa93cac7ae7aca6bd507e8', assuming commit.
Obtaining toga_django from git+https://github.com/jedie/toga.git@7d5882d912352d1259aa93cac7ae7aca6bd507e8#egg=toga_django&subdirectory=src/django
  Cloning https://github.com/jedie/toga.git (to 7d5882d912352d1259aa93cac7ae7aca6bd507e8) to /home/jens/repos/RunCalculator-Env/src/toga-django
  Could not find a tag or branch '7d5882d912352d1259aa93cac7ae7aca6bd507e8', assuming commit.
Obtaining toga_dummy from git+https://github.com/jedie/toga.git@7d5882d912352d1259aa93cac7ae7aca6bd507e8#egg=toga_dummy&subdirectory=src/dummy
  Cloning https://github.com/jedie/toga.git (to 7d5882d912352d1259aa93cac7ae7aca6bd507e8) to /home/jens/repos/RunCalculator-Env/src/toga-dummy
  Could not find a tag or branch '7d5882d912352d1259aa93cac7ae7aca6bd507e8', assuming commit.
Obtaining toga_gtk from git+https://github.com/jedie/toga.git@7d5882d912352d1259aa93cac7ae7aca6bd507e8#egg=toga_gtk&subdirectory=src/gtk
  Cloning https://github.com/jedie/toga.git (to 7d5882d912352d1259aa93cac7ae7aca6bd507e8) to /home/jens/repos/RunCalculator-Env/src/toga-gtk
  Could not find a tag or branch '7d5882d912352d1259aa93cac7ae7aca6bd507e8', assuming commit.
Installing collected packages: toga, toga-core, toga-django, toga-dummy, toga-gtk
  Found existing installation: toga 0.3.0.dev8
    Uninstalling toga-0.3.0.dev8:
      Successfully uninstalled toga-0.3.0.dev8
  Running setup.py develop for toga
    Complete output from command /home/jens/repos/RunCalculator-Env/bin/python -c "import setuptools, tokenize;__file__='/home/jens/repos/RunCalculator-Env/src/toga/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" develop --no-deps --home=/tmp/tmpvxef9y3h:
    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: -c --help [cmd1 cmd2 ...]
       or: -c --help-commands
       or: -c cmd --help
    
    error: option --home not recognized

btw.: IMHO briefcase should not have version string in setup.py, but requirements.txt created with pip-compile ... Maybe one requirements.txt for one platform target...

EDIT: error: option --home not recognized -> pypa/pip#4390

@jedie
Copy link
Contributor Author

jedie commented Mar 18, 2018

Another approach would be:

  • run a own, local package repository
  • publish all pybee packages from current environment to it
  • run "setup.py" "against" the local package repository

But the prefered way to run a local Warehouse is to use docker, see: https://github.com/pypa/warehouse#getting-started

@freakboy3742
Copy link
Member

A developer mode has been added in the v0.3 branch. Thanks for the contribution - sorry we weren't able to get this merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants