Equivalent of `python setup.py develop` in poetry - setuptools

With setuptools, I could use python3 setup.py develop and my development directory could be found by python3 without setting PYTHONPATH or running install. Any change in the current development directory is immediately available without running python3 setup.py develop/install again. This saves quite a lot of time during the development.
Is there a poetry equivalent?
Update There is a feature request https://github.com/python-poetry/poetry/issues/1214

In poetry, the main project is installed as editable by default:
The current project is installed in editable mode by default.
-- Section "Installing dependencies only" of Poetry's documentation
It is also possible to install some dependencies as editable alongside the main project in the same virtual environment. For example:
[tool.poetry.dependencies]
Library = { path = "../Library/", develop = true }

Related

Anaconda not launching

Whenever I try to run Anaconda Navigator (or Spyder), either from cmd or from windows, it does not launch. My mousepointer briefly shows that it is loading, but then nothing happens.
I have tried a number of solutions from other posts, but nothing worked:
I have completely uninstalled and reinstalled Anaconda
I have tried conda update -n root conda + conda update --all
I have tried conda clean --packages && conda clean --all && conda update --all
I have tried anaconda-navigator --reset
and a few more things.
My issue looks as follows:
Not a solution by itself, but: PyQt5 is bundled with Anaconda by default, so you shouldn't need to install it (again). In order to verify the presence of PyQt5:
a) execute conda list in the base environment and search for the package pyqt.
b) launch Spyder in the base environment and execute the following code:
from PyQt5.QtWidgets import QApplication, QLabel
app = QApplication([])
label = QLabel("Hello World!")
label.show()
app.exec_()
This should open an application window with the text "Hello World!".
Both would indicate, that PyQt5 is installed, and that the problem lies elsewhere.
Credit goes to JKSH for his answer to ImportError: DLL load failed while importing QtCore: The specified module could not be found.

vscode tests discovery with poetry (src layout)

