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

Remove global variables #140

Merged
merged 6 commits into from Nov 25, 2019

Conversation

AtomsForPeace
Copy link
Contributor

An attempt to remove the global variables #117.

Any feedback or ideas?

I've been able to remove one pytest.mark.skip with these changes.

@codecov-io
Copy link

codecov-io commented Oct 24, 2019

Codecov Report

Merging #140 into master will increase coverage by 0.07%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #140      +/-   ##
==========================================
+ Coverage   95.15%   95.22%   +0.07%     
==========================================
  Files           4        5       +1     
  Lines         454      461       +7     
  Branches       96       94       -2     
==========================================
+ Hits          432      439       +7     
  Misses          7        7              
  Partials       15       15
Impacted Files Coverage Δ
sanic_openapi/spec.py 100% <100%> (ø)
sanic_openapi/swagger.py 94.69% <100%> (-0.4%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2e729e9...16f6096. Read the comment docs.

@chenjr0719
Copy link
Member

Hi @AtomsForPeace

Thanks for your contribution. I think this PR fixes the swagger._spec global variable very well. And, do you have any plans to fix other global variables? Should I approve and merge this PR first or waiting for other global variable fixes?

@AtomsForPeace
Copy link
Contributor Author

@chenjr0719 Thanks. I think merging this now would be good. I've had a look at the other global variables and they're not as easy. I was thinking maybe doing something along the lines of this: https://flask.palletsprojects.com/en/1.1.x/patterns/appfactories/#factories-extensions

The issue would be backwards compatibility though.

What's your opinion on it?

@chenjr0719 chenjr0719 merged commit 3cdf880 into sanic-org:master Nov 25, 2019
@chenjr0719
Copy link
Member

@AtomsForPeace Sorry for the delay. I agree with using the factory pattern to fix all global variables. And about backward compatibility, I would say maybe we can have a PoC first and this might help us to decide what is the better way to keep the compatibility.

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.

None yet

3 participants