Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get rid of library root mark in PyCharm

I've started working on a Pyramid application, which requires setup.py usage, but as soon as I built the app, my app folder was marked as library root.

It is not convenient, because when I open a file, it is also opened under External Libraries unfolding it. This can be "fixed" by removing check on Always Select Opened File, but I like this feature, so I don't want to disable it.

I've also tried to tweak Project Structure in settings, but it didn't help.

How to get rid of this _library_root_ mark?

example

UPD. Contents of setup.py:

setup(
    name='app',
    version=0.1,
    description='Blog with CMS',
    classifiers=[
      "Programming Language :: Python",
      "Framework :: Pylons",
      "Topic :: Internet :: WWW/HTTP",
      "Topic :: Internet :: WWW/HTTP :: WSGI :: Application"
    ],
    keywords="web services",
    author='',
    author_email='',
    url='',
    packages=find_packages(),
    include_package_data=True,
    zip_safe=False,
    install_requires=['cornice', 'waitress'],
    entry_points="""\
    [paste.app_factory]
    main=app:main
    """,
    paster_plugins=['pyramid']
)
like image 892
stasdeep Avatar asked Dec 11 '19 14:12

stasdeep


People also ask

What is Library root in PyCharm?

Content root types A content root is a folder that contains the files that make up your project. Source roots (or source folders; shown as ). These roots contain the actual source files and resources. PyCharm uses the source roots as the starting point for resolving imports.

How do I change the root directory in PyCharm?

Open the Project Structure settings. In the Projects pane of the Project Structure page, click the project you want to configure content roots for. In the dialog that opens, locate the desired directory and click OK.

How do I change PyCharm save location?

Change the location of IDE directories From the main menu, select Help | Edit Custom Properties. Specify paths with forward slashes /, including Windows paths (for example, C:/idea/system). After you restart PyCharm, it will use the new location of the corresponding directory.

Where is library in PyCharm?

Open File > Settings > Project from the PyCharm menu. Select your current project. Click the Python Interpreter tab within your project tab. Click the small + symbol to add a new library to the project.


1 Answers

The reason why it happens is PyCharm adds sd-blog/app to the interpreter paths once you pip install -e in order to be able to provide completion for app objects. Possible workaround:

  1. remove app from the interpreter paths

  2. mark sd-blog/app as a source root to restore the code insight broken in the step 1

like image 159
Pavel Karateev Avatar answered Oct 04 '22 17:10

Pavel Karateev