Turning a personal Python project into a releasable library












23














I'm an academic rather than a programmer, and I have many years' experience writing Python programs for my own use, to support my research. My latest project is likely to be useful to many others as well as me, and I'm thinking of releasing it as an open-source Python library.



However, there seem to be quite some hurdles to cross in going from a functioning personal project to a library that can be installed and used painlessly by others. This question is about the first steps I should take in order to start working toward a public release.



Currently, I have a single git repository that contains my code that uses the library as well as the library itself, and I use git as an emergency undo button in case anything breaks. All of this works fine for a single user but is obviously not appropriate if I want to release it. Where I want to end up is that my library is in a separate repository and can be installed by others using pip, and has a stable API.



Learning to use setuptools etc. is probably not so hard once I'm at the point of wanting to publish it - my problem is in knowing how I should be working in order to get to that point.



So my question is, what are the first steps one should take in order to start preparing a Python library project for public consumption? How should I reorganise my directory structure, git repository etc. in order to start working towards public a release of the library?



More generally, it would be very helpful if there are resources that are known to be helpful when attempting this for the first time. Pointers toward best practices and mistakes to avoid, etc., would also be very helpful.



Some clarification: the current answers are addressing a question along the lines of "how can I make my Python library a good one for others to use?" This is useful, but it's different from the question I intended to ask.



I'm currently at the start of a long journey towards releasing my project. The core of my implementation works (and works really well), but I'm feeling overwhelmed by the amount of work ahead of me, and I'm looking for guidance on how to navigate the process. For example:




  • My library code is currently coupled to my own domain-specific code that uses it. It lives in a subfolder and shares the same git repository. Eventually, it will need to be made into a stand-alone library and put into its own repository, but I keep procrastinating this because I don't know how to do it. (Neither how to install a library in 'development mode' so that I can still edit it, nor how to keep the two git repos in sync.)


  • My docstrings are terse, because I know that eventually I will have to use Sphinx or some other tool. But these tools seem not to be simple to learn, so this becomes a major sub-project and I keep putting it off.


  • At some point I need to learn to use setuptools or some other tool to package it and track the dependencies, which are quite complex. I'm not sure whether I need to do this now or not, and the documentation is an absolute maze for a new user, so I keep deciding to do it later.


  • I've never had to do systematic testing, but I definitely will for this project, so I have to (i) learn enough about testing to know which methodology is right for my project; (ii) learn what tools are available for my chosen methodology; (iii) learn to use my chosen tool; (iv) implement test suites etc. for my project. This is a project in itself.


  • There may well be other things I have to do as well. For example, jonrsharpe posted a helpful link that mentions git-flow, tox, TravisCI, virtualenv and CookieCutter, none of which I'd heard of before. (The post is from 2013, so I also have to do some work to find out how much is still current.)



When you put this all together it's a huge amount of work, but I'm sure I can get it all done if I keep plugging away at it, and I'm not in a hurry. My problem is knowing how to break it down into manageable steps that can be done one at a time.



In other words, I'm asking which are the most important concrete steps I can take now, in order to reach a releasable product eventually. If I have a free weekend, which of these things should I focus on? Which (if any) can be done in isolation from the others, so that I can at least get one step done without needing to do the whole thing? What's the most efficient way to learn these things so that I will still have time to focus on the project itself? (Bearing in mind that all of this is essentially a hobby project, not my job.) Is there any of it that I don't actually need to do, thus saving myself a huge amount of time and effort?



All answers are greatly appreciated, but I would especially welcome answers that focus on these project management aspects, with specific reference to modern Python development.










share|improve this question









New contributor




Nathaniel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 2




    jeffknupp.com/blog/2013/08/16/…
    – jonrsharpe
    2 days ago






  • 8




    The best way to check if a library is ready for release "into the wild" is to ask a fellow researcher or a student to try to use it and to write down all the difficulties they run into. If they can use it without constantly having to call you for assistance, then the library is in a shape that it can be used by others.
    – Bart van Ingen Schenau
    2 days ago










  • @jonrsharpe thanks, there's a lot of super useful information there
    – Nathaniel
    2 days ago










  • @BartvanIngenSchenau thank you, I'll definitely bear that in mind once I'm close to that step. I'm very much at the "first steps" stage now, of taking something that works but is very far from ready for release, and wondering how I should be doing things now to make sure it can become releaseable in the future.
    – Nathaniel
    2 days ago






  • 1




    You should definitely make a stand-alone git repo for the library and then be your own first customer. Only use the library in your project as a proper library, not linking to its source.
    – Ian MacDonald
    2 days ago
















23














I'm an academic rather than a programmer, and I have many years' experience writing Python programs for my own use, to support my research. My latest project is likely to be useful to many others as well as me, and I'm thinking of releasing it as an open-source Python library.



However, there seem to be quite some hurdles to cross in going from a functioning personal project to a library that can be installed and used painlessly by others. This question is about the first steps I should take in order to start working toward a public release.



Currently, I have a single git repository that contains my code that uses the library as well as the library itself, and I use git as an emergency undo button in case anything breaks. All of this works fine for a single user but is obviously not appropriate if I want to release it. Where I want to end up is that my library is in a separate repository and can be installed by others using pip, and has a stable API.



