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

Move Documentation, Pretty class names and auto-deployment #46

Merged
merged 4 commits into from
Nov 14, 2017

Conversation

TagnumElite
Copy link
Member

@niftools/pyffi-reviewer

Overview

  1. Add GitHub Pages documentation deployment
  2. Move docs-sphinx to docs.
  3. Move pyffi*.rst to their respective folders
  4. Update README.rst and CONTRIBUTE.rst
  5. Add build_docs to setup.py
  6. Make PyFFI installable without sphinx
  7. Change setup.py classifiers to a list
  8. Add Missing Documentation Files
  9. Pretty class names of _MetaEnumBase, _MetaStuctBase and _MetaBitStuctBase
  10. Add Favicon/Logo to documenation
  11. Make _MetaEnumBase iterable and subscriptable
  12. Make _MetaEnumBase attributes snake case to be importable

Fixes Known Issues

None

Documentation

Add Sphinx Auto-Documentation:

  • EGT and ESP Formats
  • TGA and DDS Spells

Testing

Run command:

    cd docs
    make html
==or==
    python setup.py build_docs

Manual

You will need to set a github_token variable in your Travis project repository environment variables.

Automated

No tests were added or removed. No errors from py.test

Additional Information

The .travis.yml file will need to be updated to suite your repository needs.

- Move docs-sphinx to docs.
- Move pyffi*.rst to their respective folders
- Update README and CONTRIBUTE
- Add build_docs to setup.py
- Change setup.py classifiers to a list
- Add Missing Documentation Files
- Pretty class names of EnumBase, _MetaStuctBase and _MetaBitStuctBase
- Add Favicon to documenation
- Add githubpages deployment
- Make EnumBase iterable and subscriptable
- Make EnumBase attributes snake case to be importable
- Make pyffi installable without sphinx.
- .travis.yml missing a step to build documenation
- Add makeshift BuildDoc command
- Fix type `extras_require` in setup.py
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.01%) to 58.373% when pulling 80ae401 on TagnumElite:sphinx into 82083af on niftools:develop.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.01%) to 58.373% when pulling 80ae401 on TagnumElite:sphinx into 82083af on niftools:develop.

@coveralls
Copy link

coveralls commented Nov 9, 2017

Coverage Status

Coverage decreased (-0.01%) to 58.373% when pulling 80ae401 on TagnumElite:sphinx into 82083af on niftools:develop.

@neomonkeus
Copy link
Member

neomonkeus commented Nov 10, 2017

Going to take a look at this more in-depth today. Just took a quick peak at the coverage, bit surprised that there was a decrease. Can you take a look at whether this is needed any longer - https://coveralls.io/builds/14125327/source?filename=pyffi%2Futils%2F__init__.py#L47


on_rtd = os.getenv('READTHEDOCS') == 'True'

sys.path.insert(0, os.path.abspath('..'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os.path.dirname(os.path.abspath(file))

Copy link
Member

@psi29a psi29a Nov 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os.path.dirname(os.path.abspath(__file__))

otherwise github likes to eat _ to make things bold :/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also need to delete on_rtd = os.getenv('READTHEDOCS') == 'True' that was only for testing purposes

@neomonkeus
Copy link
Member

Solid work 👍 Will take a spin at it later.

@psi29a
Copy link
Member

psi29a commented Nov 10, 2017

Agreed! :)


class BuildDoc(Command):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would we not have this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That command class is only imported if python can't find sphinx so that pyffi can be installed without sphinx

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, probably meant to say when would occur? Presume your thinking is that failing to build docs should not fail the build.

From an automation perspective the danger here is that we don't get notified if something goes wrong. Should probably take the break it fix it approach. Especially if the intent is to upload them, we don't want to upload broken docs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can make it so that instead of print an message it raises an exception. I don’t really know how setup.py works too well so I thought that if the user doesn’t have Sphinx installed it will raise an exception when trying to install PyFFI because we import the Sphinx BuildDoc in the setup.py

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that could be a general problem from either perspective. If a user doesn't want to run docs, they shouldn't need it to install, we should localize scope.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats why I added this to the setup.py so that if people do want to run documentation that just have to pip install pyffi[docs] which will also add sphinx to the downloads.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, still alot more thoughts that I would like to run through with you, but I think at this stage probably best at this stage to take there discussions over on chat as it is cluttering the review. Happy enough to understand why this was done this way and definitely something I would like us to build on. Don't want to hold up the PR any further.

long_description=long_description,
url="https://github.com/niftools/pyffi",
download_url="https://github.com/niftools/pyffi/releases"
download_url="https://github.com/niftools/pyffi/releases",
cmdclass={'build_docs': BuildDoc},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we not alias this in setup.cfg

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could in fact move a lot of things inside setup.py into setup.cfg to clean up the setup.py script.
classifiers, packages, package_data and scripts can be put into setup.cfg to save on many lines

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually was more about creating an actual alias for python setup.py docs. Not sure of what the standard operations/conventions are for setup.py.

@psi29a You're probably more in tune with this as you mapped the test operation to abstact away what underlying test framework we actually use -
https://github.com/TagnumElite/pyffi/blob/80ae40191766622795d36384fac66c020ac00719/.travis.yml#L26

Also we should also consider moving the coverage stuff to setup.cfg as per the discussion around but out of scope of current

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no problem pushing more things out to setup.cfg, I had no idea the cmdclass trick existed so colour me impressed. You're right, we shouldn't require sphinx in order to use pyffi.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I was just wondering if there were certain standard command, eg in java land you have maven which has compile, test, install etc. was wondering if there were was similiar in setup.py. Probably should apply some google-fu at this point.

@TagnumElite
Copy link
Member Author

TagnumElite commented Nov 10, 2017

@neomonkeus This is because I added a not so well documented BuildDoc command class that is used when sphinx is not installed. This stops python setup.py build_docs/install from throwing errors which could cause appveyor and/or travis from failing if they ever happen to fail to install sphinx. Plus users shouldn't need to install sphinx to use PyFFI

@@ -84,7 +84,43 @@ def __init__(cls, name, bases, dct):

# set enum values as class attributes
for item, value in zip(cls._enumkeys, cls._enumvalues):
setattr(cls, item, value)
setattr(cls, "".join(snakeCase.name_parts(item)), value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed this on the first run. Eh, not nice, Wonder if we should split out the functionality as it looks to be static rather than class-methody.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sphinx imports and runs the code to document it. With nif.xml L994 - L1012, the names have spaces in them, with the current code it sets NifFormat.BSLighingShaderPropertyShaderType.Environment Map which can't be imported by normal python code, this fixes it and doesn't break any existing code

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean how we could the class generation to the names. They should be static methods.

Copy link
Member

@psi29a psi29a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. :)

@neomonkeus neomonkeus merged commit 7f61cc2 into niftools:develop Nov 14, 2017
@psi29a
Copy link
Member

psi29a commented Nov 14, 2017

It is done!

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

Successfully merging this pull request may close these issues.

None yet

4 participants