Last time I've followed recommended src layout (https://hynek.me/articles/testing-packaging/) with using tox with great success.
However VSCODE tests discovery fails because src package cannot be imported. That is expected as we want to test installed package.
But how to debug my tests in vscode?
(Q author here: I've done research on that before posting the question, so sharing what I found)
Not solution
You could modify your PYTHONPATH to point to your src directory, but it breaks the main benefit from having separate src directory (read the link from OP).
Solution
Use pip install -e path/to/your/package (usually pip install -e .) to enable development mode and test versus your codebase as it would be installed.
After that your tests should be discovered properly. Otherwise it is different issue - read vs code OUTPUT console.
Note: this requires setup.py as a build backend
workaround for poetry
pyproject.toml
[build-system]
requires = [
"poetry-core>=1.0.0",
"setuptools" # to support local installations
]
then
poetry build --format sdist && tar --wildcards -xvf dist/*.tar.gz -O '*/setup.py' > setup.py
pip install -e .
Source: https://github.com/python-poetry/poetry/issues/34
TLDR: proper solution is outside of poetry scope, links to python-list discussions: https://github.com/python-poetry/poetry/issues/34#issuecomment-732478605

Migration from wxWidgets 3.1.3 to wxWidgets 2.8.12 - wx-config isn't generated

I am using centOS 8 and trying to install pgAgent in version 3.4.0 on my server.
What I have done so far:
Successfully installed cmake, cpack, ctest, wxWidgets-3.1.3, wxGTK-2.8.12.
Uninstalled wxWidgets-3.1.3 by using 'make uninstall' after applying 'make install'.
Deleted wx-config, wxrc, wxrc-3.1 from /usr/local/bin/.
Installed wxWidgets-2.8.12 by using 'make install', and 'sudo ldconfig' has been applied.
Current status:
pgAgent cannot be installed and returns "No wxWidgets installation could be found."
wxWidgets-2.8.12 cannot be installed with cmake as it is "not in CMakeLists.txt".
"wx-config --version" is not found and the file wx-config is not created when wxWidgets-2.8.12 is installed. (This is also true before the deletion of wx-config, as the old config for version 3.1.3 remains and no 2.9 config file appears during installation.
Desired result: Get pgAgent installed.
PS. Some website suggests me to "completely uninstall" the old wxWidgets and then install the new one, which I don't understand how to achieve that. (The official website said I should uninstall it in the way I install it, which does not modify wx-config.)

vscode assistance with building cpptools needed

Ubuntu 18.04 ARM64
I have download and built vscode and this appears to be working.
I can see the extension market place and install extensions. The C/C++ IntelliSense, debugging, and code browsing install but gets a dependency install failure sometimes:
Updating C/C++ dependencies...
Downloading package 'Mono Framework Assemblies' (5368 KB) Done!
Installing package 'Mono Framework Assemblies'
Failed at stage: installPackages
Error: end of central directory record signature not found
It seems to succeed on the second attempt but I'm not convinced.
So I have cloned vscode-cpptools and would like to built it myself but I'm not sure what dependencies it has or how to build it correctly.
Any tips appreciated!
So following the build and debug guide at:
$ git clone -b release https://github.com/Microsoft/vscode-cpptools
$ cd vscode-cpptools/Extension
$ npm install ! should install all dependencies but it forgets gulp
$ npm install gulp ! Manually install. I wonder what else it forgets
$ vsce package ! Should trigger the build and make the vsix package.
So the package is created and when I try and install it via the vscode extensions I get
Unable to start the C/C++ language server. IntelliSense features will be disabled. Error: Missing binary at ~/.vscode-oss-dev/extensions/ms-vscode.cpptools-0.22.1/bin/Microsoft.VSCode.CPP.Extension.linux.
Me thinks there are a lot of other dependencies that are missing!!!
Looking in the Extension bin folder and two important binaries are missing:
Microsoft.VSCode.CPP.Extension.linux
Microsoft.VSCode.CPP.IntelliSense.Msvc.linux
I also tried this on Intel Ubuntu 18.04 and while the Intel build appeared to do a whole lot more it also fails to build the binaries.
Found the answer in here : github.com/Microsoft/vscode-cpptools/issues/429 which indicates there is no support for Aaarch64 Arm64 at this point in time.

How can I make a list of installed packages in a certain virtualenv?

You can cd to YOUR_ENV/lib/pythonxx/site-packages/ and have a look, but is there any convenient ways?
pip freeze list all the packages installed including the system environment's.
You can list only packages in the virtualenv by
pip freeze --local
or
pip list --local.
This option works irrespective of whether you have global site packages visible in the virtualenv.
Note that restricting the virtualenv to not use global site packages isn't the answer to the problem, because the question is on how to separate the two lists, not how to constrain our workflow to fit limitations of tools.
Credits to #gvalkov's comment here. Cf. also pip issue 85.
Calling pip command inside a virtualenv should list the packages visible/available in the isolated environment. Make sure to use a recent version of virtualenv that uses option --no-site-packages by default. This way the purpose of using virtualenv is to create a python environment without access to packages installed in system python.
Next, make sure you use pip command provided inside the virtualenv (YOUR_ENV/bin/pip). Or just activate the virtualenv (source YOUR_ENV/bin/activate) as a convenient way to call the proper commands for python interpreter or pip
~/Projects$ virtualenv --version
1.9.1
~/Projects$ virtualenv -p /usr/bin/python2.7 demoenv2.7
Running virtualenv with interpreter /usr/bin/python2.7
New python executable in demoenv2.7/bin/python2.7
Also creating executable in demoenv2.7/bin/python
Installing setuptools............................done.
Installing pip...............done.
~/Projects$ cd demoenv2.7/
~/Projects/demoenv2.7$ bin/pip freeze
wsgiref==0.1.2
~/Projects/demoenv2.7$ bin/pip install commandlineapp
Downloading/unpacking commandlineapp
Downloading CommandLineApp-3.0.7.tar.gz (142kB): 142kB downloaded
Running setup.py egg_info for package commandlineapp
Installing collected packages: commandlineapp
Running setup.py install for commandlineapp
Successfully installed commandlineapp
Cleaning up...
~/Projects/demoenv2.7$ bin/pip freeze
CommandLineApp==3.0.7
wsgiref==0.1.2
What's strange in my answer is that package 'wsgiref' is visible inside the virtualenv. Its from my system python. Currently I do not know why, but maybe it is different on your system.
In Python3
pip list
Empty venv is
Package Version
---------- -------
pip 19.2.3
setuptools 41.2.0
To create a new environment
python3 -m venv your_foldername_here
Activate
cd your_foldername_here
source bin/activate
Deactivate
deactivate
You can also stand in the folder and give the virtual environment a name/folder (python3 -m venv name_of_venv).
Venv is a subset of virtualenv that is shipped with Python after 3.3.
list out the installed packages in the virtualenv
step 1:
workon envname
step 2:
pip freeze
it will display the all installed packages and installed packages and versions
If you're still a bit confused about virtualenv you might not pick up how to combine the great tips from the answers by Ioannis and Sascha. I.e. this is the basic command you need:
/YOUR_ENV/bin/pip freeze --local
That can be easily used elsewhere. E.g. here is a convenient and complete answer, suited for getting all the local packages installed in all the environments you set up via virtualenvwrapper:
cd ${WORKON_HOME:-~/.virtualenvs}
for dir in *; do [ -d $dir ] && $dir/bin/pip freeze --local > /tmp/$dir.fl; done
more /tmp/*.fl
why don't you try pip list
Remember I'm using pip version 19.1 on python version 3.7.3
If you are using pip 19.0.3 and python 3.7.4. Then go for pip list command in your virtualenv. It will show all the installed packages with respective versions.
.venv/bin/pip freeze worked for me in bash.
In my case the flask version was only visible under so I had to go to
C:\Users\\AppData\Local\flask\venv\Scripts>pip freeze --local
Using python3 executable only, from:
Gitbash:
winpty my_venv_dir/bin/python -m pip freeze
Linux:
my_venv_dir/bin/python -m pip freeze