Learning to use setuptools etc. is probably not so hard once I'm at the point of wanting to publish it - my problem is in knowing how I should be working in order to get to that point.



So my question is, what are the first steps one should take in order to start preparing a Python library project for public consumption? How should I reorganise my directory structure, git repository etc. in order to start working towards public a release of the library?



More generally, it would be very helpful if there are resources that are known to be helpful when attempting this for the first time. Pointers toward best practices and mistakes to avoid, etc., would also be very helpful.



Some clarification: the current answers are addressing a question along the lines of "how can I make my Python library a good one for others to use?" This is useful, but it's different from the question I intended to ask.



I'm currently at the start of a long journey towards releasing my project. The core of my implementation works (and works really well), but I'm feeling overwhelmed by the amount of work ahead of me, and I'm looking for guidance on how to navigate the process. For example:




  • My library code is currently coupled to my own domain-specific code that uses it. It lives in a subfolder and shares the same git repository. Eventually, it will need to be made into a stand-alone library and put into its own repository, but I keep procrastinating this because I don't know how to do it. (Neither how to install a library in 'development mode' so that I can still edit it, nor how to keep the two git repos in sync.)


  • My docstrings are terse, because I know that eventually I will have to use Sphinx or some other tool. But these tools seem not to be simple to learn, so this becomes a major sub-project and I keep putting it off.


  • At some point I need to learn to use setuptools or some other tool to package it and track the dependencies, which are quite complex. I'm not sure whether I need to do this now or not, and the documentation is an absolute maze for a new user, so I keep deciding to do it later.


  • I've never had to do systematic testing, but I definitely will for this project, so I have to (i) learn enough about testing to know which methodology is right for my project; (ii) learn what tools are available for my chosen methodology; (iii) learn to use my chosen tool; (iv) implement test suites etc. for my project. This is a project in itself.


  • There may well be other things I have to do as well. For example, jonrsharpe posted a helpful link that mentions git-flow, tox, TravisCI, virtualenv and CookieCutter, none of which I'd heard of before. (The post is from 2013, so I also have to do some work to find out how much is still current.)



When you put this all together it's a huge amount of work, but I'm sure I can get it all done if I keep plugging away at it, and I'm not in a hurry. My problem is knowing how to break it down into manageable steps that can be done one at a time.



In other words, I'm asking which are the most important concrete steps I can take now, in order to reach a releasable product eventually. If I have a free weekend, which of these things should I focus on? Which (if any) can be done in isolation from the others, so that I can at least get one step done without needing to do the whole thing? What's the most efficient way to learn these things so that I will still have time to focus on the project itself? (Bearing in mind that all of this is essentially a hobby project, not my job.) Is there any of it that I don't actually need to do, thus saving myself a huge amount of time and effort?



All answers are greatly appreciated, but I would especially welcome answers that focus on these project management aspects, with specific reference to modern Python development.










share|improve this question









New contributor




Nathaniel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 2




    jeffknupp.com/blog/2013/08/16/…
    – jonrsharpe
    2 days ago






  • 8




    The best way to check if a library is ready for release "into the wild" is to ask a fellow researcher or a student to try to use it and to write down all the difficulties they run into. If they can use it without constantly having to call you for assistance, then the library is in a shape that it can be used by others.
    – Bart van Ingen Schenau
    2 days ago










  • @jonrsharpe thanks, there's a lot of super useful information there
    – Nathaniel
    2 days ago










  • @BartvanIngenSchenau thank you, I'll definitely bear that in mind once I'm close to that step. I'm very much at the "first steps" stage now, of taking something that works but is very far from ready for release, and wondering how I should be doing things now to make sure it can become releaseable in the future.
    – Nathaniel
    2 days ago






  • 1




    You should definitely make a stand-alone git repo for the library and then be your own first customer. Only use the library in your project as a proper library, not linking to its source.
    – Ian MacDonald
    2 days ago














23












23








23


7





I'm an academic rather than a programmer, and I have many years' experience writing Python programs for my own use, to support my research. My latest project is likely to be useful to many others as well as me, and I'm thinking of releasing it as an open-source Python library.



However, there seem to be quite some hurdles to cross in going from a functioning personal project to a library that can be installed and used painlessly by others. This question is about the first steps I should take in order to start working toward a public release.



Currently, I have a single git repository that contains my code that uses the library as well as the library itself, and I use git as an emergency undo button in case anything breaks. All of this works fine for a single user but is obviously not appropriate if I want to release it. Where I want to end up is that my library is in a separate repository and can be installed by others using pip, and has a stable API.



Learning to use setuptools etc. is probably not so hard once I'm at the point of wanting to publish it - my problem is in knowing how I should be working in order to get to that point.



So my question is, what are the first steps one should take in order to start preparing a Python library project for public consumption? How should I reorganise my directory structure, git repository etc. in order to start working towards public a release of the library?



More generally, it would be very helpful if there are resources that are known to be helpful when attempting this for the first time. Pointers toward best practices and mistakes to avoid, etc., would also be very helpful.



