Giter VIP home page Giter VIP logo

pastedeploy's Introduction

This tool provides code to load WSGI applications and servers from URIs. These URIs can refer to Python eggs for INI-style configuration files. Paste Script provides commands to serve applications based on this configuration file.

The latest version is available on GitHub (or download a wheel or tarball from PyPI).

For the latest changes see the news file.

pastedeploy's People

Contributors

aconrad avatar agronholm avatar aodag avatar cdent avatar cjwatson avatar countergram avatar dependabot[bot] avatar digitalresistor avatar fmigneault avatar huanghao avatar ianb avatar lrowe avatar mmerickel avatar msabramo avatar onovy avatar stephenfin avatar stevepiercy avatar tipabu avatar tseaver avatar vstinner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pastedeploy's Issues

namespace_packages make tests fail

Bug Report

Describe the bug
With

namespace_packages=[‘paste’]

in setup() command in setup.py, tests fail, because the installation is done incorrectly. When this line is removed all tests pass.

To Reproduce
Steps to reproduce the behavior:

  1. build package, install it, run tests with pytest -v command.

Actual behavior
All tests error with traceback like:

[   35s] ___________________ ERROR collecting tests/test_basic_app.py ___________________
[   35s] ImportError while importing test module '/home/abuild/rpmbuild/BUILD/pastedeploy-2.1.0/tests/test_basic_app.py'.
[   35s] Hint: make sure your test modules/packages have valid Python names.
[   35s] Traceback:
[   35s] tests/test_basic_app.py:1: in <module>
[   35s]     from paste.deploy import loadapp
[   35s] E   ModuleNotFoundError: No module named 'paste.deploy'

Expected behavior
Tests pass

Additional context
complete build log

PyPI wheel missing license file

Get Support

To get help or technical support, see Get Support.

Bug Report

Please search the issue tracker for similar issues before submitting a new issue.

Describe the bug

A clear and concise description of the bug.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://pypi.org/project/PasteDeploy/#files
  2. Download PasteDeploy-2.1.1-py2.py3-none-any.whl
  3. Install it
  4. dist-info folder is missing license file

Expected behavior
License included in wheel package

Additional context
The license file is included in source release, but not in wheel on PyPI

RFE: Replace use of `pkg_resources` with `importlib.metadata`

See discussions:
astropy/astropy#11091
pypa/pip#7413
pypa/setuptools#3279