Some clarification: the current answers are addressing a question along the lines of "how can I make my Python library a good one for others to use?" This is useful, but it's different from the question I intended to ask.



I'm currently at the start of a long journey towards releasing my project. The core of my implementation works (and works really well), but I'm feeling overwhelmed by the amount of work ahead of me, and I'm looking for guidance on how to navigate the process. For example:




  • My library code is currently coupled to my own domain-specific code that uses it. It lives in a subfolder and shares the same git repository. Eventually, it will need to be made into a stand-alone library and put into its own repository, but I keep procrastinating this because I don't know how to do it. (Neither how to install a library in 'development mode' so that I can still edit it, nor how to keep the two git repos in sync.)


  • My docstrings are terse, because I know that eventually I will have to use Sphinx or some other tool. But these tools seem not to be simple to learn, so this becomes a major sub-project and I keep putting it off.


  • At some point I need to learn to use setuptools or some other tool to package it and track the dependencies, which are quite complex. I'm not sure whether I need to do this now or not, and the documentation is an absolute maze for a new user, so I keep deciding to do it later.


  • I've never had to do systematic testing, but I definitely will for this project, so I have to (i) learn enough about testing to know which methodology is right for my project; (ii) learn what tools are available for my chosen methodology; (iii) learn to use my chosen tool; (iv) implement test suites etc. for my project. This is a project in itself.


  • There may well be other things I have to do as well. For example, jonrsharpe posted a helpful link that mentions git-flow, tox, TravisCI, virtualenv and CookieCutter, none of which I'd heard of before. (The post is from 2013, so I also have to do some work to find out how much is still current.)



When you put this all together it's a huge amount of work, but I'm sure I can get it all done if I keep plugging away at it, and I'm not in a hurry. My problem is knowing how to break it down into manageable steps that can be done one at a time.



In other words, I'm asking which are the most important concrete steps I can take now, in order to reach a releasable product eventually. If I have a free weekend, which of these things should I focus on? Which (if any) can be done in isolation from the others, so that I can at least get one step done without needing to do the whole thing? What's the most efficient way to learn these things so that I will still have time to focus on the project itself? (Bearing in mind that all of this is essentially a hobby project, not my job.) Is there any of it that I don't actually need to do, thus saving myself a huge amount of time and effort?



All answers are greatly appreciated, but I would especially welcome answers that focus on these project management aspects, with specific reference to modern Python development.










share|improve this question









New contributor




Nathaniel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I'm an academic rather than a programmer, and I have many years' experience writing Python programs for my own use, to support my research. My latest project is likely to be useful to many others as well as me, and I'm thinking of releasing it as an open-source Python library.



However, there seem to be quite some hurdles to cross in going from a functioning personal project to a library that can be installed and used painlessly by others. This question is about the first steps I should take in order to start working toward a public release.



Currently, I have a single git repository that contains my code that uses the library as well as the library itself, and I use git as an emergency undo button in case anything breaks. All of this works fine for a single user but is obviously not appropriate if I want to release it. Where I want to end up is that my library is in a separate repository and can be installed by others using pip, and has a stable API.



Learning to use setuptools etc. is probably not so hard once I'm at the point of wanting to publish it - my problem is in knowing how I should be working in order to get to that point.



So my question is, what are the first steps one should take in order to start preparing a Python library project for public consumption? How should I reorganise my directory structure, git repository etc. in order to start working towards public a release of the library?



More generally, it would be very helpful if there are resources that are known to be helpful when attempting this for the first time. Pointers toward best practices and mistakes to avoid, etc., would also be very helpful.



Some clarification: the current answers are addressing a question along the lines of "how can I make my Python library a good one for others to use?" This is useful, but it's different from the question I intended to ask.



I'm currently at the start of a long journey towards releasing my project. The core of my implementation works (and works really well), but I'm feeling overwhelmed by the amount of work ahead of me, and I'm looking for guidance on how to navigate the process. For example:




  • My library code is currently coupled to my own domain-specific code that uses it. It lives in a subfolder and shares the same git repository. Eventually, it will need to be made into a stand-alone library and put into its own repository, but I keep procrastinating this because I don't know how to do it. (Neither how to install a library in 'development mode' so that I can still edit it, nor how to keep the two git repos in sync.)


  • My docstrings are terse, because I know that eventually I will have to use Sphinx or some other tool. But these tools seem not to be simple to learn, so this becomes a major sub-project and I keep putting it off.


  • At some point I need to learn to use setuptools or some other tool to package it and track the dependencies, which are quite complex. I'm not sure whether I need to do this now or not, and the documentation is an absolute maze for a new user, so I keep deciding to do it later.


  • I've never had to do systematic testing, but I definitely will for this project, so I have to (i) learn enough about testing to know which methodology is right for my project; (ii) learn what tools are available for my chosen methodology; (iii) learn to use my chosen tool; (iv) implement test suites etc. for my project. This is a project in itself.


  • There may well be other things I have to do as well. For example, jonrsharpe posted a helpful link that mentions git-flow, tox, TravisCI, virtualenv and CookieCutter, none of which I'd heard of before. (The post is from 2013, so I also have to do some work to find out how much is still current.)