[tkloczko@devel-g2v pastedeploy-2.1.1]$ grep -r pkg_resources
docs/conf.py:import pkg_resources
docs/conf.py:version = pkg_resources.get_distribution('pastedeploy').version
paste/__init__.py:    import pkg_resources
paste/__init__.py:    pkg_resources.declare_namespace(__name__)
paste/__init__.py:    # don't prevent use of paste if pkg_resources isn't installed
paste/deploy/config.py:            import pkg_resources
paste/deploy/config.py:            pkg_resources.require('Paste')
paste/deploy/loadwsgi.py:import pkg_resources
paste/deploy/loadwsgi.py:    ep = pkg_resources.EntryPoint.parse("x=" + s)
paste/deploy/loadwsgi.py:                pkg_resources.require(spec)
paste/deploy/loadwsgi.py:            distribution=pkg_resources.get_distribution(self.spec),
paste/deploy/loadwsgi.py:                pkg_resources.require(self.spec)
paste/deploy/loadwsgi.py:                entry = pkg_resources.get_entry_info(
paste/deploy/loadwsgi.py:            dist = pkg_resources.get_distribution(self.spec)
paste/deploy/loadwsgi.py:                dictkeys(pkg_resources.get_entry_info(self.spec, prot, name) or {})
tests/__init__.py:import pkg_resources
tests/__init__.py:pkg_resources.require('PasteDeploy')
tests/fixture.py:from pkg_resources import *
tests/test_load_package.py:import pkg_resources
tests/test_load_package.py:    print_(pkg_resources.require('FakeApp'))

Version 3.0 is marked as Python 2 compatible but throws syntax errors

Issue

Installing pyramid==1.9.1 on a Python 2.7 environment also installs PasteDeploy-3.0 which doesn't seem to be compatible with Python 2.7.

Error

Traceback (most recent call last):
  File "/Users/user/.virtualenvs/myproject/bin/pserve", line 8, in <module>
    sys.exit(main())
  File "/Users/user/.virtualenvs/myproject/lib/python2.7/site-packages/pyramid/scripts/pserve.py", line 32, in main
    return command.run()
  File "/Users/user/.virtualenvs/myproject/lib/python2.7/site-packages/pyramid/scripts/pserve.py", line 167, in run
    loader = self._get_config_loader(config_uri)
  File "/Users/user/.virtualenvs/myproject/lib/python2.7/site-packages/pyramid/scripts/common.py", line 23, in get_config_loader
    return plaster.get_loader(config_uri, protocols=['wsgi'])
  File "/Users/user/.virtualenvs/myproject/lib/python2.7/site-packages/plaster/loaders.py", line 116, in get_loader
    loader = loader_info.load(config_uri)
  File "/Users/user/.virtualenvs/myproject/lib/python2.7/site-packages/plaster/loaders.py", line 204, in load
    return self.factory(config_uri)
  File "/Users/user/.virtualenvs/myproject/lib/python2.7/site-packages/plaster/loaders.py", line 199, in factory
    self._factory = self.entry_point.load()
  File "/Users/user/.virtualenvs/myproject/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2443, in load
    return self.resolve()
  File "/Users/user/.virtualenvs/myproject/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2449, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/Users/user/.virtualenvs/myproject/lib/python2.7/site-packages/plaster_pastedeploy/__init__.py", line 7, in <module>
    from paste.deploy import loadapp, loadserver, loadfilter, appconfig
  File "/Users/user/.virtualenvs/myproject/lib/python2.7/site-packages/paste/deploy/__init__.py", line 3, in <module>
    from paste.deploy.loadwsgi import *  # noqa F401,F403
  File "/Users/user/.virtualenvs/myproject/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 82
    args[0] = f'Error in file {parser.filename}: {e}'

Observation

The setup.cfg definition is missing the python_requires instruction.

README is out of date

The README is out of date with regard to the new hosting in the pylons organization and should be updated to reflect the current state of affairs.

Should ConfigParser be strict=False in Python 3?

In Python 2 I got into the habit of using the same .ini file for uwsgi and my Pyramid application. uwsgi normally uses duplicate keys, but Python 3's ConfigParser rejects duplicate keys unless passed strict=False. For example, this will work in Python 2 but fail in Python 3.

[uwsgi]
env=VARIABLE1=a
env=VARIABLE2=b

[app:main]
use = egg:bongo#whisky

Should it be easier to pass strict=False to the ConfigParser that eventually gets called from pyramid.paster.get_app()?

NiceConfigParser class lacking way to specify "strict=False" when using uwsgi .ini file with duplicated keys.

Since Python 3.2 and newer, the ConfigParser standard library now defaults to "strict=True" when processing .ini files.
This change does not allow duplicate key values in an .ini file.
This causes web applications that use uWSGI some headache, since some uWSGI features, like having multiple spooler directories be defined as duplicate keys in an .ini file. uWSGI has their own internal parser for .ini files (which is also very liberal in their idea of .ini "rules").

In looking at PasteDeploy's code, I can't find a way to "pass in" the needed "strict=False" argument to NiceConfigParser's constructor/init() function.

Steps to reproduce the behavior:

  • Create an .ini file with a duplicate key value in any section.

I'm mostly asking 2 questions:

  1. Is there a way to pass the needed argument to the NiceConfigParser init() function via the loadapp() function? (I'm not seeing how any extra keyword arguments would be funneled to that function)
  2. if not, then is are there suggestions on how to approach this? (e.g. I could monkey_patch the init() function in ConfigLoader in loadwsgi.py)

setup.py out of date

setup.py reports bad information with regard to supported python versions and location of the code

Publish a license

Does pastedeploy have a license? GitHub will automatically recognize a LICENSE.txt file.

RTD Configuration and branch management

We need a Webhook for RTD to automatically build the docs, now that "Integrations & services" is deprecated. I'll look into this.

The stable branch build failed. Stuff from latest on RTD (master on GitHub) needs backporting.

The latest branch succeeded.

@cdent I'm not sure how you manage branches. Now is a good time to set a policy and communicate that. We communicate that in the contributing.md file. Please let me know.

Add support for the Forwarded header in the prefix middleware

Some proxies are using the Forwarded HTTP header instead of the X-Forwarded-* headers.

For example, an OpenShift router would add only those headers:

Forwarded: for=?.?.?.?;host=myhost.example.com;proto=https;proto-version=h2
X-Forwarded-Port: 443
X-Forwarded-Proto-Version: h2

The header is described there: https://tools.ietf.org/html/rfc7239#section-4

It would be nice if the paste.deploy.config.PrefixMiddleware could support this header.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.