When you put this all together it's a huge amount of work, but I'm sure I can get it all done if I keep plugging away at it, and I'm not in a hurry. My problem is knowing how to break it down into manageable steps that can be done one at a time.



In other words, I'm asking which are the most important concrete steps I can take now, in order to reach a releasable product eventually. If I have a free weekend, which of these things should I focus on? Which (if any) can be done in isolation from the others, so that I can at least get one step done without needing to do the whole thing? What's the most efficient way to learn these things so that I will still have time to focus on the project itself? (Bearing in mind that all of this is essentially a hobby project, not my job.) Is there any of it that I don't actually need to do, thus saving myself a huge amount of time and effort?



All answers are greatly appreciated, but I would especially welcome answers that focus on these project management aspects, with specific reference to modern Python development.







python programming-practices development-process






share|improve this question









New contributor




Nathaniel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Nathaniel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 18 hours ago





















New contributor




Nathaniel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Dec 31 '18 at 5:53









Nathaniel

24518




24518




New contributor




Nathaniel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Nathaniel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Nathaniel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 2




    jeffknupp.com/blog/2013/08/16/…
    – jonrsharpe
    2 days ago






  • 8




    The best way to check if a library is ready for release "into the wild" is to ask a fellow researcher or a student to try to use it and to write down all the difficulties they run into. If they can use it without constantly having to call you for assistance, then the library is in a shape that it can be used by others.
    – Bart van Ingen Schenau
    2 days ago










  • @jonrsharpe thanks, there's a lot of super useful information there
    – Nathaniel
    2 days ago










  • @BartvanIngenSchenau thank you, I'll definitely bear that in mind once I'm close to that step. I'm very much at the "first steps" stage now, of taking something that works but is very far from ready for release, and wondering how I should be doing things now to make sure it can become releaseable in the future.
    – Nathaniel
    2 days ago






  • 1




    You should definitely make a stand-alone git repo for the library and then be your own first customer. Only use the library in your project as a proper library, not linking to its source.
    – Ian MacDonald
    2 days ago














  • 2




    jeffknupp.com/blog/2013/08/16/…
    – jonrsharpe
    2 days ago






  • 8




    The best way to check if a library is ready for release "into the wild" is to ask a fellow researcher or a student to try to use it and to write down all the difficulties they run into. If they can use it without constantly having to call you for assistance, then the library is in a shape that it can be used by others.
    – Bart van Ingen Schenau
    2 days ago










  • @jonrsharpe thanks, there's a lot of super useful information there
    – Nathaniel
    2 days ago










  • @BartvanIngenSchenau thank you, I'll definitely bear that in mind once I'm close to that step. I'm very much at the "first steps" stage now, of taking something that works but is very far from ready for release, and wondering how I should be doing things now to make sure it can become releaseable in the future.
    – Nathaniel
    2 days ago






  • 1




    You should definitely make a stand-alone git repo for the library and then be your own first customer. Only use the library in your project as a proper library, not linking to its source.
    – Ian MacDonald
    2 days ago








2




2




jeffknupp.com/blog/2013/08/16/…
– jonrsharpe
2 days ago




jeffknupp.com/blog/2013/08/16/…
– jonrsharpe
2 days ago




8




8




The best way to check if a library is ready for release "into the wild" is to ask a fellow researcher or a student to try to use it and to write down all the difficulties they run into. If they can use it without constantly having to call you for assistance, then the library is in a shape that it can be used by others.
– Bart van Ingen Schenau
2 days ago




The best way to check if a library is ready for release "into the wild" is to ask a fellow researcher or a student to try to use it and to write down all the difficulties they run into. If they can use it without constantly having to call you for assistance, then the library is in a shape that it can be used by others.
– Bart van Ingen Schenau
2 days ago












@jonrsharpe thanks, there's a lot of super useful information there
– Nathaniel
2 days ago




@jonrsharpe thanks, there's a lot of super useful information there
– Nathaniel
2 days ago












@BartvanIngenSchenau thank you, I'll definitely bear that in mind once I'm close to that step. I'm very much at the "first steps" stage now, of taking something that works but is very far from ready for release, and wondering how I should be doing things now to make sure it can become releaseable in the future.
– Nathaniel
2 days ago




@BartvanIngenSchenau thank you, I'll definitely bear that in mind once I'm close to that step. I'm very much at the "first steps" stage now, of taking something that works but is very far from ready for release, and wondering how I should be doing things now to make sure it can become releaseable in the future.
– Nathaniel
2 days ago




1




1




You should definitely make a stand-alone git repo for the library and then be your own first customer. Only use the library in your project as a proper library, not linking to its source.
– Ian MacDonald
2 days ago




You should definitely make a stand-alone git repo for the library and then be your own first customer. Only use the library in your project as a proper library, not linking to its source.
– Ian MacDonald
2 days ago










2 Answers
2






active

oldest

votes


















22














Adding a setup.py, while necessary, is not the most important step if you want your library to be used. More importantly is to add documentation and advertise your library. Since the second point strongly depends on the library, let me rather focus the documentation aspect.




  1. You know everything about your library. And this is problematic. You already know how to install and how to use it, so many things may seem intuitive or plainly obvious to you. Unfortunately, the same things may be neither obvious, not intuitive for the users. Try to look at your library as if you knew nothing about it, and more importantly, ask other people to use it and try to spot all the difficulties they had.


  2. Explain, in plain English, what is your library about. Too many libraries assume that everybody knows about them. When this is not the case, it may be difficult to grasp what is the purpose of the library.


  3. Write detailed technical documentation, but also don't forget about short pieces of code which show how to do some of the tasks with your library. Most developers are in a hurry, and if they need to spend hours trying to understand how to do a basic thing, they may tend to switch to other libraries.


  4. Include your contact information. If your library is a success (and my own experience have shown that this is the case even for rather unknown ones as well), people would encounter difficulties with it: either bugs or simply difficulties understanding or using some parts of it. It is often useful to receive their feedback to improve your library: for every person who reported a problem, there are possibly hundreds who, when encountering it, would just prefer to switch to another library.



Additionally to that:




  1. Make it clear if your library works with Python 2 or 3 or both.


  2. If the library doesn't work on Windows, say so.


  3. Ensure you use official conventions (use pep8 to check). If not, either explain it clearly or fix it.


  4. Take care of handling edge cases. When your library is called with a wrong type or with a value which is not supported, it should say, in plain English, what exactly is wrong. What it shouldn't do is to raise a cryptic exception ten levels down the stack and let the user figure out what went wrong.







share|improve this answer























  • Thank you, I completely agree that the quality of documentation makes or breaks a project. (It's usually the second thing I check when deciding whether to use a project, after the date of the last commit.) On a more technical level, there is a confusingly large ecosystem of tools for managing documentation of Python code. How can I tell which one I should invest in learning for my project?
    – Nathaniel
    2 days ago






  • 3




    @Nathaniel Sphinx is a bit tricky to set up but is the de-facto standard. You can use readthedocs.org to host Sphinx documentation on the web. Sphinx is able to use the docstrings from the functions and modules in your library. Alternatively, just type up the docs yourself in the readme file, but that gets unwieldy for larger projects. The Python project I maintain uses Github pages for the Sphinx documentation which means that I have to commit the HTML files, though I'm planning to move away from that.
    – amon
    2 days ago






  • 4




    How can I tell which one I should invest in learning for my project? - you don't. You spend a little time choosing one that seems reasonable and roll with it. As a javascript dev where you have 40 options for every decision, I promise this is the right decision :)
    – aaaaaa
    2 days ago



















2














Having used a fair few less than mature libraries over the years a key piece of advice is once you’ve picked your deployment tool do the following:
Does your library do something really useful that you can build a community around?



Identify the your library dependencies.



Attempt a deployment into a clean environment either a docket container or VM. I consider this step crucial as all to often there’s something unique about a personal environment that causes problems.



Consider who is going to maintain the library in the future, there’s nothing more frustrating than coming across a library that was somebody’s pet project for three or four years and then doesn’t get the updates needed to keep it current.



Consider if you or your team want to make the commitment to keep the library tested and documented (unit tests and CI pipelines start being part of the equation ihere).






share|improve this answer








New contributor




ReaddyEddy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "131"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });






    Nathaniel is a new contributor. Be nice, and check out our Code of Conduct.










    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsoftwareengineering.stackexchange.com%2fquestions%2f384748%2fturning-a-personal-python-project-into-a-releasable-library%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    22














    Adding a setup.py, while necessary, is not the most important step if you want your library to be used. More importantly is to add documentation and advertise your library. Since the second point strongly depends on the library, let me rather focus the documentation aspect.




    1. You know everything about your library. And this is problematic. You already know how to install and how to use it, so many things may seem intuitive or plainly obvious to you. Unfortunately, the same things may be neither obvious, not intuitive for the users. Try to look at your library as if you knew nothing about it, and more importantly, ask other people to use it and try to spot all the difficulties they had.


    2. Explain, in plain English, what is your library about. Too many libraries assume that everybody knows about them. When this is not the case, it may be difficult to grasp what is the purpose of the library.


    3. Write detailed technical documentation, but also don't forget about short pieces of code which show how to do some of the tasks with your library. Most developers are in a hurry, and if they need to spend hours trying to understand how to do a basic thing, they may tend to switch to other libraries.


    4. Include your contact information. If your library is a success (and my own experience have shown that this is the case even for rather unknown ones as well), people would encounter difficulties with it: either bugs or simply difficulties understanding or using some parts of it. It is often useful to receive their feedback to improve your library: for every person who reported a problem, there are possibly hundreds who, when encountering it, would just prefer to switch to another library.



    Additionally to that:




    1. Make it clear if your library works with Python 2 or 3 or both.


    2. If the library doesn't work on Windows, say so.


    3. Ensure you use official conventions (use pep8 to check). If not, either explain it clearly or fix it.


    4. Take care of handling edge cases. When your library is called with a wrong type or with a value which is not supported, it should say, in plain English, what exactly is wrong. What it shouldn't do is to raise a cryptic exception ten levels down the stack and let the user figure out what went wrong.







    share|improve this answer























    • Thank you, I completely agree that the quality of documentation makes or breaks a project. (It's usually the second thing I check when deciding whether to use a project, after the date of the last commit.) On a more technical level, there is a confusingly large ecosystem of tools for managing documentation of Python code. How can I tell which one I should invest in learning for my project?
      – Nathaniel
      2 days ago






    • 3




      @Nathaniel Sphinx is a bit tricky to set up but is the de-facto standard. You can use readthedocs.org to host Sphinx documentation on the web. Sphinx is able to use the docstrings from the functions and modules in your library. Alternatively, just type up the docs yourself in the readme file, but that gets unwieldy for larger projects. The Python project I maintain uses Github pages for the Sphinx documentation which means that I have to commit the HTML files, though I'm planning to move away from that.
      – amon
      2 days ago






    • 4




      How can I tell which one I should invest in learning for my project? - you don't. You spend a little time choosing one that seems reasonable and roll with it. As a javascript dev where you have 40 options for every decision, I promise this is the right decision :)
      – aaaaaa
      2 days ago
















    22














    Adding a setup.py, while necessary, is not the most important step if you want your library to be used. More importantly is to add documentation and advertise your library. Since the second point strongly depends on the library, let me rather focus the documentation aspect.




    1. You know everything about your library. And this is problematic. You already know how to install and how to use it, so many things may seem intuitive or plainly obvious to you. Unfortunately, the same things may be neither obvious, not intuitive for the users. Try to look at your library as if you knew nothing about it, and more importantly, ask other people to use it and try to spot all the difficulties they had.


    2. Explain, in plain English, what is your library about. Too many libraries assume that everybody knows about them. When this is not the case, it may be difficult to grasp what is the purpose of the library.


    3. Write detailed technical documentation, but also don't forget about short pieces of code which show how to do some of the tasks with your library. Most developers are in a hurry, and if they need to spend hours trying to understand how to do a basic thing, they may tend to switch to other libraries.


    4. Include your contact information. If your library is a success (and my own experience have shown that this is the case even for rather unknown ones as well), people would encounter difficulties with it: either bugs or simply difficulties understanding or using some parts of it. It is often useful to receive their feedback to improve your library: for every person who reported a problem, there are possibly hundreds who, when encountering it, would just prefer to switch to another library.



    Additionally to that:




    1. Make it clear if your library works with Python 2 or 3 or both.


    2. If the library doesn't work on Windows, say so.


    3. Ensure you use official conventions (use pep8 to check). If not, either explain it clearly or fix it.


    4. Take care of handling edge cases. When your library is called with a wrong type or with a value which is not supported, it should say, in plain English, what exactly is wrong. What it shouldn't do is to raise a cryptic exception ten levels down the stack and let the user figure out what went wrong.







    share|improve this answer























    • Thank you, I completely agree that the quality of documentation makes or breaks a project. (It's usually the second thing I check when deciding whether to use a project, after the date of the last commit.) On a more technical level, there is a confusingly large ecosystem of tools for managing documentation of Python code. How can I tell which one I should invest in learning for my project?
      – Nathaniel
      2 days ago






    • 3




      @Nathaniel Sphinx is a bit tricky to set up but is the de-facto standard. You can use readthedocs.org to host Sphinx documentation on the web. Sphinx is able to use the docstrings from the functions and modules in your library. Alternatively, just type up the docs yourself in the readme file, but that gets unwieldy for larger projects. The Python project I maintain uses Github pages for the Sphinx documentation which means that I have to commit the HTML files, though I'm planning to move away from that.
      – amon
      2 days ago






    • 4




      How can I tell which one I should invest in learning for my project? - you don't. You spend a little time choosing one that seems reasonable and roll with it. As a javascript dev where you have 40 options for every decision, I promise this is the right decision :)
      – aaaaaa
      2 days ago














    22












    22








    22






    Adding a setup.py, while necessary, is not the most important step if you want your library to be used. More importantly is to add documentation and advertise your library. Since the second point strongly depends on the library, let me rather focus the documentation aspect.




    1. You know everything about your library. And this is problematic. You already know how to install and how to use it, so many things may seem intuitive or plainly obvious to you. Unfortunately, the same things may be neither obvious, not intuitive for the users. Try to look at your library as if you knew nothing about it, and more importantly, ask other people to use it and try to spot all the difficulties they had.


    2. Explain, in plain English, what is your library about. Too many libraries assume that everybody knows about them. When this is not the case, it may be difficult to grasp what is the purpose of the library.


    3. Write detailed technical documentation, but also don't forget about short pieces of code which show how to do some of the tasks with your library. Most developers are in a hurry, and if they need to spend hours trying to understand how to do a basic thing, they may tend to switch to other libraries.


    4. Include your contact information. If your library is a success (and my own experience have shown that this is the case even for rather unknown ones as well), people would encounter difficulties with it: either bugs or simply difficulties understanding or using some parts of it. It is often useful to receive their feedback to improve your library: for every person who reported a problem, there are possibly hundreds who, when encountering it, would just prefer to switch to another library.



    Additionally to that:




    1. Make it clear if your library works with Python 2 or 3 or both.


    2. If the library doesn't work on Windows, say so.


    3. Ensure you use official conventions (use pep8 to check). If not, either explain it clearly or fix it.


    4. Take care of handling edge cases. When your library is called with a wrong type or with a value which is not supported, it should say, in plain English, what exactly is wrong. What it shouldn't do is to raise a cryptic exception ten levels down the stack and let the user figure out what went wrong.







    share|improve this answer














    Adding a setup.py, while necessary, is not the most important step if you want your library to be used. More importantly is to add documentation and advertise your library. Since the second point strongly depends on the library, let me rather focus the documentation aspect.




    1. You know everything about your library. And this is problematic. You already know how to install and how to use it, so many things may seem intuitive or plainly obvious to you. Unfortunately, the same things may be neither obvious, not intuitive for the users. Try to look at your library as if you knew nothing about it, and more importantly, ask other people to use it and try to spot all the difficulties they had.


    2. Explain, in plain English, what is your library about. Too many libraries assume that everybody knows about them. When this is not the case, it may be difficult to grasp what is the purpose of the library.


    3. Write detailed technical documentation, but also don't forget about short pieces of code which show how to do some of the tasks with your library. Most developers are in a hurry, and if they need to spend hours trying to understand how to do a basic thing, they may tend to switch to other libraries.


    4. Include your contact information. If your library is a success (and my own experience have shown that this is the case even for rather unknown ones as well), people would encounter difficulties with it: either bugs or simply difficulties understanding or using some parts of it. It is often useful to receive their feedback to improve your library: for every person who reported a problem, there are possibly hundreds who, when encountering it, would just prefer to switch to another library.



    Additionally to that:




    1. Make it clear if your library works with Python 2 or 3 or both.


    2. If the library doesn't work on Windows, say so.


    3. Ensure you use official conventions (use pep8 to check). If not, either explain it clearly or fix it.


    4. Take care of handling edge cases. When your library is called with a wrong type or with a value which is not supported, it should say, in plain English, what exactly is wrong. What it shouldn't do is to raise a cryptic exception ten levels down the stack and let the user figure out what went wrong.








    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited yesterday









    candied_orange

    52.4k1697185




    52.4k1697185










    answered 2 days ago









    Arseni Mourzenko

    113k26279449




    113k26279449












    • Thank you, I completely agree that the quality of documentation makes or breaks a project. (It's usually the second thing I check when deciding whether to use a project, after the date of the last commit.) On a more technical level, there is a confusingly large ecosystem of tools for managing documentation of Python code. How can I tell which one I should invest in learning for my project?
      – Nathaniel
      2 days ago






    • 3




      @Nathaniel Sphinx is a bit tricky to set up but is the de-facto standard. You can use readthedocs.org to host Sphinx documentation on the web. Sphinx is able to use the docstrings from the functions and modules in your library. Alternatively, just type up the docs yourself in the readme file, but that gets unwieldy for larger projects. The Python project I maintain uses Github pages for the Sphinx documentation which means that I have to commit the HTML files, though I'm planning to move away from that.
      – amon
      2 days ago






    • 4




      How can I tell which one I should invest in learning for my project? - you don't. You spend a little time choosing one that seems reasonable and roll with it. As a javascript dev where you have 40 options for every decision, I promise this is the right decision :)
      – aaaaaa
      2 days ago


















    • Thank you, I completely agree that the quality of documentation makes or breaks a project. (It's usually the second thing I check when deciding whether to use a project, after the date of the last commit.) On a more technical level, there is a confusingly large ecosystem of tools for managing documentation of Python code. How can I tell which one I should invest in learning for my project?
      – Nathaniel
      2 days ago






    • 3




      @Nathaniel Sphinx is a bit tricky to set up but is the de-facto standard. You can use readthedocs.org to host Sphinx documentation on the web. Sphinx is able to use the docstrings from the functions and modules in your library. Alternatively, just type up the docs yourself in the readme file, but that gets unwieldy for larger projects. The Python project I maintain uses Github pages for the Sphinx documentation which means that I have to commit the HTML files, though I'm planning to move away from that.
      – amon
      2 days ago






    • 4




      How can I tell which one I should invest in learning for my project? - you don't. You spend a little time choosing one that seems reasonable and roll with it. As a javascript dev where you have 40 options for every decision, I promise this is the right decision :)
      – aaaaaa
      2 days ago
















    Thank you, I completely agree that the quality of documentation makes or breaks a project. (It's usually the second thing I check when deciding whether to use a project, after the date of the last commit.) On a more technical level, there is a confusingly large ecosystem of tools for managing documentation of Python code. How can I tell which one I should invest in learning for my project?
    – Nathaniel
    2 days ago




    Thank you, I completely agree that the quality of documentation makes or breaks a project. (It's usually the second thing I check when deciding whether to use a project, after the date of the last commit.) On a more technical level, there is a confusingly large ecosystem of tools for managing documentation of Python code. How can I tell which one I should invest in learning for my project?
    – Nathaniel
    2 days ago




    3




    3




    @Nathaniel Sphinx is a bit tricky to set up but is the de-facto standard. You can use readthedocs.org to host Sphinx documentation on the web. Sphinx is able to use the docstrings from the functions and modules in your library. Alternatively, just type up the docs yourself in the readme file, but that gets unwieldy for larger projects. The Python project I maintain uses Github pages for the Sphinx documentation which means that I have to commit the HTML files, though I'm planning to move away from that.
    – amon
    2 days ago




    @Nathaniel Sphinx is a bit tricky to set up but is the de-facto standard. You can use readthedocs.org to host Sphinx documentation on the web. Sphinx is able to use the docstrings from the functions and modules in your library. Alternatively, just type up the docs yourself in the readme file, but that gets unwieldy for larger projects. The Python project I maintain uses Github pages for the Sphinx documentation which means that I have to commit the HTML files, though I'm planning to move away from that.
    – amon
    2 days ago




    4




    4




    How can I tell which one I should invest in learning for my project? - you don't. You spend a little time choosing one that seems reasonable and roll with it. As a javascript dev where you have 40 options for every decision, I promise this is the right decision :)
    – aaaaaa
    2 days ago




    How can I tell which one I should invest in learning for my project? - you don't. You spend a little time choosing one that seems reasonable and roll with it. As a javascript dev where you have 40 options for every decision, I promise this is the right decision :)
    – aaaaaa
    2 days ago













    2














    Having used a fair few less than mature libraries over the years a key piece of advice is once you’ve picked your deployment tool do the following:
    Does your library do something really useful that you can build a community around?



    Identify the your library dependencies.



    Attempt a deployment into a clean environment either a docket container or VM. I consider this step crucial as all to often there’s something unique about a personal environment that causes problems.



    Consider who is going to maintain the library in the future, there’s nothing more frustrating than coming across a library that was somebody’s pet project for three or four years and then doesn’t get the updates needed to keep it current.



    Consider if you or your team want to make the commitment to keep the library tested and documented (unit tests and CI pipelines start being part of the equation ihere).






    share|improve this answer








    New contributor




    ReaddyEddy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      2














      Having used a fair few less than mature libraries over the years a key piece of advice is once you’ve picked your deployment tool do the following:
      Does your library do something really useful that you can build a community around?



      Identify the your library dependencies.



      Attempt a deployment into a clean environment either a docket container or VM. I consider this step crucial as all to often there’s something unique about a personal environment that causes problems.



      Consider who is going to maintain the library in the future, there’s nothing more frustrating than coming across a library that was somebody’s pet project for three or four years and then doesn’t get the updates needed to keep it current.



      Consider if you or your team want to make the commitment to keep the library tested and documented (unit tests and CI pipelines start being part of the equation ihere).






      share|improve this answer








      New contributor




      ReaddyEddy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





















        2












        2








        2






        Having used a fair few less than mature libraries over the years a key piece of advice is once you’ve picked your deployment tool do the following:
        Does your library do something really useful that you can build a community around?



        Identify the your library dependencies.



        Attempt a deployment into a clean environment either a docket container or VM. I consider this step crucial as all to often there’s something unique about a personal environment that causes problems.



        Consider who is going to maintain the library in the future, there’s nothing more frustrating than coming across a library that was somebody’s pet project for three or four years and then doesn’t get the updates needed to keep it current.



        Consider if you or your team want to make the commitment to keep the library tested and documented (unit tests and CI pipelines start being part of the equation ihere).






        share|improve this answer








        New contributor




        ReaddyEddy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        Having used a fair few less than mature libraries over the years a key piece of advice is once you’ve picked your deployment tool do the following:
        Does your library do something really useful that you can build a community around?



        Identify the your library dependencies.



        Attempt a deployment into a clean environment either a docket container or VM. I consider this step crucial as all to often there’s something unique about a personal environment that causes problems.



        Consider who is going to maintain the library in the future, there’s nothing more frustrating than coming across a library that was somebody’s pet project for three or four years and then doesn’t get the updates needed to keep it current.



        Consider if you or your team want to make the commitment to keep the library tested and documented (unit tests and CI pipelines start being part of the equation ihere).







        share|improve this answer








        New contributor




        ReaddyEddy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        share|improve this answer



        share|improve this answer






        New contributor




        ReaddyEddy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered 2 days ago









        ReaddyEddy

        292




        292




        New contributor




        ReaddyEddy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        ReaddyEddy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        ReaddyEddy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






















            Nathaniel is a new contributor. Be nice, and check out our Code of Conduct.










            draft saved

            draft discarded


















            Nathaniel is a new contributor. Be nice, and check out our Code of Conduct.













            Nathaniel is a new contributor. Be nice, and check out our Code of Conduct.












            Nathaniel is a new contributor. Be nice, and check out our Code of Conduct.
















            Thanks for contributing an answer to Software Engineering Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsoftwareengineering.stackexchange.com%2fquestions%2f384748%2fturning-a-personal-python-project-into-a-releasable-library%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

            If I really need a card on my start hand, how many mulligans make sense? [duplicate]

            Alcedinidae